Skip to main content

Ellipse3D

Struct Ellipse3D 

Source
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

Source

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.

Source

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.

Source

pub fn evaluate(&self, t: f64) -> Point3

Evaluate the ellipse at angle t.

Source

pub fn tangent(&self, t: f64) -> Vec3

Tangent at angle t (not unit-length).

Source

pub const fn center(&self) -> Point3

The ellipse center.

Source

pub const fn semi_major(&self) -> f64

Semi-major axis length.

Source

pub const fn semi_minor(&self) -> f64

Semi-minor axis length.

Source

pub const fn normal(&self) -> Vec3

The ellipse normal (axis direction).

Source

pub fn approximate_circumference(&self) -> f64

Approximate circumference using Ramanujan’s formula.

Source

pub fn project(&self, point: Point3) -> f64

Project a point onto the ellipse, returning the angle parameter.

Source

pub const fn u_axis(&self) -> Vec3

The u-axis direction (major axis direction).

Source

pub const fn v_axis(&self) -> Vec3

The v-axis direction (minor axis direction).

Source

pub fn with_axes( center: Point3, normal: Vec3, semi_major: f64, semi_minor: f64, u_axis: Vec3, v_axis: Vec3, ) -> Result<Self, MathError>

Create an ellipse with explicit basis vectors (for transform/copy).

§Errors

Returns an error if either semi-axis is non-positive.

Trait Implementations§

Source§

impl Clone for Ellipse3D

Source§

fn clone(&self) -> Ellipse3D

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ellipse3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Ellipse3D

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl ParametricCurve for Ellipse3D

Source§

fn evaluate(&self, t: f64) -> Point3

Evaluate the curve at parameter t.
Source§

fn tangent(&self, t: f64) -> Vec3

Tangent vector at parameter t.
Source§

fn domain(&self) -> (f64, f64)

Parameter domain as (t_min, t_max).
Source§

impl Serialize for Ellipse3D

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.