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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user