Skip to content

Commit

Permalink
Try linked up intersections first before switching to the other inter…
Browse files Browse the repository at this point in the history
…secetion.
  • Loading branch information
lehni committed Oct 3, 2015
1 parent 632eb25 commit 7496a7c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/path/PathItem.Boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,19 +591,19 @@ PathItem.inject(new function() {
|| (!strict || isValid(seg, true))
&& isValid(next, !strict && inter._overlap))
? inter
// If it's no match, check the other intersection first, then
// carry on with the next linked intersection.
: !ignoreOther
// We need to get the intersection on the segment, not
// on inter, since multiple solutions are only linked up
// as a chain through _next there. But do not check that
// intersection in the first call to getIntersection()
// (prev == null), since we'd go straight back to the
// originating segment.
&& (prev || seg._intersection !== inter._intersection)
&& getIntersection(strict, seg._intersection, inter, true)
|| inter._next !== prev // Prevent circular loops
&& getIntersection(strict, inter._next, inter, false);
// If it's no match, check the next linked intersection first,
// otherwise carry on with the 'other' intersection location.
: inter._next !== prev // Prevent circular loops
&& getIntersection(strict, inter._next, inter, false)
// We need to get the intersection on the segment, not
// on inter, since multiple solutions are only linked up
// as a chain through _next there. But do not check that
// intersection in the first call to getIntersection()
// (prev == null), since we'd go straight back to the
// originating segment.
|| !ignoreOther
&& (prev || seg._intersection !== inter._intersection)
&& getIntersection(strict, seg._intersection, inter, true);
}
for (var i = 0, l = segments.length; i < l; i++) {
var seg = segments[i],
Expand Down

4 comments on commit 7496a7c

@iconexperience
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lehni Here comes the first result of my new quantification tool. The last two commits causes a drop in error messages by almost 40%. Very nice.

@lehni
Copy link
Member Author

@lehni lehni commented on 7496a7c Oct 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bingo! : )

@lehni
Copy link
Member Author

@lehni lehni commented on 7496a7c Oct 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check the difference in drops between the two commits also? I think the previous one should probably have fixed more than this one here.

@iconexperience
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my test the number of glitches (46) and errors (2 x Maximum call stack size exceeded) has not changed with this commit, so the improvement was made by the previous change.

I am planning to create a detailed report on the recent commits, but this will not happen before tonight or even tomorrow.

Please sign in to comment.