pub struct Ellipse<U> {
pub radius: Size2D<f32, U>,
pub total_arc_length: f32,
}
Expand description
Represents an ellipse centred at a local space origin.
Fields§
§radius: Size2D<f32, U>
§total_arc_length: f32
Implementations§
source§impl<U> Ellipse<U>
impl<U> Ellipse<U>
pub fn new(radius: Size2D<f32, U>) -> Ellipse<U>
sourcepub fn find_angle_for_arc_length(&self, arc_length: f32) -> f32
pub fn find_angle_for_arc_length(&self, arc_length: f32) -> f32
Binary search to estimate the angle of an ellipse for a given arc length. This only searches over the first quadrant of an ellipse.
sourcepub fn get_point_and_tangent(&self, theta: f32) -> (LayoutPoint, LayoutPoint)
pub fn get_point_and_tangent(&self, theta: f32) -> (LayoutPoint, LayoutPoint)
Get a point and tangent on this ellipse from a given angle. This only works for the first quadrant of the ellipse.
pub fn contains(&self, point: LayoutPoint) -> bool
sourcefn signed_distance(&self, point: LayoutVector2D) -> f32
fn signed_distance(&self, point: LayoutVector2D) -> f32
Find the signed distance from this ellipse given a point. Taken from http://www.iquilezles.org/www/articles/ellipsedist/ellipsedist.htm
Trait Implementations§
Auto Trait Implementations§
impl<U> Freeze for Ellipse<U>
impl<U> RefUnwindSafe for Ellipse<U>where
U: RefUnwindSafe,
impl<U> Send for Ellipse<U>where
U: Send,
impl<U> Sync for Ellipse<U>where
U: Sync,
impl<U> Unpin for Ellipse<U>where
U: Unpin,
impl<U> UnwindSafe for Ellipse<U>where
U: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more