Struct kurbo::Ellipse[][src]

pub struct Ellipse { /* fields omitted */ }

An ellipse.

Implementations

impl Ellipse[src]

pub fn new(
    center: impl Into<Point>,
    radii: impl Into<Vec2>,
    x_rotation: f64
) -> Ellipse
[src]

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) -> Self[src]

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) -> Self[src]

Create an ellipse from an affine transformation of the unit circle.

#[must_use]pub fn with_center(self, new_center: Point) -> Ellipse[src]

Create a new Ellipse centered on the provided point.

#[must_use]pub fn with_radii(self, new_radii: Vec2) -> Ellipse[src]

Create a new Ellipse with the provided radii.

#[must_use]pub fn with_rotation(self, rotation: f64) -> Ellipse[src]

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[src]

Returns the center of this ellipse.

pub fn radii(&self) -> Vec2[src]

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[src]

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[src]

Is this ellipse finite?

pub fn is_nan(&self) -> bool[src]

Is this ellipse NaN?

Trait Implementations

impl Add<Vec2> for Ellipse[src]

type Output = Ellipse

The resulting type after applying the + operator.

fn add(self, v: Vec2) -> Ellipse[src]

In this context adding a Vec2 applies the corresponding translation to the eliipse.

impl Clone for Ellipse[src]

impl Copy for Ellipse[src]

impl Debug for Ellipse[src]

impl Default for Ellipse[src]

impl<'de> Deserialize<'de> for Ellipse[src]

impl From<Circle> for Ellipse[src]

impl Mul<Ellipse> for Affine[src]

type Output = Ellipse

The resulting type after applying the * operator.

impl PartialEq<Ellipse> for Ellipse[src]

impl Serialize for Ellipse[src]

impl Shape for Ellipse[src]

type PathElementsIter = Chain<Once<PathEl>, ArcAppendIter>

The iterator returned by the path_elements method. Read more

impl StructuralPartialEq for Ellipse[src]

impl Sub<Vec2> for Ellipse[src]

type Output = Ellipse

The resulting type after applying the - operator.

fn sub(self, v: Vec2) -> Ellipse[src]

In this context subtracting a Vec2 applies the corresponding translation to the eliipse.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.