Eigen  3.3.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Eigen::AlignedBox< Scalar, Dim > Class Template Reference

Detailed Description

template<typename Scalar, int Dim>
class Eigen::AlignedBox< Scalar, Dim >

An axis aligned box.

This is defined in the Geometry module.

#include <Eigen/Geometry>
Template 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.

Warning
The result of most methods is undefined when applied to an empty box. You can check for empty boxes using isEmpty().
See Also
Global aligned box typedefs

Public Types

enum  CornerType {
  Min,
  Max,
  BottomLeft,
  BottomRight,
  TopLeft,
  TopRight,
  BottomLeftFloor,
  BottomRightFloor,
  TopLeftFloor,
  TopRightFloor,
  BottomLeftCeil,
  BottomRightCeil,
  TopLeftCeil
}
 
typedef Eigen::Index Index
 

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 > &p)
 
template<typename OtherScalarType >
 AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
 
template<typename NewScalarType >
internal::cast_return_type
< AlignedBox, AlignedBox
< NewScalarType,
AmbientDimAtCompileTime >
>::type 
cast () const
 
AlignedBoxclamp (const AlignedBox &b)
 
template<typename Derived >
bool contains (const MatrixBase< Derived > &p) const
 
bool contains (const AlignedBox &b) const
 
VectorType corner (CornerType corner) const
 
CwiseBinaryOp
< internal::scalar_difference_op
< Scalar, Scalar >, const
VectorType, const VectorType
diagonal () const
 
Index dim () const
 
const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE (VectorTypeSum, RealScalar, quotient) center() const
 
