Expand description
A two-dimensional AABB, aka a rectangle.
Fields§
§min: Point2<S>
Minimum point of the AABB.
max: Point2<S>
Maximum point of the AABB.
Implementations§
source§impl<S: BaseNum> Aabb2<S>
impl<S: BaseNum> Aabb2<S>
sourcepub fn new(p1: Point2<S>, p2: Point2<S>) -> Aabb2<S>
pub fn new(p1: Point2<S>, p2: Point2<S>) -> Aabb2<S>
Construct a new axis-aligned bounding box from two points.
sourcepub fn to_corners(&self) -> [Point2<S>; 4]
pub fn to_corners(&self) -> [Point2<S>; 4]
Compute corners.
sourcepub fn grow(&self, p: Point2<S>) -> Self
pub fn grow(&self, p: Point2<S>) -> Self
Returns a new AABB that is grown to include the given point.
sourcepub fn add_margin(&self, margin: Vector2<S>) -> Self
pub fn add_margin(&self, margin: Vector2<S>) -> Self
Add a margin of the given width around the AABB, returning a new AABB.
Trait Implementations§
source§impl<'de, S> Deserialize<'de> for Aabb2<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Aabb2<S>where
S: Deserialize<'de>,
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<S: PartialEq> PartialEq<Aabb2<S>> for Aabb2<S>
impl<S: PartialEq> PartialEq<Aabb2<S>> for Aabb2<S>
impl<S: Copy> Copy for Aabb2<S>
impl<S> StructuralPartialEq for Aabb2<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Aabb2<S>where
S: RefUnwindSafe,
impl<S> Send for Aabb2<S>where
S: Send,
impl<S> Sync for Aabb2<S>where
S: Sync,
impl<S> Unpin for Aabb2<S>where
S: Unpin,
impl<S> UnwindSafe for Aabb2<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more