10 #ifndef EIGEN_ALIGNEDBOX_H 11 #define EIGEN_ALIGNEDBOX_H 27 template <
typename _Scalar,
int _AmbientDim>
67 template<
typename OtherVectorType1,
typename OtherVectorType2>
68 inline AlignedBox(
const OtherVectorType1& _min,
const OtherVectorType2& _max) :
m_min(_min),
m_max(_max) {}
71 template<
typename Derived>
101 inline const VectorType& (
min)()
const {
return m_min; }
105 inline const VectorType& (
max)()
const {
return m_max; }
124 {
return sizes().prod(); }
149 for(Index d=0; d<
dim(); ++d)
151 if( mult & corner ) res[d] =
m_max[d];
152 else res[d] =
m_min[d];
163 for(Index d=0; d<
dim(); ++d)
177 template<
typename Derived>
181 return (
m_min.array()<=p.array()).all() && (p.array()<=
m_max.array()).all();
186 {
return (
m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=
m_max.array()).all(); }
189 template<
typename Derived>
193 m_min = m_min.cwiseMin(p);
223 template<
typename Derived>
236 template<
typename Derived>
249 template<
typename Derived>
265 template<
typename NewScalarType>
274 template<
typename OtherScalarType>
277 m_min = (other.min)().template cast<Scalar>();
278 m_max = (other.max)().template cast<Scalar>();
285 bool isApprox(
const AlignedBox& other,
const RealScalar& prec = ScalarTraits::dummy_precision())
const 286 {
return m_min.isApprox(other.m_min, prec) &&
m_max.isApprox(other.m_max, prec); }
295 template<
typename Scalar,
int AmbientDim>
296 template<
typename Derived>
302 for (Index k=0; k<
dim(); ++k)
304 if(
m_min[k] > p[k] )
306 aux =
m_min[k] - p[k];
309 else if( p[k] >
m_max[k] )
311 aux = p[k] -
m_max[k];
318 template<
typename Scalar,
int AmbientDim>
323 for (Index k=0; k<
dim(); ++k)
325 if(
m_min[k] > b.m_max[k] )
327 aux =
m_min[k] - b.m_max[k];
330 else if( b.m_min[k] >
m_max[k] )
332 aux = b.m_min[k] -
m_max[k];
355 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ 357 typedef AlignedBox<Type, Size> AlignedBox##SizeSuffix##TypeSuffix; 359 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ 360 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 1, 1) \ 361 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ 362 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ 363 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ 364 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) 370 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES 371 #undef EIGEN_MAKE_TYPEDEFS 375 #endif // EIGEN_ALIGNEDBOX_H AlignedBox(const MatrixBase< Derived > &a_p)
ScalarTraits::NonInteger NonInteger
AlignedBox intersection(const AlignedBox &b) const
IntermediateState sqrt(const Expression &arg)
AlignedBox & clamp(const AlignedBox &b)
NonInteger exteriorDistance(const AlignedBox &b) const
ScalarTraits::Real RealScalar
NonInteger exteriorDistance(const MatrixBase< Derived > &p) const
internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast() const
iterative scaling algorithm to equilibrate rows and column norms in matrices
VectorType sample() const
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Scalar squaredExteriorDistance(const VectorType &p) const
AlignedBox merged(const AlignedBox &b) const
const VectorType &() max() const
AlignedBox & extend(const AlignedBox &b)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > sizes() const
const VectorType &() min() const
VectorType corner(CornerType corner) const
const CwiseUnaryOp< internal::scalar_quotient1_op< Scalar >, const CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorType > > center() const
bool isApprox(const AlignedBox &other, const RealScalar &prec=ScalarTraits::dummy_precision()) const
#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix)
Derived & setConstant(Index size, const Scalar &value)
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
AlignedBox & translate(const MatrixBase< Derived > &a_t)
NumTraits< Scalar > ScalarTraits
CwiseBinaryOp< internal::scalar_difference_op< Scalar >, const VectorType, const VectorType > diagonal() const
AlignedBox(const OtherVectorType1 &_min, const OtherVectorType2 &_max)
Generic expression where a coefficient-wise unary operator is applied to an expression.
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
AlignedBox & extend(const MatrixBase< Derived > &a_p)
Base class for all dense matrices, vectors, and expressions.
bool contains(const MatrixBase< Derived > &a_p) const
Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType
AlignedBox(const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
bool contains(const AlignedBox &b) const