Added optimized methods for point and polyline rotation.

Existing methods for rotation were optimized by calculating the sin/cos values once only.
Added an operator- for points.
This commit is contained in:
bubnikv 2016-04-10 19:06:46 +02:00
parent c8ff517389
commit 7d54e28e30
4 changed files with 54 additions and 4 deletions

View file

@ -41,6 +41,7 @@ class Point
void scale(double factor);
void translate(double x, double y);
void translate(const Vector &vector);
void rotate(double angle);
void rotate(double angle, const Point &center);
bool coincides_with(const Point &point) const;
bool coincides_with_epsilon(const Point &point) const;
@ -63,6 +64,7 @@ class Point
};
Point operator+(const Point& point1, const Point& point2);
Point operator-(const Point& point1, const Point& point2);
Point operator*(double scalar, const Point& point2);
class Point3 : public Point
@ -90,6 +92,7 @@ class Pointf
void scale(double factor);
void translate(double x, double y);
void translate(const Vectorf &vector);
void rotate(double angle);
void rotate(double angle, const Pointf &center);
Pointf negative() const;
Vectorf vector_to(const Pointf &point) const;