Struct shape_core::Ellipse
source · #[repr(C)]pub struct Ellipse<T> {
pub center: Point<T>,
pub radius: (T, T),
pub rotate: T,
}
Expand description
An ellipse defined by center and axes.
Fields§
§center: Point<T>
The center points of the ellipse.
radius: (T, T)
The axes of the ellipse.
rotate: T
The rotation of the ellipse.
Implementations§
source§impl<T> Ellipse<T>where
T: Clone + Real + FloatConst,
impl<T> Ellipse<T>where T: Clone + Real + FloatConst,
sourcepub fn new<P>(center: P, radius: (T, T), angle: T) -> Selfwhere
P: Into<Point<T>>,
pub fn new<P>(center: P, radius: (T, T), angle: T) -> Selfwhere P: Into<Point<T>>,
Create a new ellipse with the center and the two axes and .
sourcepub fn from_coefficient(a: T, b: T, c: T, d: T, e: T, f: T) -> Self
pub fn from_coefficient(a: T, b: T, c: T, d: T, e: T, f: T) -> Self
Create a new ellipse with the coefficient of equation.
a x^2 + b y^2 + c xy + d x + e y + f = 0
source§impl<T> Ellipse<T>where
T: Zero + PartialEq,
impl<T> Ellipse<T>where T: Zero + PartialEq,
sourcepub fn is_horizontal(&self) -> bool
pub fn is_horizontal(&self) -> bool
a / pi in Z
source§impl<T> Ellipse<T>where
T: Real,
impl<T> Ellipse<T>where T: Real,
sourcepub fn major_axis(&self) -> &T
pub fn major_axis(&self) -> &T
Return the center of the ellipse.
sourcepub fn minor_axis(&self) -> &T
pub fn minor_axis(&self) -> &T
Get the minor axis of the ellipse.
sourcepub fn homogeneous(&self) -> (T, T, T, T, T, T)
pub fn homogeneous(&self) -> (T, T, T, T, T, T)
Return the homogeneous coefficients.
Ax^2 + 2Bxy + Cy^2 + 2Dx + 2Ey + F = 0
sourcepub fn coefficients(&self) -> (T, T, T, T, T, T)
pub fn coefficients(&self) -> (T, T, T, T, T, T)
Return the coefficients.
a x^2 + b xy + c y^2 + d x + e y + f = 0
sourcepub fn major_delta(&self) -> T
pub fn major_delta(&self) -> T
Get the major delta of the ellipse.
\Delta =
\begin{vmatrix}
A & B & D \\
B & C & E \\
D & E & F \\
\end{vmatrix}
= ACF+2BDE-AE^2-CD^2-FB^2
sourcepub fn minor_delta(&self) -> T
pub fn minor_delta(&self) -> T
Get the minor delta of the ellipse.
\delta =
\begin{vmatrix}
A & B \\
B & C \\
\end{vmatrix}
= AC - B^2
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Ellipse<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Ellipse<T>where T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<T: PartialEq> PartialEq for Ellipse<T>
impl<T: PartialEq> PartialEq for Ellipse<T>
source§impl<T> Projective<T> for Ellipse<T>where
T: Float + AddAssign,
impl<T> Projective<T> for Ellipse<T>where T: Float + AddAssign,
impl<T: Copy> Copy for Ellipse<T>
impl<T: Eq> Eq for Ellipse<T>
impl<T> StructuralEq for Ellipse<T>
impl<T> StructuralPartialEq for Ellipse<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Ellipse<T>where T: RefUnwindSafe,
impl<T> Send for Ellipse<T>where T: Send,
impl<T> Sync for Ellipse<T>where T: Sync,
impl<T> Unpin for Ellipse<T>where T: Unpin,
impl<T> UnwindSafe for Ellipse<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more