mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix global variable leakage, and join sequential variable definitions.
This commit is contained in:
parent
2693516844
commit
5ff990a84a
1 changed files with 8 additions and 8 deletions
|
@ -806,14 +806,14 @@ statics: {
|
|||
* @return {Number} Curvatue of the curve at specified offset
|
||||
*/
|
||||
getCurvatureAt: function(offset, isParameter) {
|
||||
values = this.getValues();
|
||||
// First derivative at offset/parameter
|
||||
var dt = Curve.evaluate(values, offset, isParameter, 1);
|
||||
// Second derivative at offset/parameter
|
||||
var d2t = Curve.evaluate(values, offset, isParameter, 3);
|
||||
var dx = dt.x, dy = dt.y, d2x = d2t.x, d2y = d2t.y;
|
||||
var isEnd = offset === 0 || ( isParameter )? offset === 1 :
|
||||
offset === this.getLength();
|
||||
var values = this.getValues(),
|
||||
// First derivative at offset/parameter
|
||||
dt = Curve.evaluate(values, offset, isParameter, 1),
|
||||
// Second derivative at offset/parameter
|
||||
d2t = Curve.evaluate(values, offset, isParameter, 3),
|
||||
dx = dt.x, dy = dt.y, d2x = d2t.x, d2y = d2t.y,
|
||||
isEnd = offset === 0 || ( isParameter )? offset === 1 :
|
||||
offset === this.getLength();
|
||||
//Calculate Curvature
|
||||
// if at an end point, k = (2/3) * h / a^2
|
||||
// else, k = |dx * d2y - dy * d2x| / (( dx^2 + dy^2 )^(3/2))
|
||||
|
|
Loading…
Reference in a new issue