From ec574248c5dfaba0c363484b25e34dd77c5fd33f Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 3 Jan 2021 19:11:28 -0500 Subject: [PATCH] fix shadow skip logic bug (filter vs map) and added vertex threshold --- notes.md | 1 + src/kiri/codec.js | 2 +- src/mode/cam/ops.js | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/notes.md b/notes.md index 8aa1c7c7..b748c0f0 100644 --- a/notes.md +++ b/notes.md @@ -59,6 +59,7 @@ * `B` outside cutting direction in roughing mode inverted * `B` on rotation, tabs dissociate from parts whose center changes with rotation +* `F` new registration style: offset cutout * `F` z thru should apply to any thru hole * `F` update analyzer to detect overhangs * `F` add linear clearing strategy option for roughing / pocket diff --git a/src/kiri/codec.js b/src/kiri/codec.js index ba724d72..af2bd088 100644 --- a/src/kiri/codec.js +++ b/src/kiri/codec.js @@ -116,7 +116,7 @@ track = v.track || undefined, widget = KIRI.newWidget(id, KIRI.Widget.Groups.forid(group)); widget.loadVertices(v.json ? v.geo.toFloat32() : v.geo); - widget.saved = time(); + widget.saved = Date.now(); if (track && track.pos) { widget.track = track; widget.move(track.pos.x, track.pos.y, track.pos.z, true); diff --git a/src/mode/cam/ops.js b/src/mode/cam/ops.js index 8e515dd8..db42031b 100644 --- a/src/mode/cam/ops.js +++ b/src/mode/cam/ops.js @@ -925,11 +925,11 @@ slice(progress) { let state = this.state; - let { ops, slicer } = state; + let { ops, slicer, widget } = state; let real = ops.map(rec => rec.op).filter(op => op); - let rough = real.map(op => op.type === 'rough').length > 0; - let outlineIn = real.map(op => op.type === 'outline' && op.inside).length > 0; + let rough = real.filter(op => op.type === 'rough').length > 0; + let outlineIn = real.filter(op => op.type === 'outline' && op.inside).length > 0; let minStepDown = real .map(op => (op.down || 3) / 3) @@ -938,10 +938,10 @@ let tslices = []; let tshadow = []; let tzindex = slicer.interval(minStepDown, { fit: true, off: 0.01, down: true, flats: true }); - let skipTerrain = !(rough || outlineIn) && tzindex.length > 50; + let skipTerrain = !(rough || outlineIn) && (tzindex.length > 50 || widget.vertices.length > 1000000); if (skipTerrain) { - console.log("skipping terrain generation for speed"); + console.log("skipping terrain generation"); tzindex = [ tzindex.pop() ]; }