We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3c91bbf commit 08a2c1fCopy full SHA for 08a2c1f
1 file changed
v3/src/math/Vector2.js
@@ -54,6 +54,19 @@ var Vector2 = new Class({
54
return this;
55
},
56
57
+ // Sets the `x` and `y` values of this object from a given polar coordinate.
58
+ // @param {number} azimuth - The angular coordinate, in radians.
59
+ // @param {number} [radius=1] - The radial coordinate (length).
60
+ setToPolar: function (azimuth, radius)
61
+ {
62
+ if (radius == null) { radius = 1; }
63
+
64
+ this.x = Math.cos(azimuth) * radius;
65
+ this.y = Math.sin(azimuth) * radius;
66
67
+ return this;
68
+ },
69
70
equals: function (v)
71
{
72
return ((this.x === v.x) && (this.y === v.y));
0 commit comments