mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Remove debug code and TODO from CurveLocation#isCrossing()
This commit is contained in:
parent
8c702ce5b4
commit
7a95625a13
2 changed files with 7 additions and 26 deletions
|
@ -387,17 +387,15 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* crossing another curve}
|
* crossing another curve}
|
||||||
* @see #isTouching()
|
* @see #isTouching()
|
||||||
*/
|
*/
|
||||||
isCrossing: function(_report) {
|
isCrossing: function() {
|
||||||
// Implementation based on work by Andy Finnell:
|
// Implementation based on work by Andy Finnell:
|
||||||
// http://losingfight.com/blog/2011/07/09/how-to-implement-boolean-operations-on-bezier-paths-part-3/
|
// http://losingfight.com/blog/2011/07/09/how-to-implement-boolean-operations-on-bezier-paths-part-3/
|
||||||
// https://bitbucket.org/andyfinnell/vectorboolean
|
// https://bitbucket.org/andyfinnell/vectorboolean
|
||||||
var inter = this._intersection;
|
var inter = this._intersection;
|
||||||
if (!inter)
|
if (!inter)
|
||||||
return false;
|
return false;
|
||||||
// TODO: Make getCurve() and getParameter() sync work in boolean ops
|
var t1 = this.getParameter(),
|
||||||
// before and after splitting!!!
|
t2 = inter.getParameter(),
|
||||||
var t1 = this._parameter,
|
|
||||||
t2 = inter._parameter,
|
|
||||||
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||||
tMax = 1 - tMin;
|
tMax = 1 - tMin;
|
||||||
// If the intersection is in the middle of the path, it is either a
|
// 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.
|
// emerge from switching to 0 and 1 in edge cases.
|
||||||
// NOTE: VectorBoolean has code that slowly shifts these points inwards
|
// NOTE: VectorBoolean has code that slowly shifts these points inwards
|
||||||
// until the resulting tangents are not ambiguous. Do we need this too?
|
// until the resulting tangents are not ambiguous. Do we need this too?
|
||||||
var c2 = this._curve,
|
var c2 = this.getCurve(),
|
||||||
c1 = c2.getPrevious(),
|
c1 = c2.getPrevious(),
|
||||||
c4 = inter._curve,
|
c4 = inter.getCurve(),
|
||||||
c3 = c4.getPrevious(),
|
c3 = c4.getPrevious(),
|
||||||
PI = Math.PI;
|
PI = Math.PI;
|
||||||
if (!c1 || !c3)
|
if (!c1 || !c3)
|
||||||
return false;
|
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) {
|
function isInRange(angle, min, max) {
|
||||||
return min < max
|
return min < max
|
||||||
? angle > min && angle < max
|
? angle > min && angle < max
|
||||||
|
|
|
@ -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
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue