Struct piet_common::kurbo::Ellipse
pub struct Ellipse { /* private fields */ }
Expand description
An ellipse.
Implementations§
§impl Ellipse
impl Ellipse
pub fn new(
center: impl Into<Point>,
radii: impl Into<Vec2>,
x_rotation: f64
) -> Ellipse
pub fn new(
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
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
pub fn from_affine(affine: Affine) -> Ellipse
Create an ellipse from an affine transformation of the unit circle.
pub fn with_center(self, new_center: Point) -> Ellipse
pub fn with_center(self, new_center: Point) -> Ellipse
Create a new Ellipse
centered on the provided point.
pub fn with_radii(self, new_radii: Vec2) -> Ellipse
pub fn with_radii(self, new_radii: Vec2) -> Ellipse
Create a new Ellipse
with the provided radii.
pub fn with_rotation(self, rotation: f64) -> Ellipse
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 radii(&self) -> Vec2
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.
Trait Implementations§
§impl Shape for Ellipse
impl Shape for Ellipse
§type PathElementsIter = Chain<Once<PathEl>, ArcAppendIter>
type PathElementsIter = Chain<Once<PathEl>, ArcAppendIter>
path_elements
method.