fixed rotation bug

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@143 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-22 13:52:20 +00:00
parent 20f5c127f8
commit 5a8febd82a
7 changed files with 21 additions and 8 deletions
+8
View File
@@ -80,6 +80,14 @@ RealPoint Rotation::trInv(const RealPoint& p) const {
}
}
RealSize Rotation::trInvNoNeg(const RealSize& s) const {
if (sideways()) {
return RealSize(s.height, s.width) / zoom;
} else {
return RealSize(s.width, s.height) / zoom;
}
}
// ----------------------------------------------------------------------------- : Rotater
Rotater::Rotater(Rotation& rot, const Rotation& by)
+3 -1
View File
@@ -31,7 +31,7 @@ class Rotation {
/// Change the angle
void setAngle(int a);
/// The internal size
inline RealSize getInternalSize() const { return trInv(size); }
inline RealSize getInternalSize() const { return trInvNoNeg(size); }
/// The intarnal rectangle (origin at (0,0))
inline RealRect getInternalRect() const { return RealRect(RealPoint(0,0), getInternalSize()); }
/// The external rectangle (as passed to the constructor) == trNoNeg(getInternalRect())
@@ -64,6 +64,8 @@ class Rotation {
RealPoint trInv(const RealPoint& p) const;
/// Translate a size back to internal coordinates
RealSize trInv(const RealSize& s) const;
/// Translate a size back to internal coordinates, that are not negative
RealSize trInvNoNeg(const RealSize& s) const;
protected:
int angle; ///< The angle of rotation in degrees (counterclockwise)