Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Protected Attributes
Eigen::AlignedBox< _Scalar, _AmbientDim > Class Template Reference

An axis aligned box. More...

#include <AlignedBox.h>

+ Collaboration diagram for Eigen::AlignedBox< _Scalar, _AmbientDim >:

Public Types

enum  { AmbientDimAtCompileTime = _AmbientDim }
 
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< Scalar >::Real RealScalar
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
 
typedef _Scalar Scalar
 
typedef NumTraits< Scalar > ScalarTraits
 
typedef DenseIndex Index
 
typedef ScalarTraits::Real RealScalar
 
typedef ScalarTraits::NonInteger NonInteger
 
typedef Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
 

Public Member Functions

 AlignedBox ()
 
 AlignedBox (int _dim)
 
 AlignedBox (const VectorType &_min, const VectorType &_max)
 
 AlignedBox (const VectorType &p)
 
int dim () const
 
bool isNull () const
 
void setNull ()
 
const VectorType &() min () const
 
VectorType &() min ()
 
const VectorType &() max () const
 
VectorType &() max ()
 
bool contains (const VectorType &p) const
 
bool contains (const AlignedBox &b) const
 
AlignedBoxextend (const VectorType &p)
 
AlignedBoxextend (const AlignedBox &b)
 
AlignedBoxclamp (const AlignedBox &b)
 
AlignedBoxtranslate (const VectorType &t)
 
Scalar squaredExteriorDistance (const VectorType &p) const
 
Scalar exteriorDistance (const VectorType &p) const
 
template<typename NewScalarType >
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast () const
 
template<typename OtherScalarType >
 AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
 
bool isApprox (const AlignedBox &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
 
 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)
 
Index dim () const
 
bool isNull () const
 
void setNull ()
 
bool isEmpty () const
 
void setEmpty ()
 
const VectorType &() min () const
 
VectorType &() min ()
 
const VectorType &() max () const
 
VectorType &() max ()
 
const CwiseUnaryOp< internal::scalar_quotient1_op< Scalar >, const CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorType > > center () const
 
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorTypesizes () const
 
Scalar volume () const
 
CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorTypediagonal () const
 
VectorType corner (CornerType corner) const
 
VectorType sample () const
 
template<typename Derived >
bool contains (const MatrixBase< Derived > &a_p) const
 
bool contains (const AlignedBox &b) const
 
template<typename Derived >
AlignedBoxextend (const MatrixBase< Derived > &a_p)
 
AlignedBoxextend (const AlignedBox &b)
 
AlignedBoxclamp (const AlignedBox &b)
 
AlignedBox intersection (const AlignedBox &b) const
 
AlignedBox merged (const AlignedBox &b) const
 
template<typename Derived >
AlignedBoxtranslate (const MatrixBase< Derived > &a_t)
 
template<typename Derived >
Scalar squaredExteriorDistance (const MatrixBase< Derived > &a_p) const
 
Scalar squaredExteriorDistance (const AlignedBox &b) const
 
template<typename Derived >
NonInteger exteriorDistance (const MatrixBase< Derived > &p) const
 
NonInteger exteriorDistance (const AlignedBox &b) const
 
template<typename NewScalarType >
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast () const
 
template<typename OtherScalarType >
 AlignedBox (const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
 
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.

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.

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.

Definition at line 27 of file AlignedBox.h.

Member Enumeration Documentation

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

BottomLeft 

Added names for 2D

BottomLeftFloor 

Added names for 3D

Definition at line 41 of file AlignedBox.h.

42  {
44  Min=0, Max=1,
45 
47  BottomLeft=0, BottomRight=1,
48  TopLeft=2, TopRight=3,
49 
51  BottomLeftFloor=0, BottomRightFloor=1,
52  TopLeftFloor=2, TopRightFloor=3,
53  BottomLeftCeil=4, BottomRightCeil=5,
54  TopLeftCeil=6, TopRightCeil=7
55  };

Constructor & Destructor Documentation

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

Default constructor initializing a null box.

Definition at line 37 of file AlignedBox.h.

38  { if (AmbientDimAtCompileTime!=Dynamic) setNull(); }
template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( int  _dim)
inlineexplicit

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

Definition at line 41 of file AlignedBox.h.

41  : m_min(_dim), m_max(_dim)
42  { setNull(); }
template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const VectorType _min,
const VectorType _max 
)
inline

