39 #include <visp3/core/vpRectOriented.h>
45 : m_center(), m_width(), m_height(), m_theta(), m_topLeft(), m_topRight(), m_bottomLeft(), m_bottomRight()
61 m_topLeft.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2.0);
62 m_topLeft.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2.0);
63 m_bottomLeft.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2.0);
64 m_bottomLeft.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2.0);
65 m_bottomRight.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2.0);
66 m_bottomRight.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2.0);
67 m_topRight.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2.0);
68 m_topRight.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2.0);
80 m_topLeft.
set_i(m_center.
get_i() - m_height / 2.0);
81 m_topLeft.
set_j(m_center.
get_j() - m_width / 2.0);
82 m_bottomLeft.
set_i(m_center.
get_i() + m_height / 2.0);
83 m_bottomLeft.
set_j(m_center.
get_j() - m_width / 2.0);
84 m_bottomRight.
set_i(m_center.
get_i() + m_height / 2.0);
85 m_bottomRight.
set_j(m_center.
get_j() + m_width / 2.0);
86 m_topRight.
set_i(m_center.
get_i() - m_height / 2.0);
87 m_topRight.
set_j(m_center.
get_j() + m_width / 2.0);
115 m_topLeft.
set_i(m_center.
get_i() - m_height / 2.0);
116 m_topLeft.
set_j(m_center.
get_j() - m_width / 2.0);
117 m_bottomLeft.
set_i(m_center.
get_i() + m_height / 2.0);
118 m_bottomLeft.
set_j(m_center.
get_j() - m_width / 2.0);
119 m_bottomRight.
set_i(m_center.
get_i() + m_height / 2.0);
120 m_bottomRight.
set_j(m_center.
get_j() + m_width / 2.0);
121 m_topRight.
set_i(m_center.
get_i() - m_height / 2.0);
122 m_topRight.
set_j(m_center.
get_j() + m_width / 2.0);
128 vpRectOriented::operator
vpRect()
130 if (std::fabs(m_theta) > std::numeric_limits<double>::epsilon())
133 return vpRect(m_topLeft, m_bottomRight);
144 m_bottomLeft = bottomLeft;
145 m_bottomRight = bottomRight;
146 m_topRight = topRight;
149 m_width = sqrt((m_topRight.
get_i() - m_topLeft.
get_i()) * (m_topRight.
get_i() - m_topLeft.
get_i()) +
151 m_height = sqrt((m_bottomLeft.
get_i() - m_topLeft.
get_i()) * (m_bottomLeft.
get_i() - m_topLeft.
get_i()) +
153 m_theta = atan2(m_topRight.
get_i() - m_topLeft.
get_i(), m_topRight.
get_j() - m_topLeft.
get_j());
159 m_topLeft += center - m_center;
160 m_bottomLeft += center - m_center;
161 m_bottomRight += center - m_center;
162 m_topRight += center - m_center;
186 m_topLeft.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2);
187 m_topLeft.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2);
188 m_bottomLeft.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2);
189 m_bottomLeft.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2);
190 m_bottomRight.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2);
191 m_bottomRight.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2);
192 m_topRight.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2);
193 m_topRight.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2);
206 m_topLeft.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2);
207 m_topLeft.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2);
208 m_bottomLeft.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 - m_width * sin(m_theta) / 2);
209 m_bottomLeft.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 - m_width * cos(m_theta) / 2);
210 m_bottomRight.
set_i(m_center.
get_i() + m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2);
211 m_bottomRight.
set_j(m_center.
get_j() - m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2);
212 m_topRight.
set_i(m_center.
get_i() - m_height * cos(m_theta) / 2.0 + m_width * sin(m_theta) / 2);
213 m_topRight.
set_j(m_center.
get_j() + m_height * sin(m_theta) / 2.0 + m_width * cos(m_theta) / 2);
222 if (!isLeft(point, m_topLeft, m_bottomLeft))
224 if (!isLeft(point, m_bottomLeft, m_bottomRight))
226 if (!isLeft(point, m_bottomRight, m_topRight))
228 if (!isLeft(point, m_topRight, m_topLeft))
238 double c = -(a * point1.
get_i() + b * point1.
get_j());
239 double d = a * pointToTest.
get_i() + b * pointToTest.
get_j() + c;