AlignedBox< _Scalar, _AmbientDim > Class Template Reference

An axis aligned box. More...

#include <AlignedBox.h>

Public Types

enum  CornerType {
  Min ,
  Max ,
  BottomLeft ,
  BottomRight ,
  TopLeft ,
  TopRight ,
  BottomLeftFloor ,
  BottomRightFloor ,
  TopLeftFloor ,
  TopRightFloor ,
  BottomLeftCeil ,
  BottomRightCeil ,
  TopLeftCeil ,
  TopRightCeil
}
 

Public Member Functions

 AlignedBox ()
 
template<typename OtherScalarType>
 AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
 
template<typename Derived>
 AlignedBox (const MatrixBase< Derived > &a_p)
 
template<typename OtherVectorType1, typename OtherVectorType2>
 AlignedBox (const OtherVectorType1 &_min, const OtherVectorType2 &_max)
 
 AlignedBox (Index _dim)
 
template<typename NewScalarType>
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast () const
 
const CwiseUnaryOp< internal::scalar_quotient1_op< Scalar >, const CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorType > > center () const
 
AlignedBoxclamp (const AlignedBox &b)
 
bool contains (const AlignedBox &b) const
 
template<typename Derived>
bool contains (const MatrixBase< Derived > &a_p) const
 
VectorType corner (CornerType corner) const
 
CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorTypediagonal () const
 
Index dim () const
 
AlignedBoxextend (const AlignedBox &b)
 
template<typename Derived>
AlignedBoxextend (const MatrixBase< Derived > &a_p)
 
NonInteger exteriorDistance (const AlignedBox &b) const
 
template<typename Derived>
NonInteger exteriorDistance (const MatrixBase< Derived > &p) const
 
AlignedBox intersection (const AlignedBox &b) const
 
bool isApprox (const AlignedBox &other, RealScalar prec=ScalarTraits::dummy_precision()) const
 
bool isEmpty () const
 
bool isNull () const
 
VectorTypemax ()
 
const VectorTypemax () const
 
AlignedBox merged (const AlignedBox &b) const
 
VectorTypemin ()
 
const VectorTypemin () const
 
VectorType sample () const
 
void setEmpty ()
 
void setNull ()
 
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorTypesizes () const
 
Scalar squaredExteriorDistance (const AlignedBox &b) const
 
template<typename Derived>
Scalar squaredExteriorDistance (const MatrixBase< Derived > &a_p) const
 
template<typename Derived>
AlignedBoxtranslate (const MatrixBase< Derived > &a_t)
 
Scalar volume () const
 

Detailed Description

template<typename _Scalar, int _AmbientDim>
class Eigen::AlignedBox< _Scalar, _AmbientDim >

An axis aligned box.

This is defined in the Geometry module.

#include <Eigen/Geometry>
Parameters
_Scalarthe type of the scalar coefficients
_AmbientDimthe dimension of the ambient space, can be a compile time value or Dynamic.

This class represents an axis aligned box as a pair of the minimal and maximal corners.

Member Enumeration Documentation

◆ CornerType

template<typename _Scalar, int _AmbientDim>
enum CornerType

Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box

Enumerator
Min 

1D names

BottomLeft 

Added names for 2D

BottomLeftFloor 

Added names for 3D

Constructor & Destructor Documentation

◆ AlignedBox() [1/5]

template<typename _Scalar, int _AmbientDim>
AlignedBox ( )
inlineexplicit

Default constructor initializing a null box.

Referenced by AlignedBox< int, 1 >::intersection(), AlignedBox< int, 1 >::merged(), and squaredExteriorDistance().

◆ AlignedBox() [2/5]

template<typename _Scalar, int _AmbientDim>
AlignedBox ( Index _dim)
inlineexplicit

Constructs a null box with _dim the dimension of the ambient space.

◆ AlignedBox() [3/5]

template<typename _Scalar, int _AmbientDim>
template<typename OtherVectorType1, typename OtherVectorType2>
AlignedBox ( const OtherVectorType1 & _min,
const OtherVectorType2 & _max )
inline

Constructs a box with extremities _min and _max.

◆ AlignedBox() [4/5]

template<typename _Scalar, int _AmbientDim>
template<typename Derived>
AlignedBox ( const MatrixBase< Derived > & a_p)
inlineexplicit

Constructs a box containing a single point p.

◆ AlignedBox() [5/5]

template<typename _Scalar, int _AmbientDim>
template<typename OtherScalarType>
AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > & other)
inlineexplicit

Copy constructor with scalar type conversion

Member Function Documentation

◆ cast()

template<typename _Scalar, int _AmbientDim>
template<typename NewScalarType>
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast ( ) const
inline
Returns
*this with scalar type casted to NewScalarType

Note that if NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.

Referenced by AlignedBox< int, 1 >::AlignedBox().

◆ center()

template<typename _Scalar, int _AmbientDim>
const CwiseUnaryOp< internal::scalar_quotient1_op< Scalar >, const CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorType > > center ( ) const
inline
Returns
the center of the box

◆ clamp()

template<typename _Scalar, int _AmbientDim>
AlignedBox & clamp ( const AlignedBox< _Scalar, _AmbientDim > & b)
inline

Clamps *this by the box b and returns a reference to *this.

◆ contains() [1/2]

template<typename _Scalar, int _AmbientDim>
bool contains ( const AlignedBox< _Scalar, _AmbientDim > & b) const
inline
Returns
true if the box b is entirely inside the box *this.

◆ contains() [2/2]

template<typename _Scalar, int _AmbientDim>
template<typename Derived>
bool contains ( const MatrixBase< Derived > & a_p) const
inline
Returns
true if the point p is inside the box *this.

◆ corner()

