Struct crayon::math::aabb::Aabb2
[−]
[src]
pub struct Aabb2<S> { pub min: Point2<S>, pub max: Point2<S>, }
A two-dimensional AABB, aka a rectangle.
Fields
min: Point2<S>
Minimum point of the AABB.
max: Point2<S>
Maximum point of the AABB.
Methods
impl<S: BaseNum> Aabb2<S>
[src]
pub fn zero() -> Self
[src]
Construct a empty axis-aligned bounding box.
pub fn new(p1: Point2<S>, p2: Point2<S>) -> Aabb2<S>
[src]
Construct a new axis-aligned bounding box from two points.
pub fn to_corners(&self) -> [Point2<S>; 4]
[src]
Compute corners.
pub fn min(&self) -> Point2<S>
[src]
Return a shared reference to the point nearest to (-inf, -inf).
pub fn max(&self) -> Point2<S>
[src]
Return a shared reference to the point nearest to (inf, inf).
pub fn dim(&self) -> Vector2<S>
[src]
Return the dimensions of this AABB.
pub fn volume(&self) -> S
[src]
Return the volume this AABB encloses.
pub fn center(&self) -> Point2<S>
[src]
Return the center point of this AABB.
pub fn grow(&self, p: Point2<S>) -> Self
[src]
Returns a new AABB that is grown to include the given point.
pub fn add_margin(&self, margin: Vector2<S>) -> Self
[src]
Add a margin of the given width around the AABB, returning a new AABB.
pub fn transform<T>(&self, transform: &T) -> Self where
T: Transform<Point2<S>>,
[src]
T: Transform<Point2<S>>,
Apply an arbitrary transform to the corners of this bounding box, return a new conservative bound.
Trait Implementations
impl<S: Copy> Copy for Aabb2<S>
[src]
impl<S: Clone> Clone for Aabb2<S>
[src]
fn clone(&self) -> Aabb2<S>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: PartialEq> PartialEq for Aabb2<S>
[src]
fn eq(&self, __arg_0: &Aabb2<S>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Aabb2<S>) -> bool
[src]
This method tests for !=
.