Menu

#1 Point2f & Point2d Rotation about a point

open
nobody
None
5
2006-10-31
2006-10-31
Anonymous
No

Point_2d and Point_2f rotation is not well done.

R(origin,Theta) = T-1(origin).R(Theta).T(origin)

Note the following source code

Point_2d &Point_2d::rotate(const Point_2d &origin,
double theta)
{
Vector_2d t(origin.m_p);
*this -= t;
t.rotate(theta); // **** bug ****
*this += t;
return *this;
}

Which is rotating the origin vector around (0,0).
a fixed version should be:

Point_2d &Point_2d::rotate(const Point_2d &origin,
double theta)
{
Vector_2d t(origin.m_p);
*this -= t;
this->rotate(theta); // **** fixed *****
*this += t;
return *this;
}

Discussion


Log in to post a comment.