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 /Room.cpp | |
parent | 80b4f14530426d21c7ea26b7976a728f5b36c294 (diff) | |
download | zoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.tar zoomedit-0ea1d388651217697d49029820b02b4f002f1ac0.zip |
zoomedit: Made rotation tool much nicer ;-)
Diffstat (limited to 'Room.cpp')
-rw-r--r-- | Room.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -2,17 +2,6 @@ #include "LevelEdge.h" -void Room::rotateAround(Vertex z, float a) { - float s = sinf(a); - float c = cosf(a); - - for(Polygon::iterator v = polygon.begin(); v != polygon.end(); v++) { - *v -= z; - v->setLocation(c*v->getX() - s*v->getY(), c*v->getY() + s*v->getX()); - *v += z; - } -} - const Room& Room::operator=(const Room &room) { polygon.clear(); edges.clear(); @@ -61,3 +50,14 @@ std::vector<SharedPtr<LevelObject> > Room::getChildren() { return children; } + +void Room::rotate(Vertex m, float a) { + float s = sinf(a); + float c = cosf(a); + + for(Polygon::iterator v = polygon.begin(); v != polygon.end(); v++) { + *v -= m; + v->setLocation(c*v->getX() - s*v->getY(), c*v->getY() + s*v->getX()); + *v += m; + } +} |