10 #ifndef ApproxMVBB_OOBB_hpp 11 #define ApproxMVBB_OOBB_hpp 14 #include ApproxMVBB_TypeDefs_INCLUDE_FILE 15 #include ApproxMVBB_AABB_INCLUDE_FILE 24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 switchZAxis(static_cast<unsigned int>(i));
63 void switchZAxis(
unsigned int i);
68 template<
typename Derived>
70 m_maxPoint(0) = std::max(m_maxPoint(0),p(0));
71 m_maxPoint(1) = std::max(m_maxPoint(1),p(1));
72 m_maxPoint(2) = std::max(m_maxPoint(2),p(2));
73 m_minPoint(0) = std::min( m_minPoint(0),p(0));
74 m_minPoint(1) = std::min( m_minPoint(1),p(1));
75 m_minPoint(2) = std::min( m_minPoint(2),p(2));
82 return (m_maxPoint - m_minPoint).array();
86 return (m_maxPoint - m_minPoint).maxCoeff();
90 return (m_maxPoint - m_minPoint).maxCoeff(&i);
94 return m_maxPoint(0) <= m_minPoint(0) || m_maxPoint(1) <= m_minPoint(1) || m_maxPoint(2) <= m_minPoint(2);
103 template<
typename Derived,
bool coordinateSystemIsI = true>
104 inline bool overlaps(
const MatrixBase<Derived> &p)
const {
105 if(coordinateSystemIsI){
107 Vector3 t = m_q_KI.inverse() * p;
108 return ((t.array() >= m_minPoint.array()) && (t.array() <= m_maxPoint.array())).all();
111 return ((p.array() >= m_minPoint.array()) && (p.array() <= m_maxPoint.array())).all();
116 void expandToMinExtentRelative(PREC p = 0.1, PREC defaultExtent = 0.1, PREC eps = 1e-10);
119 void expandToMinExtentAbsolute(PREC minExtent);
134 Vector3 d = m_maxPoint- m_minPoint;
135 return d(0) * d(1) * d(2);
152 template<
bool coordinateSystemIsI = true>
156 points[0] = m_minPoint ;
157 points[1] = m_minPoint + (
Array3(1.0, 0.0, 0.0) * ex).matrix();
158 points[2] = m_minPoint + (
Array3(0.0, 1.0, 0.0) * ex).matrix();
159 points[3] = m_minPoint + (
Array3(1.0, 1.0, 0.0) * ex).matrix();
161 points[4] = m_minPoint + (
Array3(0.0, 0.0, 1.0) * ex).matrix();
162 points[5] = m_minPoint + (
Array3(1.0, 0.0, 1.0) * ex).matrix();
163 points[6] = m_minPoint + (
Array3(0.0, 1.0, 1.0) * ex).matrix();
164 points[7] = m_maxPoint ;
166 if(coordinateSystemIsI){
167 for(
auto & p : points){
168 p = (m_q_KI * p).eval();
#define ApproxMVBB_ASSERTMSG(condition, message)
An Assert Macro to use within C++ code.
Eigen::Quaternion< Scalar > Quaternion
VectorStat< Dim > m_minPoint
These are some container definitions.
OOBB & operator=(AABB3d &aabb)
Vector3 m_maxPoint
in K Frame
StdVecAligned< Vector3 > Vector3List
Vector3 getDirection(unsigned int i) const
OOBB & unite(const MatrixBase< Derived > &p)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ApproxMVBB_DEFINE_MATRIX_TYPES ApproxMVBB_DEFINE_POINTS_CONFIG_TYPES OOBB()
VectorStat< Dim > m_maxPoint
Eigen::Matrix< Scalar, 3, 3 > Matrix33
Quaternion m_q_KI
Rotation of frame I to frame K, corresponds to a transformation A_IK;.
Vector3 m_minPoint
in K Frame
Eigen::Array< Scalar, 3, 1 > Array3
#define ApproxMVBB_DEFINE_POINTS_CONFIG_TYPES
Vector3List getCornerPoints() const
bool overlaps(const MatrixBase< Derived > &p) const
Eigen::Matrix< Scalar, 3, 1 > Vector3
PREC maxExtent(Vector3::Index &i) const
#define ApproxMVBB_DEFINE_MATRIX_TYPES