pub struct Ellipse3D { /* private fields */ }Expand description
A 3D ellipse defined by center, normal, and two semi-axis lengths.
Parameterized as P(t) = center + a*cos(t)*u + b*sin(t)*v.
Implementations§
Source§impl Ellipse3D
impl Ellipse3D
Sourcepub fn new(
center: Point3,
normal: Vec3,
semi_major: f64,
semi_minor: f64,
) -> Result<Self, MathError>
pub fn new( center: Point3, normal: Vec3, semi_major: f64, semi_minor: f64, ) -> Result<Self, MathError>
Create a new ellipse.
semi_major is the larger radius, semi_minor the smaller.
The major axis lies along the u_axis direction (computed from normal).
§Errors
Returns an error if either semi-axis is non-positive.
Sourcepub fn new_with_ref(
center: Point3,
normal: Vec3,
semi_major: f64,
semi_minor: f64,
ref_dir: Vec3,
) -> Result<Self, MathError>
pub fn new_with_ref( center: Point3, normal: Vec3, semi_major: f64, semi_minor: f64, ref_dir: Vec3, ) -> Result<Self, MathError>
Create a new ellipse with a caller-supplied reference major-axis direction.
ref_dir is projected onto the plane perpendicular to normal to
produce u_axis (which carries the semi_major extent). If
ref_dir is parallel to normal, falls back to an arbitrary
perpendicular choice per Frame3::from_normal_and_ref.
§Errors
Returns an error if either semi-axis is non-positive, semi_minor
exceeds semi_major, or normal is zero.
Sourcepub const fn semi_major(&self) -> f64
pub const fn semi_major(&self) -> f64
Semi-major axis length.
Sourcepub const fn semi_minor(&self) -> f64
pub const fn semi_minor(&self) -> f64
Semi-minor axis length.
Sourcepub fn approximate_circumference(&self) -> f64
pub fn approximate_circumference(&self) -> f64
Approximate circumference using Ramanujan’s formula.