26 template <
typename _Scalar,
int _AmbientDim>
30 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
Dynamic ?
Dynamic : _AmbientDim+1)
31 enum { AmbientDimAtCompileTime = _AmbientDim };
32 typedef _Scalar Scalar;
41 inline explicit AlignedBox(
int _dim) : m_min(_dim), m_max(_dim)
45 inline AlignedBox(
const VectorType& _min,
const VectorType& _max) : m_min(_min), m_max(_max) {}
48 inline explicit AlignedBox(
const VectorType& p) : m_min(p), m_max(p) {}
53 inline int dim()
const {
return AmbientDimAtCompileTime==
Dynamic ? m_min.size()-1 : AmbientDimAtCompileTime; }
56 inline bool isNull()
const {
return (m_min.cwise() > m_max).any(); }
61 m_min.
setConstant( (std::numeric_limits<Scalar>::max)());
62 m_max.
setConstant(-(std::numeric_limits<Scalar>::max)());
66 inline const VectorType& (
min)()
const {
return m_min; }
68 inline VectorType& (
min)() {
return m_min; }
70 inline const VectorType& (
max)()
const {
return m_max; }
72 inline VectorType& (
max)() {
return m_max; }
75 inline bool contains(
const VectorType& p)
const 76 {
return (m_min.cwise()<=p).all() && (p.cwise()<=m_max).all(); }
80 {
return (m_min.cwise()<=(b.
min)()).all() && ((b.
max)().cwise()<=m_max).all(); }
84 { m_min = (m_min.cwise().min)(p); m_max = (m_max.cwise().max)(p);
return *
this; }
88 { m_min = (m_min.cwise().min)(b.m_min); m_max = (m_max.cwise().max)(b.m_max);
return *
this; }
92 { m_min = (m_min.cwise().max)(b.m_min); m_max = (m_max.cwise().min)(b.m_max);
return *
this; }
96 { m_min += t; m_max += t;
return *
this; }
116 template<
typename NewScalarType>
125 template<
typename OtherScalarType>
128 m_min = (other.
min)().template cast<Scalar>();
129 m_max = (other.
max)().template cast<Scalar>();
137 {
return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); }
141 VectorType m_min, m_max;
144 template<
typename Scalar,
int AmbiantDim>
149 for (
int k=0; k<
dim(); ++k)
151 if ((aux = (p[k]-m_min[k]))<Scalar(0))
153 else if ( (aux = (m_max[k]-p[k]))<Scalar(0))
Definition: XprHelper.h:393
const VectorType &() max() const
Definition: AlignedBox.h:70
AlignedBox & clamp(const AlignedBox &b)
Clamps *this by the box b and returns a reference to *this.
Definition: AlignedBox.h:91
bool isApprox(const AlignedBox &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
Definition: AlignedBox.h:136
AlignedBox(const VectorType &p)
Constructs a box containing a single point p.
Definition: AlignedBox.h:48
Scalar squaredExteriorDistance(const VectorType &p) const
Definition: AlignedBox.h:145
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
const VectorType &() min() const
Definition: AlignedBox.h:66
Definition: AlignedBox.h:27
AlignedBox()
Default constructor initializing a null box.
Definition: AlignedBox.h:37
AlignedBox & extend(const AlignedBox &b)
Extends *this such that it contains the box b and returns a reference to *this.
Definition: AlignedBox.h:87
void setNull()
Makes *this a null/empty box.
Definition: AlignedBox.h:59
bool contains(const VectorType &p) const
Definition: AlignedBox.h:75
int dim() const
Definition: AlignedBox.h:53
bool isNull() const
Definition: AlignedBox.h:56
AlignedBox & translate(const VectorType &t)
Translate *this by the vector t and returns a reference to *this.
Definition: AlignedBox.h:95
bool contains(const AlignedBox &b) const
Definition: AlignedBox.h:79
Derived & setConstant(Index size, const Scalar &value)
Resizes to the given size, and sets all coefficients in this expression to the given value...
Definition: CwiseNullaryOp.h:348
AlignedBox & extend(const VectorType &p)
Extends *this such that it contains the point p and returns a reference to *this. ...
Definition: AlignedBox.h:83
VectorType &() max()
Definition: AlignedBox.h:72
Scalar exteriorDistance(const VectorType &p) const
Definition: AlignedBox.h:108
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast() const
Definition: AlignedBox.h:118
VectorType &() min()
Definition: AlignedBox.h:68
AlignedBox(int _dim)
Constructs a null box with _dim the dimension of the ambient space.
Definition: AlignedBox.h:41
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
AlignedBox(const VectorType &_min, const VectorType &_max)
Constructs a box with extremities _min and _max.
Definition: AlignedBox.h:45
AlignedBox(const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
Copy constructor with scalar type conversion.
Definition: AlignedBox.h:126