Merge branch 'rel-4.0' into dev-4.0-refactor-mesh

This commit is contained in:
Stewart Allen 2024-08-07 18:08:57 -04:00
commit e44716e5b9

View file

@ -1200,10 +1200,8 @@ class Polygon {
// Machine will travel from "fromPoint" to "nearest point x, y, z' => with z' = point z + rampZ", // Machine will travel from "fromPoint" to "nearest point x, y, z' => with z' = point z + rampZ",
// then start the ease down along path. // then start the ease down along path.
const rampZ = 2.0; const rampZ = 2.0;
while (true) { while (true) {
next = points[index % length]; next = points[index % length];
if (last && next.z < fromZ) { if (last && next.z < fromZ) {
// When "in Ease-Down" (ie. while target Z not yet reached) - follow path while slowly decreasing Z. // When "in Ease-Down" (ie. while target Z not yet reached) - follow path while slowly decreasing Z.
let deltaZ = fromZ - next.z; let deltaZ = fromZ - next.z;
@ -1225,7 +1223,6 @@ class Polygon {
} else if (offset === 0 && next.z < fromZ) { } else if (offset === 0 && next.z < fromZ) {
// First point, move to rampZ height above next. // First point, move to rampZ height above next.
let deltaZ = fromZ - next.z; let deltaZ = fromZ - next.z;
fromZ = next.z + Math.min(deltaZ, rampZ) fromZ = next.z + Math.min(deltaZ, rampZ)
next = next.clone().setZ(fromZ); next = next.clone().setZ(fromZ);
} }
@ -1237,7 +1234,7 @@ class Polygon {
if (touch < 0 && next.z <= targetZ) { if (touch < 0 && next.z <= targetZ) {
// Save touch-down index so as to be able to "complete" the full cut at target Z, // Save touch-down index so as to be able to "complete" the full cut at target Z,
// i.e. keep following the path loop until the touch down point is reached again. // i.e. keep following the path loop until the touch down point is reached again.
touch = ((index - 1) % length); touch = ((index + length) % length);
} }
index++; index++;
} }