some cam slicer debugging

This commit is contained in:
Stewart Allen 2023-02-25 23:26:57 -05:00
commit 54395c17d5
2 changed files with 10 additions and 4 deletions

View file

@ -353,7 +353,7 @@ CAM.traces = async function(settings, widget, single) {
}
}
} else
base.polygons.flatten(data.tops,null,true).forEach(poly => {
base.polygons.flatten(data.tops).forEach(poly => {
poly.inner = null;
poly.parent = null;
let z = poly.getZ();
@ -366,6 +366,7 @@ CAM.traces = async function(settings, widget, single) {
}
// do not add duplicates
if (traces[i].isEquivalent(poly) && dz < 0.1) {
// console.log({ dup: poly });
return;
}
}

View file

@ -80,6 +80,10 @@ class Slicer {
p2 = newPoint(0,0,0),
p3 = newPoint(0,0,0);
// for (let i = 0, il = points.length; i < il; ) {
// points[i] = points[i++].toFixed(5);
// }
for (let i = 0, il = points.length; i < il; ) {
p1.set(points[i++], points[i++], points[i++]);
p2.set(points[i++], points[i++], points[i++]);
@ -185,8 +189,8 @@ class Slicer {
let zmax = Math.max(p1.z, p2.z, p3.z);
for (let bucket of buckets) {
const { zs, index } = bucket;
const min = zs[0];
const max = zs.last();
const min = Math.min(...zs);
const max = Math.max(...zs);
if (zmin < min && zmax < min) {
continue;
}
@ -199,7 +203,7 @@ class Slicer {
end("create buckets");
}
// console.log({ zs, zlen, count, step, buckets });
// console.log({ zs, zlen, count, step, buckets, flatoff });
begin("slicing");
const { minions } = kiri;
@ -326,6 +330,7 @@ class Slicer {
}
if (dedup) {
// console.log({ z, dedup: lines, points });
lines = sliceDedup(lines, debug);
}