fix registration depth for anchor and widget / stock deltas

This commit is contained in:
Stewart Allen 2021-01-30 19:48:18 -05:00
commit e06ad5e421
2 changed files with 9 additions and 4 deletions

View file

@ -544,6 +544,7 @@
} }
let areas = (poppedRec.areas[widget.id] || []); let areas = (poppedRec.areas[widget.id] || []);
let stack = new KIRI.Stack(widget.mesh); let stack = new KIRI.Stack(widget.mesh);
// console.log({match: areas, for: widget.id});
widget.trace_stack = stack; widget.trace_stack = stack;
widget.traces.forEach(poly => { widget.traces.forEach(poly => {
let match = areas.filter(arr => poly.matches(arr)); let match = areas.filter(arr => poly.matches(arr));

View file

@ -907,6 +907,7 @@
updateToolDiams(tool.fluteDiameter()); updateToolDiams(tool.fluteDiameter());
let { stock } = settings, let { stock } = settings,
tz = widget.track.pos.z,
lx = bounds.min.x, lx = bounds.min.x,
hx = bounds.max.x, hx = bounds.max.x,
ly = bounds.min.y, ly = bounds.min.y,
@ -918,7 +919,10 @@
dx = (stock.x - (hx - lx)) / 4, dx = (stock.x - (hx - lx)) / 4,
dy = (stock.y - (hy - ly)) / 4, dy = (stock.y - (hy - ly)) / 4,
dz = stock.z, dz = stock.z,
points = []; points = [],
wo = stock.z - bounds.max.z,
z1 = bounds.max.z + wo + tz,
z2 = tz - mz;
if (!(stock.x && stock.y && stock.z)) { if (!(stock.x && stock.y && stock.z)) {
return; return;
@ -972,7 +976,7 @@
tv = -tv; tv = -tv;
} }
} }
for (let z of BASE.util.lerp(zMax, -zThru, op.down)) { for (let z of BASE.util.lerp(z1, z2, op.down)) {
let slice = newSlice(z); let slice = newSlice(z);
sliceAll.push(slice); sliceAll.push(slice);
sliceOut.push(slice); sliceOut.push(slice);
@ -1008,8 +1012,8 @@
let slice = newSlice(0,null), polys = []; let slice = newSlice(0,null), polys = [];
points.forEach(point => { points.forEach(point => {
polys.push(newPolygon() polys.push(newPolygon()
.append(point.clone().setZ(bounds.max.z)) .append(point.clone().setZ(z1))
.append(point.clone().setZ(bounds.max.z - stock.z - mz))); .append(point.clone().setZ(z2)));
}); });
slice.camLines = polys; slice.camLines = polys;
slice.output() slice.output()