template<typename _Scalar, int _AmbientDim>
VectorType corner ( CornerType corner) const
inline
Returns
the vertex of the bounding box at the corner defined by the corner-id corner. It works only for a 1D, 2D or 3D bounding box. For 1D bounding boxes corners are named by 2 enum constants: BottomLeft and BottomRight. For 2D bounding boxes, corners are named by 4 enum constants: BottomLeft, BottomRight, TopLeft, TopRight. For 3D bounding boxes, the following names are added: BottomLeftCeil, BottomRightCeil, TopLeftCeil, TopRightCeil.

◆ diagonal()

template<typename _Scalar, int _AmbientDim>
CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > diagonal ( ) const
inline
Returns
an expression for the bounding box diagonal vector if the length of the diagonal is needed: diagonal().norm() will provide it.

◆ dim()

template<typename _Scalar, int _AmbientDim>
Index dim ( ) const
inline

◆ extend() [1/2]

template<typename _Scalar, int _AmbientDim>
AlignedBox & extend ( const AlignedBox< _Scalar, _AmbientDim > & b)
inline

Extends *this such that it contains the box b and returns a reference to *this.

◆ extend() [2/2]

template<typename _Scalar, int _AmbientDim>
template<typename Derived>
AlignedBox & extend ( const MatrixBase< Derived > & a_p)
inline

Extends *this such that it contains the point p and returns a reference to *this.

◆ exteriorDistance() [1/2]

template<typename _Scalar, int _AmbientDim>
NonInteger exteriorDistance ( const AlignedBox< _Scalar, _AmbientDim > & b) const
inline
Returns
the distance between the boxes b and *this, and zero if the boxes intersect.
See also
squaredExteriorDistance()

◆ exteriorDistance() [2/2]

template<typename _Scalar, int _AmbientDim>
template<typename Derived>
NonInteger exteriorDistance ( const MatrixBase< Derived > & p) const
inline
Returns
the distance between the point p and the box *this, and zero if p is inside the box.
See also
squaredExteriorDistance()

◆ intersection()

template<typename _Scalar, int _AmbientDim>
AlignedBox intersection ( const AlignedBox< _Scalar, _AmbientDim > & b) const
inline

Returns an AlignedBox that is the intersection of b and *this

◆ isApprox()

template<typename _Scalar, int _AmbientDim>
bool isApprox ( const AlignedBox< _Scalar, _AmbientDim > & other,
RealScalar prec = ScalarTraits::dummy_precision() ) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

◆ isEmpty()

template<typename _Scalar, int _AmbientDim>
bool isEmpty ( ) const
inline
Returns
true if the box is empty.

Referenced by AlignedBox< int, 1 >::isNull().

◆ isNull()

template<typename _Scalar, int _AmbientDim>
bool isNull ( ) const
inline

◆ max() [1/2]

template<typename _Scalar, int _AmbientDim>
VectorType & max ( )
inline
Returns
a non const reference to the maximal corner

◆ max() [2/2]

template<typename _Scalar, int _AmbientDim>
const VectorType & max ( ) const
inline
Returns
the maximal corner

Referenced by AlignedBox< int, 1 >::AlignedBox(), and AlignedBox< int, 1 >::contains().

◆ merged()

template<typename _Scalar, int _AmbientDim>
AlignedBox merged ( const AlignedBox< _Scalar, _AmbientDim > & b) const
inline

Returns an AlignedBox that is the union of b and *this

◆ min() [1/2]

template<typename _Scalar, int _AmbientDim>
VectorType & min ( )
inline
Returns
a non const reference to the minimal corner

◆ min() [2/2]

template<typename _Scalar, int _AmbientDim>
const VectorType & min ( ) const
inline
Returns
the minimal corner

Referenced by AlignedBox< int, 1 >::AlignedBox(), and AlignedBox< int, 1 >::contains().

◆ sample()

template<typename _Scalar, int _AmbientDim>
VectorType sample ( ) const
inline
Returns
a random point inside the bounding box sampled with a uniform distribution

◆ setEmpty()

template<typename _Scalar, int _AmbientDim>
void setEmpty ( )
inline

◆ setNull()

template<typename _Scalar, int _AmbientDim>
void setNull ( )
inline

◆ sizes()

template<typename _Scalar, int _AmbientDim>
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > sizes ( ) const
inline
Returns
the lengths of the sides of the bounding box. Note that this function does not get the same result for integral or floating scalar types: see

Referenced by AlignedBox< int, 1 >::diagonal(), and AlignedBox< int, 1 >::volume().

◆ squaredExteriorDistance() [1/2]

template<typename Scalar, int AmbientDim>
Scalar squaredExteriorDistance ( const AlignedBox< _Scalar, _AmbientDim > & b) const
inline
Returns
the squared distance between the boxes b and *this, and zero if the boxes intersect.
See also
exteriorDistance()

References AlignedBox(), and dim().

◆ squaredExteriorDistance() [2/2]

template<typename Scalar, int AmbientDim>
template<typename Derived>
Scalar squaredExteriorDistance ( const MatrixBase< Derived > & a_p) const
inline
Returns
the squared distance between the point p and the box *this, and zero if p is inside the box.
See also
exteriorDistance()

References dim().

Referenced by AlignedBox< int, 1 >::exteriorDistance(), and AlignedBox< int, 1 >::exteriorDistance().

◆ translate()

template<typename _Scalar, int _AmbientDim>
template<typename Derived>
AlignedBox & translate ( const MatrixBase< Derived > & a_t)
inline

Translate *this by the vector t and returns a reference to *this.

◆ volume()

template<typename _Scalar, int _AmbientDim>
Scalar volume ( ) const
inline
Returns
the volume of the bounding box

The documentation for this class was generated from the following file: