Public Types | Public Member Functions | Protected Attributes
AlignedBox< _Scalar, _AmbientDim > Class Template Reference

An axis aligned box. More...

#include <AlignedBox.h>

List of all members.

Public Types

enum  { AmbientDimAtCompileTime }
enum  CornerType {
  Min,
  Max,
  BottomLeft,
  BottomRight,
  TopLeft,
  TopRight,
  BottomLeftFloor,
  BottomRightFloor,
  TopLeftFloor,
  TopRightFloor,
  BottomLeftCeil,
  BottomRightCeil,
  TopLeftCeil,
  TopRightCeil
}
typedef DenseIndex Index
typedef ScalarTraits::NonInteger NonInteger
typedef ScalarTraits::Real RealScalar
typedef _Scalar Scalar
typedef NumTraits< ScalarScalarTraits
typedef Matrix< Scalar,
AmbientDimAtCompileTime, 1 > 
VectorType

Public Member Functions

 AlignedBox ()
 AlignedBox (Index _dim)
template<typename OtherVectorType1 , typename OtherVectorType2 >
 AlignedBox (const OtherVectorType1 &_min, const OtherVectorType2 &_max)
template<typename Derived >
 AlignedBox (const MatrixBase< Derived > &a_p)
template<typename OtherScalarType >
 AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
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)
template<typename Derived >
bool contains (const MatrixBase< Derived > &a_p) const
bool contains (const AlignedBox &b) const
VectorType corner (CornerType corner) const
CwiseBinaryOp
< internal::scalar_difference_op
< Scalar >, const VectorType,
const VectorType
diagonal () const
Index dim () const
template<typename Derived >
AlignedBoxextend (const MatrixBase< Derived > &a_p)
AlignedBoxextend (const AlignedBox &b)
template<typename Derived >
NonInteger exteriorDistance (const MatrixBase< Derived > &p) const
NonInteger exteriorDistance (const AlignedBox &b) const
AlignedBox intersection (const AlignedBox &b) const
bool isApprox (const AlignedBox &other, RealScalar prec=ScalarTraits::dummy_precision()) const
bool isEmpty () const
bool isNull () const
const VectorType &() max () const
VectorType &() max ()
AlignedBox merged (const AlignedBox &b) const
const VectorType &() min () const
VectorType &() min ()
VectorType sample () const
void setEmpty ()
void setNull ()
const CwiseBinaryOp
< internal::scalar_difference_op
< Scalar >, const VectorType,
const VectorType
sizes () const
template<typename Derived >
Scalar squaredExteriorDistance (const MatrixBase< Derived > &a_p) const
Scalar squaredExteriorDistance (const AlignedBox &b) const
template<typename Derived >
AlignedBoxtranslate (const MatrixBase< Derived > &a_t)
Scalar volume () const
 ~AlignedBox ()

Protected Attributes

VectorType m_max
VectorType m_min

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 Typedef Documentation

typedef DenseIndex Index
typedef ScalarTraits::NonInteger NonInteger
typedef _Scalar Scalar

Member Enumeration Documentation

anonymous enum
Enumerator:
AmbientDimAtCompileTime 
enum CornerType

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

Enumerator:
Min 

1D names

Max 
BottomLeft 

Added names for 2D

BottomRight 
TopLeft 
TopRight 
BottomLeftFloor 

Added names for 3D

BottomRightFloor 
TopLeftFloor 
TopRightFloor 
BottomLeftCeil 
BottomRightCeil 
TopLeftCeil 
TopRightCeil 

Constructor & Destructor Documentation

AlignedBox ( )
inlineexplicit
AlignedBox ( Index  _dim)
inlineexplicit

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

References AlignedBox< _Scalar, _AmbientDim >::setEmpty().

AlignedBox ( const OtherVectorType1 &  _min,
const OtherVectorType2 &  _max 
)
inline

Constructs a box with extremities _min and _max.

AlignedBox ( const MatrixBase< Derived > &  a_p)
inlineexplicit

Constructs a box containing a single point p.

References AlignedBox< _Scalar, _AmbientDim >::m_max, AlignedBox< _Scalar, _AmbientDim >::m_min, and p.

~AlignedBox ( )
inline
AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Member Function Documentation

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.

References AlignedBox< _Scalar, _AmbientDim >::AlignedBox().

const CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const VectorType, const VectorType> > center ( ) const
inline
AlignedBox& clamp ( const AlignedBox< _Scalar, _AmbientDim > &  b)
inline

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

References AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

bool contains ( const MatrixBase< Derived > &  a_p) const
inline
Returns:
true if the point p is inside the box *this.

References AlignedBox< _Scalar, _AmbientDim >::m_max, AlignedBox< _Scalar, _AmbientDim >::m_min, and p.

bool contains ( const AlignedBox< _Scalar, _AmbientDim > &  b) const
inline
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.

References AlignedBox< _Scalar, _AmbientDim >::dim(), EIGEN_STATIC_ASSERT, AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

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.

References AlignedBox< _Scalar, _AmbientDim >::sizes().

Index dim ( ) const
inline
AlignedBox& extend ( const MatrixBase< Derived > &  a_p)
inline

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

References AlignedBox< _Scalar, _AmbientDim >::m_max, AlignedBox< _Scalar, _AmbientDim >::m_min, and p.

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

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

References AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

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()

References sqrt(), and AlignedBox< _Scalar, _AmbientDim >::squaredExteriorDistance().

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()

References sqrt(), and AlignedBox< _Scalar, _AmbientDim >::squaredExteriorDistance().

AlignedBox intersection ( const AlignedBox< _Scalar, _AmbientDim > &  b) const
inline
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()

References AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

bool isEmpty ( ) const
inline
bool isNull ( ) const
inline
const VectorType&() max ( ) const
inline
VectorType&() max ( )
inline
Returns:
a non const reference to the maximal corner

References AlignedBox< _Scalar, _AmbientDim >::m_max.

AlignedBox merged ( const AlignedBox< _Scalar, _AmbientDim > &  b) const
inline
const VectorType&() min ( ) const
inline
VectorType&() min ( )
inline
Returns:
a non const reference to the minimal corner

References AlignedBox< _Scalar, _AmbientDim >::m_min.

VectorType sample ( ) const
inline
Returns:
a random point inside the bounding box sampled with a uniform distribution

References AlignedBox< _Scalar, _AmbientDim >::dim(), GenericNumTraits< Scalar >::IsInteger, AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

void setEmpty ( )
inline
void setNull ( )
inline
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

References AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

Referenced by AlignedBox< _Scalar, _AmbientDim >::diagonal(), and AlignedBox< _Scalar, _AmbientDim >::volume().

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 p.

Referenced by AlignedBox< _Scalar, _AmbientDim >::exteriorDistance().

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< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

AlignedBox& translate ( const MatrixBase< Derived > &  a_t)
inline

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

References AlignedBox< _Scalar, _AmbientDim >::m_max, and AlignedBox< _Scalar, _AmbientDim >::m_min.

Scalar volume ( ) const
inline
Returns:
the volume of the bounding box

References AlignedBox< _Scalar, _AmbientDim >::sizes().


Member Data Documentation

VectorType m_max
protected
VectorType m_min
protected

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