10 #ifndef ApproxMVBB_MinAreaRectangle_hpp 11 #define ApproxMVBB_MinAreaRectangle_hpp 18 #include ApproxMVBB_TypeDefs_INCLUDE_FILE 20 #include ApproxMVBB_AssertionDebug_INCLUDE_FILE 32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 template<
typename Derived>
43 : m_p(points), m_convh(m_p) {
44 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,2, Eigen::Dynamic)
45 ApproxMVBB_ASSERTMSG( m_p.data() == points.derived().data() ,
" You store a temporary in a Ref<> which works here, but do you really want this?")
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
80 void computeRectangle();
83 unsigned int m_idx = 0;
84 unsigned int m_ptIdx = 0;
85 PREC m_currAngle = 0.0;
99 PREC uNorm = m_minBox.m_u.norm();
100 PREC vNorm = m_minBox.m_v.norm();
103 Vector2 uN = m_minBox.m_u.array() / uNorm;
104 Vector2 vN = m_minBox.m_v.array() / vNorm;
106 bool uF = uN.allFinite();
107 bool vF = vN.allFinite();
116 PREC h = uNT.dot(m_minBox.m_v);
117 PREC l = uN.dot (m_minBox.m_v);
120 m_minBox.m_uL = uNorm + l;
122 m_minBox.m_uL = uNorm - l;
123 m_minBox.m_p += uN*l;
132 m_minBox.m_vL = m_minBox.m_uL;
144 m_minBox.m_v(0) = -uN(1);
145 m_minBox.m_v(1) = uN(0);
147 m_minBox.m_uL = uNorm;
155 m_minBox.m_u(0) = -vN(1);
156 m_minBox.m_u(1) = vN(0);
159 m_minBox.m_vL = vNorm;
162 m_minBox.m_u(0) = 1.0; m_minBox.m_u(1) = 0.0;
163 m_minBox.m_v(0) = 0.0; m_minBox.m_v(1) = 1.0;
164 m_minBox.m_uL = 0.0; m_minBox.m_vL = 0.0;
171 updateAngles(edgeAngle, c);
172 for(
unsigned char i=0; i<4; i++) {
202 const MatrixRef<const Matrix2Dyn>
m_p;
#define ApproxMVBB_ASSERTMSG(condition, message)
An Assert Macro to use within C++ code.
Vector2 m_p
first corner x = m_p0 + m_u*m_uL * u + m_v*m_vL * v , u,v in [0,1]
These are some container definitions.
Vector2 m_u
vector of first side (x-Axis) (normalized)
void updateCalipers(PREC edgeAngle, Caliper(&c)[4])
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ApproxMVBB_DEFINE_MATRIX_TYPES ApproxMVBB_DEFINE_POINTS_CONFIG_TYPES MinAreaRectangle(const MatrixBase< Derived > &points)
void updateAngles(PREC edgeAngle, Caliper(&c)[4])
#define ApproxMVBB_DEFINE_POINTS_CONFIG_TYPES
Eigen::Matrix< Scalar, 2, 1 > Vector2
EIGEN_MAKE_ALIGNED_OPERATOR_NEW void reset()
std::vector< PREC > m_angles
const MatrixRef< const Matrix2Dyn > m_p
#define ApproxMVBB_DEFINE_MATRIX_TYPES
MyMatrix::Vector2< unsigned int > Vector2U
Vector2 m_v
vector of second side (y-Axis) (normalized)
std::vector< unsigned int > m_hullIdx
const Box2d & getMinRectangle()