properly select dx or dy based on contour type

This commit is contained in:
Stewart Allen 2021-03-04 17:10:39 -05:00
commit d3ed594130

View file

@ -154,8 +154,8 @@
if (curvesOnly && lastP) { if (curvesOnly && lastP) {
// maxangle // maxangle
const dz = Math.abs(lastP.z - z); const dz = Math.abs(lastP.z - z);
const dxy = Math.max(Math.abs(lastP.x - x), Math.abs(lastP.y - y)); const dv = contourX ? Math.abs(lastP.x - x) : Math.abs(lastP.y - y);
const angle = Math.atan2(dz, dxy) * RAD2DEG; const angle = Math.atan2(dz, dv) * RAD2DEG;
// if (lastP.z < 0.1) console.log('pp', {dz, dxy, angle}); // if (lastP.z < 0.1) console.log('pp', {dz, dxy, angle});
if (angle > maxangle) { if (angle > maxangle) {
lastP = newP; lastP = newP;