10 #ifndef EIGEN_ALIGNEDBOX_H 11 #define EIGEN_ALIGNEDBOX_H 29 template <
typename _Scalar,
int _AmbientDim>
74 template<
typename OtherVectorType1,
typename OtherVectorType2>
75 EIGEN_DEVICE_FUNC
inline AlignedBox(
const OtherVectorType1& _min,
const OtherVectorType2& _max) :
m_min(_min),
m_max(_max) {}
78 template<
typename Derived>
95 EIGEN_DEVICE_FUNC
inline bool isEmpty()
const {
return (
m_min.array() >
m_max.array()).any(); }
106 EIGEN_DEVICE_FUNC
inline const VectorType& (
min)()
const {
return m_min; }
108 EIGEN_DEVICE_FUNC
inline VectorType& (
min)() {
return m_min; }
110 EIGEN_DEVICE_FUNC
inline const VectorType& (
max)()
const {
return m_max; }
112 EIGEN_DEVICE_FUNC
inline VectorType& (
max)() {
return m_max; }
127 EIGEN_DEVICE_FUNC
inline Scalar
volume()
const 128 {
return sizes().prod(); }
134 EIGEN_DEVICE_FUNC
inline CwiseBinaryOp< internal::scalar_difference_op<Scalar,Scalar>,
const VectorType,
const VectorType>
diagonal()
const 153 for(Index
d=0;
d<
dim(); ++
d)
155 if( mult & corner ) res[
d] =
m_max[
d];
164 EIGEN_DEVICE_FUNC
inline VectorType
sample()
const 167 for(Index
d=0;
d<
dim(); ++
d)
181 template<
typename Derived>
185 return (
m_min.array()<=p_n.array()).all() && (p_n.array()<=
m_max.array()).all();
190 {
return (
m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=
m_max.array()).all(); }
195 {
return (
m_min.array()<=(b.max)().array()).all() && ((b.min)().array()<=
m_max.array()).all(); }
199 template<
typename Derived>
203 m_min = m_min.cwiseMin(p_n);
240 template<
typename Derived>
253 template<
typename Derived>
266 template<
typename Derived>
282 template<
typename NewScalarType>
291 template<
typename OtherScalarType>
294 m_min = (other.min)().template cast<Scalar>();
295 m_max = (other.max)().template cast<Scalar>();
302 EIGEN_DEVICE_FUNC
bool isApprox(
const AlignedBox& other,
const RealScalar& prec = ScalarTraits::dummy_precision())
const 303 {
return m_min.isApprox(other.m_min, prec) &&
m_max.isApprox(other.m_max, prec); }
312 template<
typename Scalar,
int AmbientDim>
313 template<
typename Derived>
319 for (Index k=0; k<
dim(); ++k)
321 if(
m_min[k] > p[k] )
323 aux =
m_min[k] - p[k];
326 else if( p[k] >
m_max[k] )
328 aux = p[k] -
m_max[k];
335 template<
typename Scalar,
int AmbientDim>
340 for (Index k=0; k<
dim(); ++k)
342 if(
m_min[k] > b.m_max[k] )
344 aux =
m_min[k] - b.m_max[k];
347 else if( b.m_min[k] >
m_max[k] )
349 aux = b.m_min[k] -
m_max[k];
372 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ 374 typedef AlignedBox<Type, Size> AlignedBox##SizeSuffix##TypeSuffix; 376 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ 377 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 1, 1) \ 378 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ 379 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ 380 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ 381 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) 387 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES 388 #undef EIGEN_MAKE_TYPEDEFS 392 #endif // EIGEN_ALIGNEDBOX_H
EIGEN_DEVICE_FUNC bool isApprox(const AlignedBox &other, const RealScalar &prec=ScalarTraits::dummy_precision()) const
EIGEN_DEVICE_FUNC bool contains(const AlignedBox &b) const
ScalarTraits::NonInteger NonInteger
EIGEN_DEVICE_FUNC AlignedBox & translate(const MatrixBase< Derived > &a_t)
EIGEN_DEVICE_FUNC const VectorType &() max() const
ScalarTraits::Real RealScalar
EIGEN_DEVICE_FUNC AlignedBox & extend(const AlignedBox &b)
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
EIGEN_DEVICE_FUNC bool isNull() const
EIGEN_DEVICE_FUNC ~AlignedBox()
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC NonInteger exteriorDistance(const AlignedBox &b) const
EIGEN_DEVICE_FUNC AlignedBox(const OtherVectorType1 &_min, const OtherVectorType2 &_max)
EIGEN_DEVICE_FUNC Scalar volume() const
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
EIGEN_DEVICE_FUNC const CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const VectorType, const VectorType > sizes() const
Generic expression where a coefficient-wise binary operator is applied to two expressions.
EIGEN_DEVICE_FUNC AlignedBox & clamp(const AlignedBox &b)
EIGEN_DEVICE_FUNC AlignedBox()
EIGEN_DEVICE_FUNC AlignedBox(const AlignedBox< OtherScalarType, AmbientDimAtCompileTime > &other)
EIGEN_DEVICE_FUNC const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(VectorTypeSum, RealScalar, quotient) center() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC internal::cast_return_type< AlignedBox, AlignedBox< NewScalarType, AmbientDimAtCompileTime > >::type cast() const
EIGEN_DEVICE_FUNC Derived & setConstant(Index size, const Scalar &val)
EIGEN_DEVICE_FUNC void setEmpty()
EIGEN_DEVICE_FUNC AlignedBox(const MatrixBase< Derived > &p)
EIGEN_DEVICE_FUNC bool isEmpty() const
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const VectorType, const VectorType > diagonal() const
EIGEN_DEVICE_FUNC VectorType corner(CornerType corner) const
EIGEN_DEVICE_FUNC const VectorType &() min() const
CwiseBinaryOp< internal::scalar_sum_op< Scalar >, const VectorType, const VectorType > VectorTypeSum
EIGEN_DEVICE_FUNC void setNull()
EIGEN_DEVICE_FUNC NonInteger exteriorDistance(const MatrixBase< Derived > &p) const
EIGEN_DEVICE_FUNC Index dim() const
EIGEN_DEVICE_FUNC AlignedBox merged(const AlignedBox &b) const
EIGEN_DEVICE_FUNC VectorType sample() const
NumTraits< Scalar > ScalarTraits
EIGEN_DEVICE_FUNC bool intersects(const AlignedBox &b) const
EIGEN_DEVICE_FUNC AlignedBox & extend(const MatrixBase< Derived > &p)
const mpreal random(unsigned int seed=0)
EIGEN_DEVICE_FUNC AlignedBox(Index _dim)
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance(const MatrixBase< Derived > &p) const
EIGEN_DEVICE_FUNC VectorType &() max()
EIGEN_DEVICE_FUNC VectorType &() min()
EIGEN_DEVICE_FUNC bool contains(const MatrixBase< Derived > &p) const
#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix)
EIGEN_DEVICE_FUNC const Scalar & b
Base class for all dense matrices, vectors, and expressions.
EIGEN_DEVICE_FUNC AlignedBox intersection(const AlignedBox &b) const
Matrix< Scalar, AmbientDimAtCompileTime, 1 > VectorType