Use degrees instead of radians for geometry.rotate method (closes #948).

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4127 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-08-30 17:10:26 +00:00
parent b78aec44c9
commit be4180fd75
6 changed files with 13 additions and 12 deletions

View File

@@ -133,14 +133,15 @@ OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {
/**
* APIMethod: rotate
* Rotate a point around another
* Rotate a point around another.
*
* Parameters:
* angle - {Float} Rotation angle in radians (measured counterclockwise
* angle - {Float} Rotation angle in degrees (measured counterclockwise
* from the positive x-axis)
* origin - {<OpenLayers.Geometry.Point>} Center point for the rotation
*/
rotate: function(angle, origin) {
angle *= Math.PI / 180;
var radius = this.distanceTo(origin);
var theta = angle + Math.atan2(this.y - origin.y, this.x - origin.x);
this.x = origin.x + (radius * Math.cos(theta));