Remove debug code and TODO from CurveLocation#isCrossing()

This commit is contained in:
Jürg Lehni 2015-10-21 02:36:43 +02:00
parent 8c702ce5b4
commit 7a95625a13
2 changed files with 7 additions and 26 deletions

View file

@ -387,17 +387,15 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
* crossing another curve}
* @see #isTouching()
*/
isCrossing: function(_report) {
isCrossing: function() {
// Implementation based on work by Andy Finnell:
// http://losingfight.com/blog/2011/07/09/how-to-implement-boolean-operations-on-bezier-paths-part-3/
// https://bitbucket.org/andyfinnell/vectorboolean
var inter = this._intersection;
if (!inter)
return false;
// TODO: Make getCurve() and getParameter() sync work in boolean ops
// before and after splitting!!!
var t1 = this._parameter,
t2 = inter._parameter,
var t1 = this.getParameter(),
t2 = inter.getParameter(),
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
tMax = 1 - tMin;
// If the intersection is in the middle of the path, it is either a
@ -411,32 +409,14 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
// emerge from switching to 0 and 1 in edge cases.
// NOTE: VectorBoolean has code that slowly shifts these points inwards
// until the resulting tangents are not ambiguous. Do we need this too?
var c2 = this._curve,
var c2 = this.getCurve(),
c1 = c2.getPrevious(),
c4 = inter._curve,
c4 = inter.getCurve(),
c3 = c4.getPrevious(),
PI = Math.PI;
if (!c1 || !c3)
return false;
if (_report) {
new Path.Circle({
center: this.getPoint(),
radius: 10,
strokeColor: 'red'
});
new Path({
segments: [c1.getSegment1(), c1.getSegment2(), c2.getSegment2()],
strokeColor: 'red',
strokeWidth: 4
});
new Path({
segments: [c3.getSegment1(), c3.getSegment2(), c4.getSegment2()],
strokeColor: 'orange',
strokeWidth: 4
});
}
function isInRange(angle, min, max) {
return min < max
? angle > min && angle < max

View file

@ -136,7 +136,8 @@ PathItem.inject(new function() {
}
/*
* Creates linked lists between intersections through their _next property.
* Creates linked lists between intersections through their _next and _prev
* properties.
*
* @private
*/