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

An axis aligned box.

Template parameters
_Scalar the type of the scalar coefficients
_AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.

This is defined in the Geometry module. #include <Eigen/Geometry>

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

Public types

enum (anonymous) { AmbientDimAtCompileTime = _AmbientDim }
enum CornerType { Min =0, Max =1, BottomLeft =0, BottomRight =1, TopLeft =2, TopRight =3, BottomLeftFloor =0, BottomRightFloor =1, TopLeftFloor =2, TopRightFloor =3, BottomLeftCeil =4, BottomRightCeil =5, TopLeftCeil =6, TopRightCeil =7 }
using Index = Eigen::Index deprecated
using NonInteger = ScalarTraits::NonInteger
using RealScalar = ScalarTraits::Real
using Scalar = _Scalar
using ScalarTraits = NumTraits<Scalar>
using VectorType = Matrix<Scalar, AmbientDimAtCompileTime, 1>
using VectorTypeSum = CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const VectorType, const VectorType>

Constructors, destructors, conversion operators

AlignedBox()
AlignedBox(Index _dim) explicit
template<typename OtherVectorType1, typename OtherVectorType2>
AlignedBox(const OtherVectorType1& _min, const OtherVectorType2& _max)
template<typename Derived>
AlignedBox(const MatrixBase<Derived>& p) explicit
template<typename OtherScalarType>
AlignedBox(const AlignedBox<OtherScalarType, AmbientDimAtCompileTime>& other) explicit
~AlignedBox()

Public functions

template<typename NewScalarType>
auto cast() const -> internal::cast_return_type<AlignedBox, AlignedBox<NewScalarType, AmbientDimAtCompileTime>>::type
auto clamp(const AlignedBox& b) -> AlignedBox&
template<typename Derived>
auto contains(const MatrixBase<Derived>& p) const -> bool
auto contains(const AlignedBox& b) const -> bool
auto corner(CornerType corner) const -> VectorType
auto diagonal() const -> CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType>
auto dim() const -> Index
auto EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(VectorTypeSum, RealScalar, quotient) const -> const
template<typename Derived>
auto extend(const MatrixBase<Derived>& p) -> AlignedBox&
auto extend(const AlignedBox& b) -> AlignedBox&
template<typename Derived>
auto exteriorDistance(const MatrixBase<Derived>& p) const -> NonInteger
auto exteriorDistance(const AlignedBox& b) const -> NonInteger
auto intersection(const AlignedBox& b) const -> AlignedBox
auto intersects(const AlignedBox& b) const -> bool
auto isApprox(const AlignedBox& other, const RealScalar& prec = ScalarTraits::dummy_precision()) const -> bool
auto isEmpty() const -> bool
auto isNull() const -> bool deprecated
auto max() const -> const VectorType&()
auto max() -> VectorType&()
auto merged(const AlignedBox& b) const -> AlignedBox
auto min() const -> const VectorType&()
auto min() -> VectorType&()
auto sample() const -> VectorType
void setEmpty()
void setNull() deprecated
auto sizes() const -> const CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType>
template<typename Derived>
auto squaredExteriorDistance(const MatrixBase<Derived>& p) const -> Scalar
auto squaredExteriorDistance(const AlignedBox& b) const -> Scalar
template<typename Derived>
auto translate(const MatrixBase<Derived>& a_t) -> AlignedBox&
auto volume() const -> Scalar

Protected variables

VectorType m_max
VectorType m_min

Enum documentation

template<typename _Scalar, int _AmbientDim>
enum Eigen::AlignedBox<_Scalar, _AmbientDim>::(anonymous)

Enumerators
AmbientDimAtCompileTime

template<typename _Scalar, int _AmbientDim>
enum Eigen::AlignedBox<_Scalar, _AmbientDim>::CornerType

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

Enumerators
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

TopRightCeil

Identifier for 3D corner

Typedef documentation

template<typename _Scalar, int _AmbientDim>
typedef Eigen::Index Eigen::AlignedBox<_Scalar, _AmbientDim>::Index

template<typename _Scalar, int _AmbientDim>
typedef ScalarTraits::NonInteger Eigen::AlignedBox<_Scalar, _AmbientDim>::NonInteger

template<typename _Scalar, int _AmbientDim>
typedef ScalarTraits::Real Eigen::AlignedBox<_Scalar, _AmbientDim>::RealScalar

template<typename _Scalar, int _AmbientDim>
typedef _Scalar Eigen::AlignedBox<_Scalar, _AmbientDim>::Scalar

template<typename _Scalar, int _AmbientDim>
typedef NumTraits<Scalar> Eigen::AlignedBox<_Scalar, _AmbientDim>::ScalarTraits

template<typename _Scalar, int _AmbientDim>
typedef Matrix<Scalar, AmbientDimAtCompileTime, 1> Eigen::AlignedBox<_Scalar, _AmbientDim>::VectorType

template<typename _Scalar, int _AmbientDim>
typedef CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const VectorType, const VectorType> Eigen::AlignedBox<_Scalar, _AmbientDim>::VectorTypeSum

Function documentation

