Skip to main content

Box2d

Struct Box2d 

Source
pub struct Box2d {
    pub halfsize: Vec2,
}
Expand description

2D rectangle centered at the origin.

Fields§

§halfsize: Vec2

Implementations§

Source§

impl Box2d

Source

pub const fn with_halfdims(x: f32, y: f32) -> Self

Source

pub const fn new(halfsize: Vec2) -> Self

Source

pub fn cover(&mut self, point: &Vec2)

Trait Implementations§

Source§

impl Clone for Box2d

Source§

fn clone(&self) -> Box2d

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CollidesRel2d<Point> for Box2d

Source§

fn collides_rel(&self, _t: &Point, rel: &impl Transformation2d) -> bool

Checks whether objects collide. Read more
Source§

impl Copy for Box2d

Source§

impl Debug for Box2d

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Box2d

Source§

fn default() -> Box2d

Returns the “default value” for a type. Read more
Source§

impl ExtremePoint2d for Box2d

Source§

fn extreme_point(&self, direction: Vec2) -> Vec2

Computes the farthest point along a direction. Read more
Source§

impl MinkowskiNegationIsIdentity for Box2d

Source§

impl MinkowskiSum<Ball> for Box2d

Source§

type Output = RoundedBox2d

Source§

fn minkowski_sum(&self, t: &Ball) -> Self::Output

Computes Minkowski sum of self and t. Read more
Source§

impl MinkowskiSum<Box2d> for Ball

Source§

type Output = RoundedBox2d

Source§

fn minkowski_sum(&self, t: &Box2d) -> Self::Output

Computes Minkowski sum of self and t. Read more
Source§

impl MinkowskiSum<Box2d> for Box2d

Source§

type Output = Box2d

Source§

fn minkowski_sum(&self, t: &Box2d) -> Self::Output

Computes Minkowski sum of self and t. Read more
Source§

impl PartialEq for Box2d

Source§

fn eq(&self, other: &Box2d) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PenetratesRel2d<Point> for Box2d

Source§

fn penetrates_rel(&self, t: &Point, rel: &impl Transformation2d) -> Option<Vec2>

Computes the smallest penetration vector between self and t. Read more
Source§

impl SdfRel2d<Point> for Box2d

Source§

fn sdf_rel(&self, t: &Point, rel: &impl Transformation2d) -> f32

Computes scalar signed-distance between self and t. Read more
Source§

impl SdfRel2dVector<Point> for Box2d

Source§

fn sdfv_rel(&self, t: &Point, rel: &impl Transformation2d) -> Vec2

Computes vector signed-distance between self and t. Read more
Source§

impl StructuralPartialEq for Box2d

Source§

impl SymmetricBoundingBox2d for Box2d

Source§

fn symmetric_bounding_box(&self) -> Box2d

Computes the bounding box. Read more

Auto Trait Implementations§

§

impl Freeze for Box2d

§

impl RefUnwindSafe for Box2d

§

impl Send for Box2d

§

impl Sync for Box2d

§

impl Unpin for Box2d

§

impl UnsafeUnpin for Box2d

§

impl UnwindSafe for Box2d

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<A, B, T> Collides2d<B, T> for A

Source§

fn collides(&self, transform: &T, t: &B, t_transform: &T) -> bool

Checks whether objects collide. Read more
Source§

impl<A, B, C> CollidesRel2d<B> for A
where A: DefaultCol2dImpls + MinkowskiDifference<B, Output = C>, C: CollidesRel2d<Point>,

Source§

fn collides_rel(&self, t: &B, rel: &impl Transformation2d) -> bool

Checks whether objects collide. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U, V> MinkowskiDifference<U> for T
where T: MinkowskiSum<U, Output = V>, U: MinkowskiNegation,

Source§

type Output = V

Source§

fn minkowski_difference(&self, t: &U) -> <T as MinkowskiDifference<U>>::Output

Computes Minkowski difference between self and t. Read more
Source§

impl<'l, A, B, C> MinkowskiDifferenceLifetimed<'l, B> for A
where B: 'l, C: 'l, A: MinkowskiDifference<B, Output = C>,

Source§

impl<T> MinkowskiNegation for T

Source§

fn minkowski_negation(&self) -> T

Computes Minkowski negation. (Reflection about the origin) Read more
Source§

impl<A, B, T> Penetrates2d<B, T> for A

Source§

fn penetrates(&self, a_transform: &T, b: &B, b_transform: &T) -> Option<Vec2>

Computes the smallest penetration vector between self and t. Read more
Source§

impl<A, B, C> PenetratesRel2d<B> for A
where A: DefaultCol2dImpls + MinkowskiDifference<B, Output = C>, C: PenetratesRel2d<Point>,

Source§

fn penetrates_rel(&self, t: &B, rel: &impl Transformation2d) -> Option<Vec2>

Computes the smallest penetration vector between self and t. Read more
Source§

impl<A, B, T> Sdf2d<B, T> for A

Source§

fn sdf(&self, a_transform: &T, b: &B, b_transform: &T) -> f32

Computes scalar signed-distance between self and t. Read more
Source§

impl<A, B, T> Sdf2dVector<B, T> for A

Source§

fn sdfv(&self, a_transform: &T, b: &B, b_transform: &T) -> Vec2

Computes vector signed-distance between self and t. Read more
Source§

impl<A, B, C> SdfRel2d<B> for A
where A: DefaultCol2dImpls + MinkowskiDifference<B, Output = C>, C: SdfRel2d<Point>,

Source§

fn sdf_rel(&self, t: &B, rel: &impl Transformation2d) -> f32

Computes scalar signed-distance between self and t. Read more
Source§

impl<A, B, C> SdfRel2dVector<B> for A
where A: DefaultCol2dImpls + MinkowskiDifference<B, Output = C>, C: SdfRel2dVector<Point>,

Source§

fn sdfv_rel(&self, t: &B, rel: &impl Transformation2d) -> Vec2

Computes vector signed-distance between self and t. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.