Struct bevy_math::primitives::Segment2d
source · pub struct Segment2d {
pub direction: Direction2d,
pub half_length: f32,
}
Expand description
A segment of a line along a direction in 2D space.
Fields§
§direction: Direction2d
The direction of the line segment
half_length: f32
Half the length of the line segment. The segment extends by this amount in both the given direction and its opposite direction
Implementations§
source§impl Segment2d
impl Segment2d
sourcepub fn new(direction: Direction2d, length: f32) -> Self
pub fn new(direction: Direction2d, length: f32) -> Self
Create a new Segment2d
from a direction and full length of the segment
Trait Implementations§
source§impl Bounded2d for Segment2d
impl Bounded2d for Segment2d
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 Segment2d
impl<'de> Deserialize<'de> for Segment2d
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 Segment2d
impl PartialEq for Segment2d
impl Copy for Segment2d
impl Primitive2d for Segment2d
impl StructuralPartialEq for Segment2d
Auto Trait Implementations§
impl RefUnwindSafe for Segment2d
impl Send for Segment2d
impl Sync for Segment2d
impl Unpin for Segment2d
impl UnwindSafe for Segment2d
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