[][src]Struct parry2d::bounding_volume::AABB

pub struct AABB {
    pub mins: Point<Real>,
    pub maxs: Point<Real>,
}

An Axis Aligned Bounding Box.

Fields

mins: Point<Real>maxs: Point<Real>

Implementations

impl AABB[src]

pub fn new(mins: Point<Real>, maxs: Point<Real>) -> AABB[src]

Creates a new AABB.

Arguments:

  • mins - position of the point with the smallest coordinates.
  • maxs - position of the point with the highest coordinates. Each component of mins must be smaller than the related components of maxs.

pub fn new_invalid() -> Self[src]

Creates an invalid AABB with mins components set to Real::max_values and maxscomponents set to -Real::max_values.

This is often used as the initial values of some AABB merging algorithms.

pub fn from_half_extents(
    center: Point<Real>,
    half_extents: Vector<Real>
) -> Self
[src]

Creates a new AABB from its center and its half-extents.

pub fn from_points<'a, I>(pts: I) -> Self where
    I: IntoIterator<Item = &'a Point<Real>>, 
[src]

Creates a new AABB from a set of points.

pub fn center(&self) -> Point<Real>[src]

The center of this AABB.

pub fn half_extents(&self) -> Vector<Real>[src]

The half extents of this AABB.

pub fn extents(&self) -> Vector<Real>[src]

The extents of this AABB.

pub fn take_point(&mut self, pt: Point<Real>)[src]

Enlarges this AABB so it also contains the point pt.

pub fn transform_by(&self, m: &Isometry<Real>) -> Self[src]

Computes the AABB bounding self transformed by m.

pub fn bounding_sphere(&self) -> BoundingSphere[src]

The smallest bounding sphere containing this AABB.

pub fn contains_local_point(&self, point: &Point<Real>) -> bool[src]

impl AABB[src]

pub fn clip_segment(
    &self,
    pa: &Point<Real>,
    pb: &Point<Real>
) -> Option<Segment>
[src]

Computes the intersection of a segment with this AABB.

Returns None if there is no intersection.

pub fn clip_line_parameters(
    &self,
    orig: &Point<Real>,
    dir: &Vector<Real>
) -> Option<(Real, Real)>
[src]

Computes the parameters of the two intersection points between a line and this AABB.

The parameters are such that the point are given by orig + dir * parameter. Returns None if there is no intersection.

pub fn clip_line(
    &self,
    orig: &Point<Real>,
    dir: &Vector<Real>
) -> Option<Segment>
[src]

Computes the intersection segment between a line and this AABB.

Returns None if there is no intersection.

pub fn clip_ray_parameters(&self, ray: &Ray) -> Option<(Real, Real)>[src]

Computes the parameters of the two intersection points between a ray and this AABB.

The parameters are such that the point are given by ray.orig + ray.dir * parameter. Returns None if there is no intersection.

pub fn clip_ray(&self, ray: &Ray) -> Option<Segment>[src]

Computes the intersection segment between a ray and this AABB.

Returns None if there is no intersection.

impl AABB[src]

pub fn clip_polygon(&self, points: &mut Vec<Point<Real>>)[src]

Computes the intersections between this AABB and the given polygon.

The results is written into points directly. The input points are assumed to form a convex polygon where all points lie on the same plane. In order to avoid internal allocations, uses self.clip_polygon_with_workspace instead.

pub fn clip_polygon_with_workspace(
    &self,
    points: &mut Vec<Point<Real>>,
    workspace: &mut Vec<Point<Real>>
)
[src]

Computes the intersections between this AABB and the given polygon.

The results is written into points directly. The input points are assumed to form a convex polygon where all points lie on the same plane.

Trait Implementations

impl BoundingVolume for AABB[src]

impl Clone for AABB[src]

impl Copy for AABB[src]

impl Debug for AABB[src]

impl PartialEq<AABB> for AABB[src]

impl PointQuery for AABB[src]

impl RayCast for AABB[src]

impl StructuralPartialEq for AABB[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,