Constructs a box with extremities _min and _max.

Definition at line 45 of file AlignedBox.h.

45 : m_min(_min), m_max(_max) {}
template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const VectorType p)
inlineexplicit

Constructs a box containing a single point p.

Definition at line 48 of file AlignedBox.h.

48 : m_min(p), m_max(p) {}
template<typename _Scalar, int _AmbientDim>
template<typename OtherScalarType >
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 126 of file AlignedBox.h.

127  {
128  m_min = (other.min)().template cast<Scalar>();
129  m_max = (other.max)().template cast<Scalar>();
130  }
template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( )
inline

Default constructor initializing a null box.

Definition at line 59 of file AlignedBox.h.

60  { if (AmbientDimAtCompileTime!=Dynamic) setEmpty(); }
template<typename _Scalar, int _AmbientDim>
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( Index  _dim)
inlineexplicit

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

Definition at line 63 of file AlignedBox.h.

63  : m_min(_dim), m_max(_dim)
64  { setEmpty(); }
template<typename _Scalar, int _AmbientDim>
template<typename OtherVectorType1 , typename OtherVectorType2 >
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const OtherVectorType1 &  _min,
const OtherVectorType2 &  _max 
)
inline

Constructs a box with extremities _min and _max.

Definition at line 68 of file AlignedBox.h.

68 : m_min(_min), m_max(_max) {}
template<typename _Scalar, int _AmbientDim>
template<typename Derived >
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const MatrixBase< Derived > &  a_p)
inlineexplicit

Constructs a box containing a single point p.

Definition at line 72 of file AlignedBox.h.

