Eigen::AlignedBox< Scalar_, AmbientDim_ > Class Template Reference

An axis aligned box. More...

#include <AlignedBox.h>

Public Types

enum  { 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
}
 
typedef Scalar_ Scalar
 
typedef NumTraits< ScalarScalarTraits
 
typedef Eigen::Index Index
 
typedef ScalarTraits::Real RealScalar
 
typedef ScalarTraits::NonInteger NonInteger
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
 
typedef CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorTypeVectorTypeSum
 

Public Member Functions

EIGEN_DEVICE_FUNC AlignedBox ()
 
EIGEN_DEVICE_FUNC AlignedBox (Index _dim)
 
template<typename OtherVectorType1 , typename OtherVectorType2 >
EIGEN_DEVICE_FUNC AlignedBox (const OtherVectorType1 &_min, const OtherVectorType2 &_max)
 
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBox (const MatrixBase< Derived > &p)
 
EIGEN_DEVICE_FUNC ~AlignedBox ()
 
EIGEN_DEVICE_FUNC Index dim () const
 
EIGEN_DEVICE_FUNC bool isNull () const
 
EIGEN_DEVICE_FUNC void setNull ()
 
EIGEN_DEVICE_FUNC bool isEmpty () const
 
EIGEN_DEVICE_FUNC void setEmpty ()
 
EIGEN_DEVICE_FUNC const VectorType &() min () const
 
EIGEN_DEVICE_FUNC VectorType &() min ()
 
EIGEN_DEVICE_FUNC const VectorType &() max () const
 
EIGEN_DEVICE_FUNC VectorType &() max ()
 
EIGEN_DEVICE_FUNC const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE (VectorTypeSum, RealScalar, quotient) center() const
 
EIGEN_DEVICE_FUNC const CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const VectorType, const VectorTypesizes () const
 
EIGEN_DEVICE_FUNC Scalar volume () const
 
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const VectorType, const VectorTypediagonal () const
 
EIGEN_DEVICE_FUNC VectorType corner (CornerType corner) const
 
EIGEN_DEVICE_FUNC VectorType sample () const
 
template<typename Derived >
EIGEN_DEVICE_FUNC bool contains (const MatrixBase< Derived > &p) const
 
EIGEN_DEVICE_FUNC bool contains (const AlignedBox &b) const
 
EIGEN_DEVICE_FUNC bool intersects (const AlignedBox &b) const
 
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBoxextend (const MatrixBase< Derived > &p)
 
EIGEN_DEVICE_FUNC AlignedBoxextend (const AlignedBox &b)
 
EIGEN_DEVICE_FUNC AlignedBoxclamp (const AlignedBox &b)
 
EIGEN_DEVICE_FUNC AlignedBox intersection (const AlignedBox &b) const
 
EIGEN_DEVICE_FUNC AlignedBox merged (const AlignedBox &b) const
 
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBoxtranslate (const MatrixBase< Derived > &a_t)
 
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBox translated (const MatrixBase< Derived > &a_t) const
 
template<typename Derived >
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance (const MatrixBase< Derived > &p) const
 
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance (const AlignedBox &b) const
 
template<typename Derived >
EIGEN_DEVICE_FUNC NonInteger exteriorDistance (const MatrixBase< Derived > &p) const
 
EIGEN_DEVICE_FUNC NonInteger exteriorDistance (const AlignedBox &b) const
 
template<int Mode, int Options>
EIGEN_DEVICE_FUNC void transform (const typename Transform< Scalar, AmbientDimAtCompileTime, Mode, Options >::TranslationType &translation)
 
template<int Mode, int Options>
EIGEN_DEVICE_FUNC void transform (const Transform< Scalar, AmbientDimAtCompileTime, Mode, Options > &transform)
 
template<int Mode, int Options>
EIGEN_DEVICE_FUNC AlignedBox transformed (const Transform< Scalar, AmbientDimAtCompileTime, Mode, Options > &transform) const
 
template<typename NewScalarType >
EIGEN_DEVICE_FUNC internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast () const
 
template<typename OtherScalarType >
EIGEN_DEVICE_FUNC AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
 
EIGEN_DEVICE_FUNC bool isApprox (const AlignedBox &other, const RealScalar &prec=ScalarTraits::dummy_precision()) const
 

