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
* Return Point Objects instead of generic objects when using interpolate and polar
* Fixed small documentation issues, and formatted docs
* Added @default values on x/y
* Offsets the Point object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.
91
+
* Offsets the Point object by the specified amount.
92
+
* <ul>
93
+
* <li>The value of `dx` is added to the original value of `x` to create the new `x` value</li>
94
+
* <li>The value of `dy` is added to the original value of `y` to create the new `y` value</li>
95
+
* </ul>
90
96
* @method offset
91
-
* @param {Number} dx The amount by which to offset the horizontal coordinate, x.
92
-
* @param {Number} dy The amount by which to offset the vertical coordinate, y.
97
+
* @param {Number} dx The amount by which to offset the horizontal coordinate, `x`.
98
+
* @param {Number} dy The amount by which to offset the vertical coordinate, `y`.
93
99
* @return {Point} This instance. Useful for chaining method calls.
* @param {Number} len The length coordinate of the polar pair.
106
112
* @param {Number} angle The angle, in radians, of the polar pair.
107
-
* @param {Point | Object} [pt] An object to copy the result into. If omitted a generic object with x/y properties will be returned.
113
+
* @param {Point | Object} [pt] An object to copy the result into. If omitted a new {{#crossLink "Point"}}{{/crossLink}}
114
+
* will be returned.
108
115
* @return {Point} The new, interpolated point.
109
-
* @chainable
110
116
*/
111
117
Point.polar=function(len,angle,pt){
112
-
pt=pt||{};
113
-
pt.x=len*(Math.cos(angle));
114
-
pt.y=len*(Math.sin(angle));
118
+
pt=pt||newPoint();
119
+
pt.x=len*Math.cos(angle);
120
+
pt.y=len*Math.sin(angle);
115
121
returnpt;
116
122
};
117
123
118
-
/**
119
-
* 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`).
124
+
/**
125
+
* Determine a point between two specified points.
126
+
*
127
+
* The parameter `f` determines where the new interpolated point is located relative to the two end points specified
128
+
* by parameters `pt1` and `pt2`:
129
+
* <ul>
130
+
* <li>The closer the value of the parameter `f` is to 1.0, the closer the interpolated point is to the first
131
+
* point (parameter `pt1`).</li>
132
+
* <li>The closer the value of the parameter `f` is to 0, the closer the interpolated point is to the second
133
+
* point (parameter `pt2`).</li>
134
+
* </ul>
120
135
* @method interpolate
121
136
* @param {Point | Object} pt1 The first point as a Point or generic object.
122
137
* @param {Point | Object} pt2 The second point as a Point or generic object.
123
-
* @param {Number} f 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.
124
-
* @param {Point | Object} [pt] An object to copy the result into. If omitted a generic object with x/y properties will be returned.
125
-
* @return {Point} The new, interpolated point.
126
-
* @chainable
138
+
* @param {Number} f The level of interpolation between the two points. Indicates where the new point will be, along
139
+
* the line between `pt1` and `pt2`. If `f=1`, `pt1` is returned; if `f=0`, `pt2` is returned.
140
+
* @param {Point | Object} [pt] An object to copy the result into. If omitted, a new {{#crossLink "Point"}}{{/crossLink}}
141
+
* will be returned.
142
+
* @return {Point} A new interpolated Point, or the `pt` passed in the 4th parameter with the interpolated values.
0 commit comments