Struct bevy_math::primitives::Ellipse
source · pub struct Ellipse {
pub half_size: Vec2,
}
Expand description
An ellipse primitive
Fields§
§half_size: Vec2
Half of the width and height of the ellipse.
This corresponds to the two perpendicular radii defining the ellipse.
Implementations§
source§impl Ellipse
impl Ellipse
sourcepub const fn new(half_width: f32, half_height: f32) -> Self
pub const fn new(half_width: f32, half_height: f32) -> Self
Create a new Ellipse
from half of its width and height.
This corresponds to the two perpendicular radii defining the ellipse.
sourcepub fn from_size(size: Vec2) -> Self
pub fn from_size(size: Vec2) -> Self
Create a new Ellipse
from a given full size.
size.x
is the diameter along the X axis, and size.y
is the diameter along the Y axis.
sourcepub fn semi_major(self) -> f32
pub fn semi_major(self) -> f32
Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse.
sourcepub fn semi_minor(self) -> f32
pub fn semi_minor(self) -> f32
Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse.
Trait Implementations§
source§impl Bounded2d for Ellipse
impl Bounded2d for Ellipse
source§fn aabb_2d(&self, translation: Vec2, rotation: f32) -> Aabb2d
fn aabb_2d(&self, translation: Vec2, rotation: f32) -> Aabb2d
Get an axis-aligned bounding box for the shape with the given translation and rotation.
The rotation is in radians, counterclockwise, with 0 meaning no rotation.
source§fn bounding_circle(&self, translation: Vec2, _rotation: f32) -> BoundingCircle
fn bounding_circle(&self, translation: Vec2, _rotation: f32) -> BoundingCircle
Get a bounding circle for the shape
The rotation is in radians, counterclockwise, with 0 meaning no rotation.
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Ellipse
impl PartialEq for Ellipse
impl Copy for Ellipse
impl Primitive2d for Ellipse
impl StructuralPartialEq 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§
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