diff options
author | neoraider <devnull@localhost> | 2008-02-15 20:10:04 +0100 |
---|---|---|
committer | neoraider <devnull@localhost> | 2008-02-15 20:10:04 +0100 |
commit | 0ea1d388651217697d49029820b02b4f002f1ac0 (patch) | |
tree | 67f826d2b91f406606cdb1da04d7f25db96ef4ed /Portal.h | |
parent | 80b4f14530426d21c7ea26b7976a728f5b36c294 (diff) | |
download | zoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.tar zoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.zip |
zoomedit: Made rotation tool much nicer ;-)
Diffstat (limited to 'Portal.h')
-rw-r--r-- | Portal.h | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -88,15 +88,19 @@ class Portal : public LevelObject, public VertexProvider { updateVertices(); } - virtual void rotate(float a) { + virtual void rotate(Vertex m, float a) { orient = fmodf(orient+a, 2*M_PI); + + s = sinf(a); + c = cosf(a); + + pos -= m; + pos.setLocation(c*pos.getX() - s*pos.getY(), c*pos.getY() + s*pos.getX()); + pos += m; + updateOrient(); } - virtual Vertex getCenter() const { - return pos; - } - virtual const Vertex* getVertex(size_t id) const { return &vertices[id]; } @@ -109,12 +113,8 @@ class Portal : public LevelObject, public VertexProvider { move(x, y); } - virtual void rotateVertex(size_t id, float a) { - pos = vertices[id]; - rotate(a); - pos = vertices[(id+2)%4]; - - updateVertices(); + virtual void rotateVertex(size_t id, Vertex m, float a) { + rotate(m, a); } }; |