pub struct Ellipse { /* private fields */ }
Expand description
An ellipse.
Implementations§
source§impl Ellipse
impl Ellipse
sourcepub 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
.
sourcepub fn from_rect(rect: Rect) -> Self
pub fn from_rect(rect: Rect) -> Self
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.
sourcepub fn from_affine(affine: Affine) -> Self
pub fn from_affine(affine: Affine) -> Self
Create an ellipse from an affine transformation of the unit circle.
sourcepub 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.
sourcepub 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.
sourcepub 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
.
sourcepub 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§
source§impl<'de> Deserialize<'de> for Ellipse
impl<'de> Deserialize<'de> for Ellipse
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>,
source§impl JsonSchema for Ellipse
impl JsonSchema for Ellipse
source§fn schema_name() -> String
fn schema_name() -> String
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq<Ellipse> for Ellipse
impl PartialEq<Ellipse> for Ellipse
source§impl Shape for Ellipse
impl Shape for Ellipse
§type PathElementsIter<'iter> = Chain<Once<PathEl>, ArcAppendIter>
type PathElementsIter<'iter> = Chain<Once<PathEl>, ArcAppendIter>
path_elements
method.