73  {
74  typename internal::nested<Derived,2>::type p(a_p.derived());
75  m_min = p;
76  m_max = p;
77  }
template<typename _Scalar, int _AmbientDim>
template<typename OtherScalarType >
Eigen::AlignedBox< _Scalar, _AmbientDim >::AlignedBox ( const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 275 of file AlignedBox.h.

276  {
277  m_min = (other.min)().template cast<Scalar>();
278  m_max = (other.max)().template cast<Scalar>();
279  }

Member Function Documentation

template<typename _Scalar, int _AmbientDim>
template<typename NewScalarType >
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.

Definition at line 118 of file AlignedBox.h.

119  {
120  return typename internal::cast_return_type<AlignedBox,
121  AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
122  }
template<typename _Scalar, int _AmbientDim>
template<typename NewScalarType >
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.

Definition at line 267 of file AlignedBox.h.

268  {
269  return typename internal::cast_return_type<AlignedBox,
270  AlignedBox<NewScalarType,AmbientDimAtCompileTime> >::type(*this);
271  }
template<typename _Scalar, int _AmbientDim>
const CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const VectorType, const VectorType> > Eigen::AlignedBox< _Scalar, _AmbientDim >::center ( ) const
inline
Returns
the center of the box

Definition at line 112 of file AlignedBox.h.

113  { return (m_min+m_max)/2; }
template<typename _Scalar, int _AmbientDim>
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::clamp ( const AlignedBox< _Scalar, _AmbientDim > &  b)
inline

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

Definition at line 91 of file AlignedBox.h.

92  { m_min = (m_min.cwise().max)(b.m_min); m_max = (m_max.cwise().min)(b.m_max); return *this; }
template<typename _Scalar, int _AmbientDim>
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::clamp ( const AlignedBox< _Scalar, _AmbientDim > &  b)
inline

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

Definition at line 207 of file AlignedBox.h.

208  {
209  m_min = m_min.cwiseMax(b.m_min);
210  m_max = m_max.cwiseMin(b.m_max);
211  return *this;
212  }
template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::contains ( const VectorType p) const
inline
Returns
true if the point p is inside the box *this.

Definition at line 75 of file AlignedBox.h.

76  { return (m_min.cwise()<=p).all() && (p.cwise()<=m_max).all(); }
template<typename _Scalar, int _AmbientDim>
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.

Definition at line 79 of file AlignedBox.h.

80  { return (m_min.cwise()<=(b.min)()).all() && ((b.max)().cwise()<=m_max).all(); }
template<typename _Scalar, int _AmbientDim>
template<typename Derived >
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::contains ( const MatrixBase< Derived > &  a_p) const
inline
Returns
true if the point p is inside the box *this.

Definition at line 178 of file AlignedBox.h.

179  {
180  typename internal::nested<Derived,2>::type p(a_p.derived());
181  return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all();
182  }
template<typename _Scalar, int _AmbientDim>
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.

Definition at line 185 of file AlignedBox.h.

186  { return (m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=m_max.array()).all(); }
template<typename _Scalar, int _AmbientDim>
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.

Definition at line 142 of file AlignedBox.h.

143  {
144  EIGEN_STATIC_ASSERT(_AmbientDim <= 3, THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE);
145 
146  VectorType res;
147 
148  Index mult = 1;
149  for(Index d=0; d<dim(); ++d)
150  {
151  if( mult & corner ) res[d] = m_max[d];
152  else res[d] = m_min[d];
153  mult *= 2;
154  }
155  return res;
156  }
VectorType corner(CornerType corner) const
Definition: AlignedBox.h:142
int dim() const
Definition: AlignedBox.h:53
template<typename _Scalar, int _AmbientDim>
CwiseBinaryOp< internal::scalar_difference_op<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.

Definition at line 130 of file AlignedBox.h.

131  { return sizes(); }
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > sizes() const
Definition: AlignedBox.h:119
template<typename _Scalar, int _AmbientDim>
int Eigen::AlignedBox< _Scalar, _AmbientDim >::dim ( ) const
inline
Returns
the dimension in which the box holds

Definition at line 53 of file AlignedBox.h.

53 { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : AmbientDimAtCompileTime; }
template<typename _Scalar, int _AmbientDim>
Index Eigen::AlignedBox< _Scalar, _AmbientDim >::dim ( ) const
inline
Returns
the dimension in which the box holds

Definition at line 82 of file AlignedBox.h.

82 { return AmbientDimAtCompileTime==Dynamic ? m_min.size() : Index(AmbientDimAtCompileTime); }
template<typename _Scalar, int _AmbientDim>
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::extend ( const VectorType p)
inline

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

Definition at line 83 of file AlignedBox.h.

84  { m_min = (m_min.cwise().min)(p); m_max = (m_max.cwise().max)(p); return *this; }
template<typename _Scalar, int _AmbientDim>
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.

Definition at line 87 of file AlignedBox.h.

88  { m_min = (m_min.cwise().min)(b.m_min); m_max = (m_max.cwise().max)(b.m_max); return *this; }
template<typename _Scalar, int _AmbientDim>
template<typename Derived >
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::extend ( const MatrixBase< Derived > &  a_p)
inline

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

Definition at line 190 of file AlignedBox.h.

191  {
192  typename internal::nested<Derived,2>::type p(a_p.derived());
193  m_min = m_min.cwiseMin(p);
194  m_max = m_max.cwiseMax(p);
195  return *this;
196  }
template<typename _Scalar, int _AmbientDim>
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.

Definition at line 199 of file AlignedBox.h.

200  {
201  m_min = m_min.cwiseMin(b.m_min);
202  m_max = m_max.cwiseMax(b.m_max);
203  return *this;
204  }
template<typename _Scalar, int _AmbientDim>
Scalar Eigen::AlignedBox< _Scalar, _AmbientDim >::exteriorDistance ( const VectorType 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()

Definition at line 108 of file AlignedBox.h.

109  { return ei_sqrt(squaredExteriorDistance(p)); }
Scalar squaredExteriorDistance(const VectorType &p) const
Definition: AlignedBox.h:145
template<typename _Scalar, int _AmbientDim>
template<typename Derived >
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()

Definition at line 250 of file AlignedBox.h.

251  { using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(p))); }
Scalar squaredExteriorDistance(const VectorType &p) const
Definition: AlignedBox.h:145
template<typename _Scalar, int _AmbientDim>
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()

