Merge pull request #1435 from jluis/master
Round results when rotating to minimize errors & pass the tests
This commit is contained in:
commit
749b8421b0
@ -22,8 +22,8 @@ Point::rotate(double angle, Point* center)
|
|||||||
{
|
{
|
||||||
double cur_x = (double)this->x;
|
double cur_x = (double)this->x;
|
||||||
double cur_y = (double)this->y;
|
double cur_y = (double)this->y;
|
||||||
this->x = (long)( (double)center->x + cos(angle) * (cur_x - (double)center->x) - sin(angle) * (cur_y - (double)center->y) );
|
this->x = (long)round( (double)center->x + cos(angle) * (cur_x - (double)center->x) - sin(angle) * (cur_y - (double)center->y) );
|
||||||
this->y = (long)( (double)center->y + cos(angle) * (cur_y - (double)center->y) + sin(angle) * (cur_x - (double)center->x) );
|
this->y = (long)round( (double)center->y + cos(angle) * (cur_y - (double)center->y) + sin(angle) * (cur_x - (double)center->x) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user