Protected Attributes

VectorType m_min
 
VectorType m_max
 

Detailed Description

template<typename Scalar_, int AmbientDim_>
class Eigen::AlignedBox< Scalar_, AmbientDim_ >

An axis aligned box.

\geometry_module

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 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
alignedboxtypedefs

Member Typedef Documentation

◆ Index

template<typename Scalar_ , int AmbientDim_>
typedef Eigen::Index Eigen::AlignedBox< Scalar_, AmbientDim_ >::Index
Deprecated:
since Eigen 3.3

◆ NonInteger

template<typename Scalar_ , int AmbientDim_>
typedef ScalarTraits::NonInteger Eigen::AlignedBox< Scalar_, AmbientDim_ >::NonInteger

◆ RealScalar

template<typename Scalar_ , int AmbientDim_>
typedef ScalarTraits::Real Eigen::AlignedBox< Scalar_, AmbientDim_ >::RealScalar

◆ Scalar

template<typename Scalar_ , int AmbientDim_>
typedef Scalar_ Eigen::AlignedBox< Scalar_, AmbientDim_ >::Scalar

◆ ScalarTraits

template<typename Scalar_ , int AmbientDim_>
typedef NumTraits<Scalar> Eigen::AlignedBox< Scalar_, AmbientDim_ >::ScalarTraits

◆ VectorType

template<typename Scalar_ , int AmbientDim_>
typedef Matrix<Scalar, AmbientDimAtCompileTime, 1> Eigen::AlignedBox< Scalar_, AmbientDim_ >::VectorType

◆ VectorTypeSum

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

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int AmbientDim_>
anonymous enum
Enumerator
AmbientDimAtCompileTime 
72 { AmbientDimAtCompileTime = AmbientDim_ };
@ AmbientDimAtCompileTime
Definition: AlignedBox.h:72

◆ CornerType

template<typename Scalar_ , int AmbientDim_>
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 
BottomLeft 

Identifier for 2D corner

BottomRight 
TopLeft 
TopRight 
BottomLeftFloor 

Identifier for 3D corner

BottomRightFloor 
TopLeftFloor 
TopRightFloor 
BottomLeftCeil 
BottomRightCeil 
TopLeftCeil 
TopRightCeil 
82  {
84  Min = 0,
85  Max = 1,
89  BottomLeft = 0,
90  BottomRight = 1,
91  TopLeft = 2,
92  TopRight = 3,
96  BottomLeftFloor = 0,
97  BottomRightFloor = 1,
98  TopLeftFloor = 2,
99  TopRightFloor = 3,
100  BottomLeftCeil = 4,
101  BottomRightCeil = 5,
102  TopLeftCeil = 6,
103  TopRightCeil = 7
105  };
@ Max
Definition: AlignedBox.h:85
@ TopLeft
Definition: AlignedBox.h:91
@ TopRight
Definition: AlignedBox.h:92
@ TopLeftFloor
Definition: AlignedBox.h:98
@ BottomRight
Definition: AlignedBox.h:90
@ Min
Definition: AlignedBox.h:84
@ TopLeftCeil
Definition: AlignedBox.h:102
@ BottomLeft
Definition: AlignedBox.h:89
@ BottomRightFloor
Definition: AlignedBox.h:97
@ TopRightFloor
Definition: AlignedBox.h:99
@ BottomLeftCeil
Definition: AlignedBox.h:100
@ BottomRightCeil
Definition: AlignedBox.h:101
@ TopRightCeil
Definition: AlignedBox.h:103
@ BottomLeftFloor
Definition: AlignedBox.h:96

Constructor & Destructor Documentation

◆ AlignedBox() [1/5]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox ( )
inline

Default constructor initializing a null box.