Definition at line 257 of file AlignedBox.h.

258  { using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(b))); }
Scalar squaredExteriorDistance(const VectorType &p) const
Definition: AlignedBox.h:145
template<typename _Scalar, int _AmbientDim>
AlignedBox Eigen::AlignedBox< _Scalar, _AmbientDim >::intersection ( const AlignedBox< _Scalar, _AmbientDim > &  b) const
inline

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

Definition at line 215 of file AlignedBox.h.

216  {return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); }
template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::isApprox ( const AlignedBox< _Scalar, _AmbientDim > &  other,
typename NumTraits< Scalar >::Real  prec = precision<Scalar>() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 136 of file AlignedBox.h.

137  { return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); }
template<typename _Scalar, int _AmbientDim>
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()

Definition at line 285 of file AlignedBox.h.

286  { return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); }
template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::isEmpty ( ) const
inline
Returns
true if the box is empty.

Definition at line 91 of file AlignedBox.h.

91 { return (m_min.array() > m_max.array()).any(); }
template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::isNull ( ) const
inline
Returns
true if the box is null, i.e, empty.

Definition at line 56 of file AlignedBox.h.

56 { return (m_min.cwise() > m_max).any(); }
template<typename _Scalar, int _AmbientDim>
bool Eigen::AlignedBox< _Scalar, _AmbientDim >::isNull ( ) const
inline
Deprecated:
use isEmpty

Definition at line 85 of file AlignedBox.h.

85 { return isEmpty(); }
bool isEmpty() const
Definition: AlignedBox.h:91
template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox< _Scalar, _AmbientDim >::max ( ) const
inline
Returns
the maximal corner

Definition at line 70 of file AlignedBox.h.

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

Definition at line 72 of file AlignedBox.h.

72 { return m_max; }
template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox< _Scalar, _AmbientDim >::max ( ) const
inline
Returns
the maximal corner

Definition at line 105 of file AlignedBox.h.

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

Definition at line 107 of file AlignedBox.h.

107 { return m_max; }
template<typename _Scalar, int _AmbientDim>
AlignedBox Eigen::AlignedBox< _Scalar, _AmbientDim >::merged ( const AlignedBox< _Scalar, _AmbientDim > &  b) const
inline

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

Definition at line 219 of file AlignedBox.h.

220  { return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); }
template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox< _Scalar, _AmbientDim >::min ( ) const
inline
Returns
the minimal corner

Definition at line 66 of file AlignedBox.h.

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

Definition at line 68 of file AlignedBox.h.

68 { return m_min; }
template<typename _Scalar, int _AmbientDim>
const VectorType&() Eigen::AlignedBox< _Scalar, _AmbientDim >::min ( ) const
inline
Returns
the minimal corner

Definition at line 101 of file AlignedBox.h.

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

Definition at line 103 of file AlignedBox.h.

103 { return m_min; }
template<typename _Scalar, int _AmbientDim>
VectorType Eigen::AlignedBox< _Scalar, _AmbientDim >::sample ( ) const
inline
Returns
a random point inside the bounding box sampled with a uniform distribution

Definition at line 160 of file AlignedBox.h.

161  {
162  VectorType r;
163  for(Index d=0; d<dim(); ++d)
164  {
165  if(!ScalarTraits::IsInteger)
166  {
167  r[d] = m_min[d] + (m_max[d]-m_min[d])
168  * internal::random<Scalar>(Scalar(0), Scalar(1));
169  }
170  else
171  r[d] = internal::random(m_min[d], m_max[d]);
172  }
173  return r;
174  }
int dim() const
Definition: AlignedBox.h:53
template<typename _Scalar, int _AmbientDim>
void Eigen::AlignedBox< _Scalar, _AmbientDim >::setEmpty ( )
inline

Makes *this an empty box.

Definition at line 94 of file AlignedBox.h.

