Cocoa Port:

- Fix bug in GetNormalPointFromTransformedPoint() function where the angleDegrees parameter was actually in radians. It's now in degrees, as intended.
This commit is contained in:
rogerman 2012-01-17 01:02:38 +00:00
parent 5f2dd3e4c2
commit 2212f36cb0
1 changed files with 2 additions and 1 deletions

View File

@ -507,6 +507,7 @@ double GetMaxScalarInBounds(double normalBoundsWidth, double normalBoundsHeight,
********************************************************************************************/
NSPoint GetNormalPointFromTransformedPoint(NSPoint transformedPt, NSSize normalBounds, NSSize transformBounds, double scalar, double angleDegrees)
{
double angleRadians = angleDegrees * (M_PI/180.0);
double transformedX = 0.0;
double transformedY = 0.0;
@ -556,7 +557,7 @@ NSPoint GetNormalPointFromTransformedPoint(NSPoint transformedPt, NSSize normalB
// Get the normalized angle and use it to rotate about the origin.
// Then do polar-rect conversion and translate back to transformed coordinates
// with a 0 degree rotation.
normalizedAngle = theta - angleDegrees;
normalizedAngle = theta - angleRadians;
normalizedX = (r * cos(normalizedAngle)) + (normalBounds.width * scalar / 2.0);
normalizedY = (r * sin(normalizedAngle)) + (normalBounds.height * scalar / 2.0);