Skip to content

Commit

Permalink
fix contour(carpet) rounded off edgpath constraints contour bug
Browse files Browse the repository at this point in the history
++ update incorrect baselines added two commits ago.
  • Loading branch information
etpinard committed Aug 2, 2019
1 parent 0fe878f commit 6ba77c6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/traces/contour/close_boundaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ module.exports = function(pathinfo, contours) {
}
break;
case '<':
if(contoursValue < boundaryMin) {
if(contoursValue < boundaryMin ||
(!pi0.edgepaths.length && pi0.starts.length && contoursValue === boundaryMin)) {
pi0.prefixBoundary = true;
}
break;
case '[]':
v1 = Math.min(contoursValue[0], contoursValue[1]);
v2 = Math.max(contoursValue[0], contoursValue[1]);
if(v2 < boundaryMin || v1 > boundaryMax) {
if(v2 < boundaryMin || v1 > boundaryMax ||
(!pi0.edgepaths.length && pi0.starts.length && v2 === boundaryMin)) {
pi0.prefixBoundary = true;
}
break;
Expand Down
14 changes: 12 additions & 2 deletions src/traces/contour/convert_to_constraints.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ module.exports = function(pathinfo, operation) {
for(i = 0; i < pi0.paths.length; i++) {
pi0.paths[i] = op0(pi0.paths[i]);
}
for(i = 0; i < pi0.starts.length; i++) {
pi0.starts[i] = op0(pi0.starts[i]);
}

return pathinfo;
case '][':
Expand All @@ -65,24 +68,31 @@ module.exports = function(pathinfo, operation) {
for(i = 0; i < pi0.edgepaths.length; i++) {
pi0.edgepaths[i] = op0(pi0.edgepaths[i]);
}

for(i = 0; i < pi0.paths.length; i++) {
pi0.paths[i] = op0(pi0.paths[i]);
}
for(i = 0; i < pi0.starts.length; i++) {
pi0.starts[i] = op0(pi0.starts[i]);
}

while(pi1.edgepaths.length) {
pi0.edgepaths.push(op1(pi1.edgepaths.shift()));
}
while(pi1.paths.length) {
pi0.paths.push(op1(pi1.paths.shift()));
}
while(pi1.starts.length) {
pi0.starts.push(op1(pi1.starts.shift()));
}

return [pi0];
}
};

function copyPathinfo(pi) {
return Lib.extendFlat({}, pi, {
edgepaths: Lib.extendDeep([], pi.edgepaths),
paths: Lib.extendDeep([], pi.paths)
paths: Lib.extendDeep([], pi.paths),
starts: Lib.extendDeep([], pi.starts)
});
}
Binary file modified test/image/baselines/carpet_rounded-off-edgepath-lt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/carpet_rounded-off-edgepath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/contour_constraints_edge_cases.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ba77c6

Please sign in to comment.