template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox<_Scalar, _AmbientDim>::AlignedBox()

Default constructor initializing a null box.

template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox<_Scalar, _AmbientDim>::AlignedBox(Index _dim) explicit

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

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

Constructs a box with extremities _min and _max.

template<typename _Scalar, int _AmbientDim> template<typename Derived>
Eigen::AlignedBox<_Scalar, _AmbientDim>::AlignedBox(const MatrixBase<Derived>& p) explicit

Constructs a box containing a single point p.

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

Copy constructor with scalar type conversion

template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox<_Scalar, _AmbientDim>::~AlignedBox()

template<typename _Scalar, int _AmbientDim> template<typename NewScalarType>
internal::cast_return_type<AlignedBox, AlignedBox<NewScalarType, AmbientDimAtCompileTime>>::type Eigen::AlignedBox<_Scalar, _AmbientDim>::cast() const

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 _AmbientDim>
AlignedBox& Eigen::AlignedBox<_Scalar, _AmbientDim>::clamp(const AlignedBox& b)

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

template<typename _Scalar, int _AmbientDim> template<typename Derived>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::contains(const MatrixBase<Derived>& p) const

Returns true if the point p is inside the box *this.

template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::contains(const AlignedBox& b) const

Returns true if the box b is entirely inside the box *this.

template<typename _Scalar, int _AmbientDim>
VectorType Eigen::AlignedBox<_Scalar, _AmbientDim>::corner(CornerType corner) const

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 _AmbientDim>
CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType> Eigen::AlignedBox<_Scalar, _AmbientDim>::diagonal() const

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 _AmbientDim>
Index Eigen::AlignedBox<_Scalar, _AmbientDim>::dim() const

Returns the dimension in which the box holds

template<typename _Scalar, int _AmbientDim>
const Eigen::AlignedBox<_Scalar, _AmbientDim>::EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(VectorTypeSum, RealScalar, quotient) const

Returns the center of the box

template<typename _Scalar, int _AmbientDim> template<typename Derived>
AlignedBox& Eigen::AlignedBox<_Scalar, _AmbientDim>::extend(const MatrixBase<Derived>& p)

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

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

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

template<typename _Scalar, int _AmbientDim> template<typename Derived>
NonInteger Eigen::AlignedBox<_Scalar, _AmbientDim>::exteriorDistance(const MatrixBase<Derived>& p) const

Returns the distance between the point p and the box *this, and zero if p is inside the box.

template<typename _Scalar, int _AmbientDim>
NonInteger Eigen::AlignedBox<_Scalar, _AmbientDim>::exteriorDistance(const AlignedBox& b) const

Returns the distance between the boxes b and *this, and zero if the boxes intersect.

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

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

template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::intersects(const AlignedBox& b) const

Returns true if the box b is intersecting the box *this.

template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::isApprox(const AlignedBox& other, const RealScalar& prec = ScalarTraits::dummy_precision()) const

Returns true if *this is approximately equal to other, within the precision determined by prec.

template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::isEmpty() const

Returns true if the box is empty.

template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox<_Scalar, _AmbientDim>::isNull() const

template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox<_Scalar, _AmbientDim>::max() const

Returns the maximal corner

template<typename _Scalar, int _AmbientDim>
VectorType&() Eigen::AlignedBox<_Scalar, _AmbientDim>::max()

Returns a non const reference to the maximal corner

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

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

template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox<_Scalar, _AmbientDim>::min() const

Returns the minimal corner

template<typename _Scalar, int _AmbientDim>
VectorType&() Eigen::AlignedBox<_Scalar, _AmbientDim>::min()

Returns a non const reference to the minimal corner

template<typename _Scalar, int _AmbientDim>
VectorType Eigen::AlignedBox<_Scalar, _AmbientDim>::sample() const

Returns a random point inside the bounding box sampled with a uniform distribution

template<typename _Scalar, int _AmbientDim>
void Eigen::AlignedBox<_Scalar, _AmbientDim>::setEmpty()

Makes *this an empty box.

template<typename _Scalar, int _AmbientDim>
void Eigen::AlignedBox<_Scalar, _AmbientDim>::setNull()

template<typename _Scalar, int _AmbientDim>
const CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType> Eigen::AlignedBox<_Scalar, _AmbientDim>::sizes() const

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

Returns the squared distance between the point p and the box *this, and zero if p is inside the box.

template<typename _Scalar, int _AmbientDim>
Scalar Eigen::AlignedBox<_Scalar, _AmbientDim>::squaredExteriorDistance(const AlignedBox& b) const

Returns the squared distance between the boxes b and *this, and zero if the boxes intersect.

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

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

template<typename _Scalar, int _AmbientDim>
Scalar Eigen::AlignedBox<_Scalar, _AmbientDim>::volume() const

Returns the volume of the bounding box

Variable documentation

template<typename _Scalar, int _AmbientDim>
VectorType Eigen::AlignedBox<_Scalar, _AmbientDim>::m_max protected

template<typename _Scalar, int _AmbientDim>
VectorType Eigen::AlignedBox<_Scalar, _AmbientDim>::m_min protected