108  {
110  }
#define EIGEN_CONST_CONDITIONAL(cond)
Definition: Macros.h:1060
EIGEN_DEVICE_FUNC void setEmpty()
Definition: AlignedBox.h:145
const int Dynamic
Definition: Constants.h:25

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::AmbientDimAtCompileTime, Eigen::Dynamic, EIGEN_CONST_CONDITIONAL, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::setEmpty().

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::intersection(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::merged().

◆ AlignedBox() [2/5]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox ( Index  _dim)
inlineexplicit

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

113 : m_min(_dim), m_max(_dim) { setEmpty(); }
VectorType m_min
Definition: AlignedBox.h:410
VectorType m_max
Definition: AlignedBox.h:410

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::setEmpty().

◆ AlignedBox() [3/5]

template<typename Scalar_ , int AmbientDim_>
template<typename OtherVectorType1 , typename OtherVectorType2 >
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::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.
120  : m_min(_min), m_max(_max) {}

◆ AlignedBox() [4/5]

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox ( const MatrixBase< Derived > &  p)
inlineexplicit

Constructs a box containing a single point p.

124 : m_min(p), m_max(m_min) {}
float * p
Definition: Tutorial_Map_using.cpp:9

◆ ~AlignedBox()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::~AlignedBox ( )
inline
126 {}

◆ AlignedBox() [5/5]

template<typename Scalar_ , int AmbientDim_>
template<typename OtherScalarType >
EIGEN_DEVICE_FUNC Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Copy constructor with scalar type conversion

395  {
396  m_min = (other.min)().template cast<Scalar>();
397  m_max = (other.max)().template cast<Scalar>();
398  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, Eigen::AlignedBox< Scalar_, AmbientDim_ >::max(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::min().

Member Function Documentation

◆ cast()

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

388  {
389  return typename internal::cast_return_type<AlignedBox, AlignedBox<NewScalarType, AmbientDimAtCompileTime> >::type(
390  *this);
391  }
type
Definition: compute_granudrum_aor.py:141

References compute_granudrum_aor::type.

◆ clamp()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC AlignedBox& Eigen::AlignedBox< Scalar_, AmbientDim_ >::clamp ( const AlignedBox< Scalar_, AmbientDim_ > &  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()
265  {
266  m_min = m_min.cwiseMax(b.m_min);
267  m_max = m_max.cwiseMin(b.m_max);
268  return *this;
269  }
Scalar * b
Definition: benchVecAdd.cpp:17

References b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ contains() [1/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::contains ( const AlignedBox< Scalar_, AmbientDim_ > &  b) const
inline
Returns
true if the box b is entirely inside the box *this.
234  {
235  return (m_min.array() <= (b.min)().array()).all() && ((b.max)().array() <= m_max.array()).all();
236  }
static constexpr Eigen::internal::all_t all
Definition: IndexedViewHelper.h:86

References Eigen::placeholders::all, b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ contains() [2/2]

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::contains ( const MatrixBase< Derived > &  p) const
inline
Returns
true if the point p is inside the box *this.
228  {
229  typename internal::nested_eval<Derived, 2>::type p_n(p.derived());
230  return (m_min.array() <= p_n.array()).all() && (p_n.array() <= m_max.array()).all();
231  }
std::conditional_t< Evaluate, PlainObject, typename ref_selector< T >::type > type
Definition: XprHelper.h:549

References Eigen::placeholders::all, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and p.

◆ corner()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC VectorType Eigen::AlignedBox< Scalar_, AmbientDim_ >::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.
197  {
198  EIGEN_STATIC_ASSERT(AmbientDim_ <= 3, THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE);
199 
200  VectorType res;
201 
202  Index mult = 1;
203  for (Index d = 0; d < dim(); ++d) {
204  if (mult & corner)
205  res[d] = m_max[d];
206  else
207  res[d] = m_min[d];
208  mult *= 2;
209  }
210  return res;
211  }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
EIGEN_DEVICE_FUNC Index dim() const
Definition: AlignedBox.h:129
Eigen::Index Index
Definition: AlignedBox.h:75
EIGEN_DEVICE_FUNC VectorType corner(CornerType corner) const
Definition: AlignedBox.h:197
Definition: fft_test_shared.h:66

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::dim(), EIGEN_STATIC_ASSERT, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and res.

◆ diagonal()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType> Eigen::AlignedBox< Scalar_, AmbientDim_ >::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.
184  {
185  return sizes();
186  }
EIGEN_DEVICE_FUNC const CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const VectorType, const VectorType > sizes() const
Definition: AlignedBox.h:171

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::sizes().

◆ dim()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC Index Eigen::AlignedBox< Scalar_, AmbientDim_ >::dim ( ) const
inline

◆ EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC const Eigen::AlignedBox< Scalar_, AmbientDim_ >::EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE ( VectorTypeSum  ,
RealScalar  ,
quotient   
) const
inline
Returns
the center of the box
161  {
162  return (m_min + m_max) / RealScalar(2);
163  }
ScalarTraits::Real RealScalar
Definition: AlignedBox.h:76

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ extend() [1/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC AlignedBox& Eigen::AlignedBox< Scalar_, AmbientDim_ >::extend ( const AlignedBox< Scalar_, AmbientDim_ > &  b)
inline

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

See also
merged, extend(const MatrixBase&)
256  {
257  m_min = m_min.cwiseMin(b.m_min);
258  m_max = m_max.cwiseMax(b.m_max);
259  return *this;
260  }

References b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ extend() [2/2]

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBox& Eigen::AlignedBox< Scalar_, AmbientDim_ >::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&)
247  {
248  typename internal::nested_eval<Derived, 2>::type p_n(p.derived());
249  m_min = m_min.cwiseMin(p_n);
250  m_max = m_max.cwiseMax(p_n);
251  return *this;
252  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and p.

◆ exteriorDistance() [1/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC NonInteger Eigen::AlignedBox< Scalar_, AmbientDim_ >::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(const AlignedBox&), exteriorDistance(const MatrixBase&)
328  {
330  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
#define EIGEN_USING_STD(FUNC)
Definition: Macros.h:1090
ScalarTraits::NonInteger NonInteger
Definition: AlignedBox.h:77
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance(const MatrixBase< Derived > &p) const
Definition: AlignedBox.h:415

References b, EIGEN_USING_STD, sqrt(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::squaredExteriorDistance().

◆ exteriorDistance() [2/2]

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC NonInteger Eigen::AlignedBox< Scalar_, AmbientDim_ >::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&)
320  {
322  }

References EIGEN_USING_STD, p, sqrt(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::squaredExteriorDistance().

◆ intersection()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC AlignedBox Eigen::AlignedBox< Scalar_, AmbientDim_ >::intersection ( const AlignedBox< Scalar_, AmbientDim_ > &  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()
274  {
275  return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max));
276  }
EIGEN_DEVICE_FUNC AlignedBox()
Definition: AlignedBox.h:108

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox(), b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

Referenced by BallPointStuff< Dim >::intersectVolumeVolume().

◆ intersects()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::intersects ( const AlignedBox< Scalar_, AmbientDim_ > &  b) const
inline
Returns
true if the box b is intersecting the box *this.
See also
intersection, clamp
240  {
241  return (m_min.array() <= (b.max)().array()).all() && ((b.min)().array() <= m_max.array()).all();
242  }

References Eigen::placeholders::all, b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ isApprox()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::isApprox ( const AlignedBox< Scalar_, AmbientDim_ > &  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()
405  {
406  return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec);
407  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ isEmpty()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::isEmpty ( ) const
inline

◆ isNull()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC bool Eigen::AlignedBox< Scalar_, AmbientDim_ >::isNull ( ) const
inline
Deprecated:
use isEmpty()
134 { return isEmpty(); }
EIGEN_DEVICE_FUNC bool isEmpty() const
Definition: AlignedBox.h:141

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::isEmpty().

◆ max() [1/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC VectorType&() Eigen::AlignedBox< Scalar_, AmbientDim_ >::max ( )
inline
Returns
a non const reference to the maximal corner
157 { return m_max; }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max.

◆ max() [2/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC const VectorType&() Eigen::AlignedBox< Scalar_, AmbientDim_ >::max ( ) const
inline
Returns
the maximal corner
155 { return m_max; }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max.

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox().

◆ merged()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC AlignedBox Eigen::AlignedBox< Scalar_, AmbientDim_ >::merged ( const AlignedBox< Scalar_, AmbientDim_ > &  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&)
281  {
282  return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max));
283  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox(), b, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ min() [1/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC VectorType&() Eigen::AlignedBox< Scalar_, AmbientDim_ >::min ( )
inline
Returns
a non const reference to the minimal corner
153 { return m_min; }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

◆ min() [2/2]

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC const VectorType&() Eigen::AlignedBox< Scalar_, AmbientDim_ >::min ( ) const
inline
Returns
the minimal corner
151 { return m_min; }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox().

◆ sample()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC VectorType Eigen::AlignedBox< Scalar_, AmbientDim_ >::sample ( ) const
inline
Returns
a random point inside the bounding box sampled with a uniform distribution
215  {
216  VectorType r(dim());
217  for (Index d = 0; d < dim(); ++d) {
219  r[d] = m_min[d] + (m_max[d] - m_min[d]) * internal::random<Scalar>(Scalar(0), Scalar(1));
220  } else
221  r[d] = internal::random(m_min[d], m_max[d]);
222  }
223  return r;
224  }
Scalar_ Scalar
Definition: AlignedBox.h:73
r
Definition: UniformPSDSelfTest.py:20
@ IsInteger
Definition: NumTraits.h:174

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::dim(), Eigen::GenericNumTraits< T >::IsInteger, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and UniformPSDSelfTest::r.

◆ setEmpty()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC void Eigen::AlignedBox< Scalar_, AmbientDim_ >::setEmpty ( )
inline

Makes *this an empty box.

See also
isEmpty
145  {
146  m_min.setConstant(ScalarTraits::highest());
147  m_max.setConstant(ScalarTraits::lowest());
148  }
EIGEN_DEVICE_FUNC Derived & setConstant(Index size, const Scalar &val)
Definition: CwiseNullaryOp.h:365

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and Eigen::PlainObjectBase< Derived >::setConstant().

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::AlignedBox(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::setNull().

◆ setNull()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC void Eigen::AlignedBox< Scalar_, AmbientDim_ >::setNull ( )
inline

◆ sizes()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC const CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const VectorType, const VectorType> Eigen::AlignedBox< Scalar_, AmbientDim_ >::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
171  {
172  return m_max - m_min;
173  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min.

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::diagonal(), Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::volume().

◆ squaredExteriorDistance() [1/2]

template<typename Scalar , int AmbientDim>
EIGEN_DEVICE_FUNC Scalar Eigen::AlignedBox< Scalar, AmbientDim >::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(const AlignedBox&), squaredExteriorDistance(const MatrixBase&)
433  {
434  Scalar dist2(0);
435  Scalar aux;
436  for (Index k = 0; k < dim(); ++k) {
437  if (m_min[k] > b.m_max[k]) {
438  aux = m_min[k] - b.m_max[k];
439  dist2 += aux * aux;
440  } else if (b.m_min[k] > m_max[k]) {
441  aux = b.m_min[k] - m_max[k];
442  dist2 += aux * aux;
443  }
444  }
445  return dist2;
446 }
SCALAR Scalar
Definition: bench_gemm.cpp:45
char char char int int * k
Definition: level2_impl.h:374

References b, and k.

◆ squaredExteriorDistance() [2/2]

template<typename Scalar , int AmbientDim>
template<typename Derived >
EIGEN_DEVICE_FUNC 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&)
416  {
418  Scalar dist2(0);
419  Scalar aux;
420  for (Index k = 0; k < dim(); ++k) {
421  if (m_min[k] > p[k]) {
422  aux = m_min[k] - p[k];
423  dist2 += aux * aux;
424  } else if (p[k] > m_max[k]) {
425  aux = p[k] - m_max[k];
426  dist2 += aux * aux;
427  }
428  }
429  return dist2;
430 }

References k, and p.

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::exteriorDistance(), PointPointMinimizer::minimumOnVolumeVolume(), and BallPointStuff< Dim >::minimumOnVolumeVolume().

◆ transform() [1/2]

template<typename Scalar_ , int AmbientDim_>
template<int Mode, int Options>
EIGEN_DEVICE_FUNC void Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform ( const Transform< Scalar, AmbientDimAtCompileTime, Mode, Options > &  transform)
inline

Transforms this box by transform and recomputes it to still be an axis-aligned box.

Note
This method is provided under BSD license (see the top of this file).
348  {
349  // Only Affine and Isometry transforms are currently supported.
350  EIGEN_STATIC_ASSERT(Mode == Affine || Mode == AffineCompact || Mode == Isometry,
351  THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS);
352 
353  // Method adapted from FCL src/shape/geometric_shapes_utility.cpp#computeBV<AABB, Box>(...)
354  // https://github.com/flexible-collision-library/fcl/blob/fcl-0.4/src/shape/geometric_shapes_utility.cpp#L292
355  //
356  // Here's a nice explanation why it works: https://zeuxcg.org/2010/10/17/aabb-from-obb-with-component-wise-abs/
357 
358  // two times rotated extent
359  const VectorType rotated_extent_2 = transform.linear().cwiseAbs() * sizes();
360  // two times new center
361  const VectorType rotated_center_2 =
362  transform.linear() * (this->m_max + this->m_min) + Scalar(2) * transform.translation();
363 
364  this->m_max = (rotated_center_2 + rotated_extent_2) / Scalar(2);
365  this->m_min = (rotated_center_2 - rotated_extent_2) / Scalar(2);
366  }
EIGEN_DEVICE_FUNC void transform(const typename Transform< Scalar, AmbientDimAtCompileTime, Mode, Options >::TranslationType &translation)
Definition: AlignedBox.h:336
@ Affine
Definition: Constants.h:458
@ AffineCompact
Definition: Constants.h:460
@ Isometry
Definition: Constants.h:455

References Eigen::Affine, Eigen::AffineCompact, EIGEN_STATIC_ASSERT, Eigen::Isometry, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, Eigen::AlignedBox< Scalar_, AmbientDim_ >::sizes(), Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform(), and Eigen::Transform< Scalar_, Dim_, Mode_, Options_ >::translation().

◆ transform() [2/2]

template<typename Scalar_ , int AmbientDim_>
template<int Mode, int Options>
EIGEN_DEVICE_FUNC void Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform ( const typename Transform< Scalar, AmbientDimAtCompileTime, Mode, Options >::TranslationType &  translation)
inline

Specialization of transform for pure translation.

337  {
338  this->translate(translation);
339  }
EIGEN_DEVICE_FUNC AlignedBox & translate(const MatrixBase< Derived > &a_t)
Definition: AlignedBox.h:287

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::translate().

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::transformed().

◆ transformed()

template<typename Scalar_ , int AmbientDim_>
template<int Mode, int Options>
EIGEN_DEVICE_FUNC AlignedBox Eigen::AlignedBox< Scalar_, AmbientDim_ >::transformed ( const Transform< Scalar, AmbientDimAtCompileTime, Mode, Options > &  transform) const
inline
Returns
a copy of *this transformed by transform and recomputed to still be an axis-aligned box.
374  {
375  AlignedBox result(m_min, m_max);
376  result.transform(transform);
377  return result;
378  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform().

◆ translate()

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBox& Eigen::AlignedBox< Scalar_, AmbientDim_ >::translate ( const MatrixBase< Derived > &  a_t)
inline

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

287  {
288  const typename internal::nested_eval<Derived, 2>::type t(a_t.derived());
289  m_min += t;
290  m_max += t;
291  return *this;
292  }
t
Definition: plotPSD.py:36

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and plotPSD::t.

Referenced by Eigen::AlignedBox< Scalar_, AmbientDim_ >::transform(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::translated().

◆ translated()

template<typename Scalar_ , int AmbientDim_>
template<typename Derived >
EIGEN_DEVICE_FUNC AlignedBox Eigen::AlignedBox< Scalar_, AmbientDim_ >::translated ( const MatrixBase< Derived > &  a_t) const
inline
Returns
a copy of *this translated by the vector t.
296  {
297  AlignedBox result(m_min, m_max);
298  result.translate(a_t);
299  return result;
300  }

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_max, Eigen::AlignedBox< Scalar_, AmbientDim_ >::m_min, and Eigen::AlignedBox< Scalar_, AmbientDim_ >::translate().

◆ volume()

template<typename Scalar_ , int AmbientDim_>
EIGEN_DEVICE_FUNC Scalar Eigen::AlignedBox< Scalar_, AmbientDim_ >::volume ( ) const
inline
Returns
the volume of the bounding box
176 { return isEmpty() ? Scalar(0) : sizes().prod(); }
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
Definition: evaluators.cpp:7

References Eigen::AlignedBox< Scalar_, AmbientDim_ >::isEmpty(), and Eigen::AlignedBox< Scalar_, AmbientDim_ >::sizes().

Member Data Documentation

◆ m_max

◆ m_min


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