Some debug code fixes and improvements.

This commit is contained in:
Jürg Lehni 2015-08-23 21:34:41 +02:00
parent 85d21c84b8
commit 92ec09f451

View file

@ -402,7 +402,7 @@ PathItem.inject(new function() {
var segmentOffset = {};
function labelSegment(seg, text, color) {
var textAngle = 45;
var textAngle = 30;
var point = seg.point;
var key = Math.round(point.x * 1000) + ',' + Math.round(point.y * 1000);
var offset = segmentOffset[key] || 0;
@ -430,7 +430,7 @@ PathItem.inject(new function() {
labelSegment(seg, (segmentCount++) + '/' + index + ': ' + text
+ ' v: ' + !!seg._visited
+ ' op: ' + operator(seg._winding)
+ ' o: ' + (inter ? inter._overlap : 0)
+ ' o: ' + (inter ? inter._overlap || 0 : 0)
+ ' w: ' + seg._winding
, color);
}
@ -441,7 +441,7 @@ PathItem.inject(new function() {
var inter = seg._intersection;
labelSegment(seg, i
+ ' i: ' + !!inter
+ ' o: ' + (inter ? inter._overlap : 0)
+ ' o: ' + (inter ? inter._overlap || 0 : 0)
+ ' w: ' + seg._winding
, 'green');
}
@ -495,6 +495,7 @@ PathItem.inject(new function() {
w4 = t1.cross(t4);
var signature = (w3 * w4).toPrecision(1) + ' (' + w3.toPrecision(1) + ' * ' + w4.toPrecision(1) + ')';
var overlap = inter._overlap;
var oldDir = dir;
if (overlap) {
// Switch to the overlapping intersection segment.
if (firstOverlap && overlap === 1) {