summaryrefslogtreecommitdiffstats
path: root/Portal.h
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2008-02-15 20:10:04 +0100
committerneoraider <devnull@localhost>2008-02-15 20:10:04 +0100
commit0ea1d388651217697d49029820b02b4f002f1ac0 (patch)
tree67f826d2b91f406606cdb1da04d7f25db96ef4ed /Portal.h
parent80b4f14530426d21c7ea26b7976a728f5b36c294 (diff)
downloadzoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.tar
zoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.zip
zoomedit: Made rotation tool much nicer ;-)
Diffstat (limited to 'Portal.h')
-rw-r--r--Portal.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/Portal.h b/Portal.h
index 858caf8..6acd1f3 100644
--- a/Portal.h
+++ b/Portal.h
@@ -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);
}
};