template<typename Derived >
AlignedBoxextend (const MatrixBase< Derived > &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 intersects (const AlignedBox &b) const
 
bool isApprox (const AlignedBox &other, const 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, Scalar >, const
VectorType, const VectorType
sizes () const
 
template<typename Derived >
Scalar squaredExteriorDistance (const MatrixBase< Derived > &p) const
 
Scalar squaredExteriorDistance (const AlignedBox &b) const
 
template<typename Derived >
AlignedBoxtranslate (const MatrixBase< Derived > &a_t)
 
Scalar volume () const
 

Member Typedef Documentation

template<typename Scalar , int Dim>
typedef Eigen::Index Eigen::AlignedBox< Scalar, Dim >::Index
Deprecated:
since Eigen 3.3

Member Enumeration Documentation

template<typename Scalar , int Dim>
enum Eigen::AlignedBox::CornerType

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

Enumerator
Min 

1D names

Max 

1D names

BottomLeft 

Identifier for 2D corner

BottomRight 

Identifier for 2D corner

TopLeft 

Identifier for 2D corner

TopRight 

Identifier for 2D corner

BottomLeftFloor 

Identifier for 3D corner

BottomRightFloor 

Identifier for 3D corner

TopLeftFloor 

Identifier for 3D corner

TopRightFloor 

Identifier for 3D corner

BottomLeftCeil 

Identifier for 3D corner

BottomRightCeil 

Identifier for 3D corner

TopLeftCeil 

Identifier for 3D corner

Constructor & Destructor Documentation

template<typename Scalar , int Dim>
Eigen::AlignedBox< Scalar, Dim >::AlignedBox ( )
inline

Default constructor initializing a null box.

template<typename Scalar , int Dim>
Eigen::AlignedBox< Scalar, Dim >::AlignedBox ( Index  _dim)
inlineexplicit

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

template<typename Scalar , int Dim>
template<typename OtherVectorType1 , typename OtherVectorType2 >
Eigen::AlignedBox< Scalar, Dim >::AlignedBox ( const OtherVectorType1 &  _min,
const OtherVectorType2 &  _max 
)
inline

Constructs a box with extremities _min and _max.

Warning
If either component of _min is larger than the same component of _max, the constructed box is empty.
template<typename Scalar , int Dim>
template<typename Derived >
Eigen::AlignedBox< Scalar, Dim >::AlignedBox ( const MatrixBase< Derived > &  p)
inlineexplicit

Constructs a box containing a single point p.

template<typename Scalar , int Dim>
template<typename OtherScalarType >
Eigen::AlignedBox< Scalar, Dim >::AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Member Function Documentation

template<typename Scalar , int Dim>
template<typename NewScalarType >
internal::cast_return_type<AlignedBox, AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type Eigen::AlignedBox< Scalar, Dim >::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.

template<typename Scalar , int Dim>
AlignedBox& Eigen::AlignedBox< Scalar, Dim >::clamp ( const AlignedBox< Scalar, Dim > &  b)
inline

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

Note
If the boxes don't intersect, the resulting box is empty.
See Also
intersection(), intersects()
template<typename Scalar , int Dim>
template<typename Derived >
bool Eigen::AlignedBox< Scalar, Dim >::contains ( const MatrixBase< Derived > &  p) const
inline
Returns
true if the point p is inside the box *this.
template<typename Scalar , int Dim>
bool Eigen::AlignedBox< Scalar, Dim >::contains ( const AlignedBox< Scalar, Dim > &  b) const
inline
Returns
true if the box b is entirely inside the box *this.
template<typename Scalar , int Dim>
VectorType Eigen::AlignedBox< Scalar, Dim >::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.
template<typename Scalar , int Dim>
CwiseBinaryOp< internal::scalar_difference_op<Scalar,Scalar>, const VectorType, const VectorType> Eigen::AlignedBox< Scalar, Dim >::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.
template<typename Scalar , int Dim>
Index Eigen::AlignedBox< Scalar, Dim >::dim ( ) const
inline
Returns
the dimension in which the box holds
template<typename Scalar , int Dim>
const Eigen::AlignedBox< Scalar, Dim >::EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE ( VectorTypeSum  ,
RealScalar  ,
quotient   
) const
inline
Returns
the center of the box
template<typename Scalar , int Dim>
template<typename Derived >
AlignedBox& Eigen::AlignedBox< Scalar, Dim >::extend ( const MatrixBase< Derived > &  p)
inline

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

See Also
extend(const AlignedBox&)
template<typename Scalar , int Dim>
AlignedBox& Eigen::AlignedBox< Scalar, Dim >::extend ( const AlignedBox< Scalar, Dim > &  b)
inline

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

See Also
merged, extend(const MatrixBase&)
template<typename Scalar , int Dim>
template<typename Derived >
NonInteger Eigen::AlignedBox< Scalar, Dim >::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(const MatrixBase&), exteriorDistance(const AlignedBox&)
template<typename Scalar , int Dim>
NonInteger Eigen::AlignedBox< Scalar, Dim >::exteriorDistance ( const AlignedBox< Scalar, Dim > &  b) const
inline
Returns
the distance between the boxes b and *this, and zero if the boxes intersect.
See Also
squaredExteriorDistance(const AlignedBox&), exteriorDistance(const MatrixBase&)
template<typename Scalar , int Dim>
AlignedBox Eigen::AlignedBox< Scalar, Dim >::intersection ( const AlignedBox< Scalar, Dim > &  b) const
inline

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

Note
If the boxes don't intersect, the resulting box is empty.
See Also
intersects(), clamp, contains()
template<typename Scalar , int Dim>
bool Eigen::AlignedBox< Scalar, Dim >::intersects ( const AlignedBox< Scalar, Dim > &  b) const
inline
Returns
true if the box b is intersecting the box *this.
See Also
intersection, clamp
template<typename Scalar , int Dim>
bool Eigen::AlignedBox< Scalar, Dim >::isApprox ( const AlignedBox< Scalar, Dim > &  other,
const 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()
template<typename Scalar , int Dim>
bool Eigen::AlignedBox< Scalar, Dim >::isEmpty ( ) const
inline
Returns
true if the box is empty.
See Also
setEmpty
template<typename Scalar , int Dim>
bool Eigen::AlignedBox< Scalar, Dim >::isNull ( ) const
inline
template<typename Scalar , int Dim>
const VectorType&() Eigen::AlignedBox< Scalar, Dim >::max ( ) const
inline
Returns
the maximal corner
template<typename Scalar , int Dim>
VectorType&() Eigen::AlignedBox< Scalar, Dim >::max ( )
inline
Returns
a non const reference to the maximal corner
template<typename Scalar , int Dim>
AlignedBox Eigen::AlignedBox< Scalar, Dim >::merged ( const AlignedBox< Scalar, Dim > &  b) const
inline

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

Note
Merging with an empty box may result in a box bigger than *this.
See Also
extend(const AlignedBox&)
template<typename Scalar , int Dim>
const VectorType&() Eigen::AlignedBox< Scalar, Dim >::min ( ) const
inline
Returns
the minimal corner
template<typename Scalar , int Dim>
VectorType&() Eigen::AlignedBox< Scalar, Dim >::min ( )
inline
Returns
a non const reference to the minimal corner
template<typename Scalar , int Dim>
VectorType Eigen::AlignedBox< Scalar, Dim >::sample ( ) const
inline
Returns
a random point inside the bounding box sampled with a uniform distribution
template<typename Scalar , int Dim>
void Eigen::AlignedBox< Scalar, Dim >::setEmpty ( )
inline

Makes *this an empty box.

See Also
isEmpty
template<typename Scalar , int Dim>
void Eigen::AlignedBox< Scalar, Dim >::setNull ( )
inline
template<typename Scalar , int Dim>
const CwiseBinaryOp< internal::scalar_difference_op<Scalar,Scalar>, const VectorType, const VectorType> Eigen::AlignedBox< Scalar, Dim >::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
template<typename Scalar , int AmbientDim>
template<typename Derived >
Scalar Eigen::AlignedBox< Scalar, AmbientDim >::squaredExteriorDistance ( const MatrixBase< Derived > &  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(const MatrixBase&), squaredExteriorDistance(const AlignedBox&)
template<typename Scalar , int AmbientDim>
Scalar Eigen::AlignedBox< Scalar, AmbientDim >::squaredExteriorDistance ( const AlignedBox< Scalar, Dim > &  b) const
inline
Returns
the squared distance between the boxes b and *this, and zero if the boxes intersect.
See Also
exteriorDistance(const AlignedBox&), squaredExteriorDistance(const MatrixBase&)
template<typename Scalar , int Dim>
template<typename Derived >
AlignedBox& Eigen::AlignedBox< Scalar, Dim >::translate ( const MatrixBase< Derived > &  a_t)
inline

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

template<typename Scalar , int Dim>
Scalar Eigen::AlignedBox< Scalar, Dim >::volume ( ) const
inline
Returns
the volume of the bounding box

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