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