You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {Number} The length coordinate of the polar pair.
120
120
* @param {Number} The angle, in radians, of the polar pair.
121
-
* @return {Point} This instance. Useful for chaining method calls.
121
+
* @param {Point | Object} [pt] An object to copy the result into. If omitted a generic object with x/y properties will be returned.
122
+
* @return {Point} The new, interpolated point.
122
123
* @chainable
123
124
*/
124
-
p.polar=function(len,angle){
125
-
this.x=len*(Math.cos(angle));
126
-
this.y=len*(Math.sin(angle));
127
-
returnthis;
125
+
Point.polar=function(len,angle,pt){
126
+
pt=pt||{};
127
+
pt.x=len*(Math.cos(angle));
128
+
pt.y=len*(Math.sin(angle));
129
+
returnpt;
128
130
};
129
131
130
132
/**
131
133
* Determines a point between two specified points. The parameter `f` determines where the new interpolated point is located relative to the two end points specified by parameters `pt1` and `pt2`. The closer the value of the parameter `f` is to 1.0, the closer the interpolated point is to the first point (parameter `pt1`). The closer the value of the parameter `f` is to 0, the closer the interpolated point is to the second point (parameter `pt2`).
132
134
* @method offset
133
-
* @param {Point} The first point.
134
-
* @param {Point} The second point.
135
+
* @param {Point | Object} The first point as a Point or generic object.
136
+
* @param {Point | Object} The second point as a Point or generic object.
135
137
* @param {Number} The level of interpolation between the two points. Indicates where the new point will be, along the line between `pt1` and `pt2`. If `f=1`, `pt1` is returned; if `f=0`, `pt2` is returned.
136
138
* @param {Point | Object} [pt] An object to copy the result into. If omitted a generic object with x/y properties will be returned.
0 commit comments