Struct piet_common::kurbo::Ellipse [−]
An ellipse.
Implementations
impl Ellipse
pub fn new(
center: impl Into<Point>,
radii: impl Into<Vec2>,
x_rotation: f64
) -> Ellipse
center: impl Into<Point>,
radii: impl Into<Vec2>,
x_rotation: f64
) -> Ellipse
Create A new ellipse with a given center, radii, and rotation.
The returned ellipse will be the result of taking a circle, stretching
it by the radii
along the x and y axes, then rotating it from the
x asix by rotation
radians, before finally translating the center
to center
.
Rotation is clockwise in a y-down coordinate system. For more on
rotation, see Affine::rotate
.
pub fn from_rect(rect: Rect) -> Ellipse
Returns the largest ellipse that can be bounded by this Rect
.
This uses the absolute width and height of the rectangle.
This ellipse is always axis-aligned; to apply rotation you can call
with_rotation
with the result.
pub fn from_affine(affine: Affine) -> Ellipse
Create an ellipse from an affine transformation of the unit circle.
#[must_use]pub fn with_center(self, new_center: Point) -> Ellipse
Create a new Ellipse
centered on the provided point.
#[must_use]pub fn with_radii(self, new_radii: Vec2) -> Ellipse
Create a new Ellipse
with the provided radii.
#[must_use]pub fn with_rotation(self, rotation: f64) -> Ellipse
Create a new Ellipse
, with the rotation replaced by rotation
radians.
The rotation is clockwise, for a y-down coordinate system. For more
on rotation, See Affine::rotate
.
pub fn center(&self) -> Point
Returns the center of this ellipse.
pub fn radii(&self) -> Vec2
Returns the two radii of this ellipse.
The first number is the horizontal radius and the second is the vertical radius, before rotation.
pub fn rotation(&self) -> f64
The ellipse’s rotation, in radians.
This allows all possible ellipses to be drawn by always starting with an ellipse with the two radii on the x and y axes.
pub fn is_finite(&self) -> bool
Is this ellipse finite?
pub fn is_nan(&self) -> bool
Is this ellipse NaN?
Trait Implementations
impl Add<Vec2> for Ellipse
type Output = Ellipse
The resulting type after applying the +
operator.
pub fn add(self, v: Vec2) -> Ellipse
In this context adding a Vec2
applies the corresponding translation to the eliipse.
impl Clone for Ellipse
pub fn clone(&self) -> Ellipse
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Ellipse
impl Debug for Ellipse
impl Default for Ellipse
impl From<Circle> for Ellipse
impl Mul<Ellipse> for Affine
type Output = Ellipse
The resulting type after applying the *
operator.
pub fn mul(self, other: Ellipse) -> <Affine as Mul<Ellipse>>::Output
impl PartialEq<Ellipse> for Ellipse
impl Shape for Ellipse
type PathElementsIter = Chain<Once<PathEl>, ArcAppendIter>
The iterator returned by the path_elements
method. Read more
pub fn path_elements(
&self,
tolerance: f64
) -> <Ellipse as Shape>::PathElementsIter
&self,
tolerance: f64
) -> <Ellipse as Shape>::PathElementsIter
pub fn area(&self) -> f64
pub fn perimeter(&self, accuracy: f64) -> f64
pub fn winding(&self, pt: Point) -> i32
pub fn bounding_box(&self) -> Rect
pub fn to_path(&self, tolerance: f64) -> BezPath
pub fn into_path(self, tolerance: f64) -> BezPath
pub fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter>ⓘ
pub fn contains(&self, pt: Point) -> bool
pub fn as_line(&self) -> Option<Line>
pub fn as_rect(&self) -> Option<Rect>
pub fn as_rounded_rect(&self) -> Option<RoundedRect>
pub fn as_circle(&self) -> Option<Circle>
pub fn as_path_slice(&self) -> Option<&[PathEl]>
impl StructuralPartialEq for Ellipse
impl Sub<Vec2> for Ellipse
Auto Trait Implementations
impl RefUnwindSafe for Ellipse
impl Send for Ellipse
impl Sync for Ellipse
impl Unpin for Ellipse
impl UnwindSafe for Ellipse
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
[src]
pub fn round_from(x: T) -> T
[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
[src]
U: RoundFrom<T>,
pub fn round_into(self) -> U
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,