95  {
96  m_min.setConstant( ScalarTraits::highest() );
97  m_max.setConstant( ScalarTraits::lowest() );
98  }
Derived & setConstant(Index size, const Scalar &value)
template<typename _Scalar, int _AmbientDim>
void Eigen::AlignedBox< _Scalar, _AmbientDim >::setNull ( )
inline

Makes *this a null/empty box.

Definition at line 59 of file AlignedBox.h.

60  {
61  m_min.setConstant( (std::numeric_limits<Scalar>::max)());
62  m_max.setConstant(-(std::numeric_limits<Scalar>::max)());
63  }
Derived & setConstant(Index size, const Scalar &value)
template<typename _Scalar, int _AmbientDim>
void Eigen::AlignedBox< _Scalar, _AmbientDim >::setNull ( )
inline
Deprecated:
use setEmpty

Definition at line 88 of file AlignedBox.h.

88 { setEmpty(); }
template<typename _Scalar, int _AmbientDim>
const CwiseBinaryOp< internal::scalar_difference_op<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

Definition at line 119 of file AlignedBox.h.

120  { return m_max - m_min; }
template<typename Scalar , int AmbiantDim>
Scalar Eigen::AlignedBox< Scalar, AmbiantDim >::squaredExteriorDistance ( const VectorType 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()

Definition at line 145 of file AlignedBox.h.

146 {
147  Scalar dist2(0);
148  Scalar aux;
149  for (int k=0; k<dim(); ++k)
150  {
151  if ((aux = (p[k]-m_min[k]))<Scalar(0))
152  dist2 += aux*aux;
153  else if ( (aux = (m_max[k]-p[k]))<Scalar(0))
154  dist2 += aux*aux;
155  }
156  return dist2;
157 }
int dim() const
Definition: AlignedBox.h:53
template<typename Scalar , int AmbientDim>
template<typename Derived >
Scalar Eigen::AlignedBox< Scalar, AmbientDim >::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()

Definition at line 297 of file AlignedBox.h.

298 {
299  typename internal::nested<Derived,2*AmbientDim>::type p(a_p.derived());
300  Scalar dist2(0);
301  Scalar aux;
302  for (Index k=0; k<dim(); ++k)
303  {
304  if( m_min[k] > p[k] )
305  {
306  aux = m_min[k] - p[k];
307  dist2 += aux*aux;
308  }
309  else if( p[k] > m_max[k] )
310  {
311  aux = p[k] - m_max[k];
312  dist2 += aux*aux;
313  }
314  }
315  return dist2;
316 }
int dim() const
Definition: AlignedBox.h:53
template<typename Scalar , int AmbientDim>
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()

Definition at line 319 of file AlignedBox.h.

320 {
321  Scalar dist2(0);
322  Scalar aux;
323  for (Index k=0; k<dim(); ++k)
324  {
325  if( m_min[k] > b.m_max[k] )
326  {
327  aux = m_min[k] - b.m_max[k];
328  dist2 += aux*aux;
329  }
330  else if( b.m_min[k] > m_max[k] )
331  {
332  aux = b.m_min[k] - m_max[k];
333  dist2 += aux*aux;
334  }
335  }
336  return dist2;
337 }
int dim() const
Definition: AlignedBox.h:53
template<typename _Scalar, int _AmbientDim>
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::translate ( const VectorType t)
inline

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

Definition at line 95 of file AlignedBox.h.

96  { m_min += t; m_max += t; return *this; }
template<typename _Scalar, int _AmbientDim>
template<typename Derived >
AlignedBox& Eigen::AlignedBox< _Scalar, _AmbientDim >::translate ( const MatrixBase< Derived > &  a_t)
inline

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

Definition at line 224 of file AlignedBox.h.

225  {
226  const typename internal::nested<Derived,2>::type t(a_t.derived());
227  m_min += t;
228  m_max += t;
229  return *this;
230  }
template<typename _Scalar, int _AmbientDim>
Scalar Eigen::AlignedBox< _Scalar, _AmbientDim >::volume ( ) const
inline
Returns
the volume of the bounding box

Definition at line 123 of file AlignedBox.h.

124  { return sizes().prod(); }
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > sizes() const
Definition: AlignedBox.h:119

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