Meged with release_candidate_1_3

This commit is contained in:
bubnikv 2016-09-12 11:29:39 +02:00
commit 9fcc8fe9ae
59 changed files with 4622 additions and 953 deletions

View file

@ -54,13 +54,26 @@ Point::translate(const Vector &vector)
this->translate(vector.x, vector.y);
}
void
Point::rotate(double angle)
{
double cur_x = (double)this->x;
double cur_y = (double)this->y;
double s = sin(angle);
double c = cos(angle);
this->x = (coord_t)round(c * cur_x - s * cur_y);
this->y = (coord_t)round(c * cur_y + s * cur_x);
}
void
Point::rotate(double angle, const Point &center)
{
double cur_x = (double)this->x;
double cur_y = (double)this->y;
this->x = (coord_t)round( (double)center.x + cos(angle) * (cur_x - (double)center.x) - sin(angle) * (cur_y - (double)center.y) );
this->y = (coord_t)round( (double)center.y + cos(angle) * (cur_y - (double)center.y) + sin(angle) * (cur_x - (double)center.x) );
double s = sin(angle);
double c = cos(angle);
this->x = (coord_t)round( (double)center.x + c * (cur_x - (double)center.x) - s * (cur_y - (double)center.y) );
this->y = (coord_t)round( (double)center.y + c * (cur_y - (double)center.y) + s * (cur_x - (double)center.x) );
}
bool
@ -301,6 +314,12 @@ operator+(const Point& point1, const Point& point2)
return Point(point1.x + point2.x, point1.y + point2.y);
}
Point
operator-(const Point& point1, const Point& point2)
{
return Point(point1.x - point2.x, point1.y - point2.y);
}
Point
operator*(double scalar, const Point& point2)
{
@ -349,13 +368,26 @@ Pointf::translate(const Vectorf &vector)
this->translate(vector.x, vector.y);
}
void
Pointf::rotate(double angle)
{
double cur_x = this->x;
double cur_y = this->y;
double s = sin(angle);
double c = cos(angle);
this->x = c * cur_x - s * cur_y;
this->y = c * cur_y + s * cur_x;
}
void
Pointf::rotate(double angle, const Pointf &center)
{
double cur_x = this->x;
double cur_y = this->y;
this->x = center.x + cos(angle) * (cur_x - center.x) - sin(angle) * (cur_y - center.y);
this->y = center.y + cos(angle) * (cur_y - center.y) + sin(angle) * (cur_x - center.x);
double s = sin(angle);
double c = cos(angle);
this->x = center.x + c * (cur_x - center.x) - s * (cur_y - center.y);
this->y = center.y + c * (cur_y - center.y) + s * (cur_x - center.x);
}
Pointf