Use Curve#getLength(from, to) rather than cloning and dividing.

This commit is contained in:
Jürg Lehni 2011-04-27 20:52:24 +01:00
parent 346493fb7c
commit c2fbcbcaa8

View file

@ -37,10 +37,10 @@ CurveLocation = Base.extend({
return null;
} else {
// Determine the closest segment by comparing curve lengths
var rightCurve = curve.clone().divide(parameter);
this._segment = rightCurve.getLength() > curve.getLength() / 2
? curve._segment1
: curve._segment2;
this._segment = curve.getLength(0, parameter)
< curve.getLength(parameter, 1)
? curve._segment1
: curve._segment2;
}
}
return this._segment;