mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 06:58:34 +00:00
WINTERMUTE: Formatting
This commit is contained in:
parent
0153f762b1
commit
f014cccb94
@ -27,19 +27,16 @@
|
||||
namespace Wintermute {
|
||||
|
||||
FloatPoint TransformTools::transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX, bool mirrorY) {
|
||||
/*
|
||||
* Returns the coordinates for a point after rotation
|
||||
*/
|
||||
float rotateRad = rotate * M_PI / 180;
|
||||
FloatPoint newPoint;
|
||||
newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/100.0;
|
||||
newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/100.0;
|
||||
if (mirrorX) newPoint.x *= -1;
|
||||
if (mirrorY) newPoint.y *= -1;
|
||||
/*
|
||||
* I apply the textbook formula, but first I reverse the Y-axis, otherwise
|
||||
* I'd be performing a rotation in the wrong direction
|
||||
*/
|
||||
newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/DEFAULT_ZOOM_X;
|
||||
newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/DEFAULT_ZOOM_Y;
|
||||
if (mirrorX) {
|
||||
newPoint.x *= -1;
|
||||
}
|
||||
if (mirrorY) {
|
||||
newPoint.y *= -1;
|
||||
}
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user