First implementation of wipe tower rotation
This commit is contained in:
parent
7308017ee8
commit
0e9e487930
2 changed files with 49 additions and 13 deletions
|
@ -23,6 +23,16 @@ public:
|
|||
xy& operator-=(const xy &rhs) { x -= rhs.x; y -= rhs.y; return *this; }
|
||||
bool operator==(const xy &rhs) { return x == rhs.x && y == rhs.y; }
|
||||
bool operator!=(const xy &rhs) { return x != rhs.x || y != rhs.y; }
|
||||
|
||||
// Rotate the point around given point about given angle (in degrees)
|
||||
xy rotate(const xy& origin, float angle) const {
|
||||
xy out(0,0);
|
||||
angle *= M_PI/180.;
|
||||
out.x=(x-origin.x) * cos(angle) - (y-origin.y) * sin(angle);
|
||||
out.y=(x-origin.x) * sin(angle) + (y-origin.y) * cos(angle);
|
||||
return out+origin;
|
||||
}
|
||||
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue