add better lathe progress reporting

This commit is contained in:
Stewart Allen 2023-02-14 00:15:40 -05:00
commit 3104b7c7dd
2 changed files with 11 additions and 2 deletions

View file

@ -8,6 +8,8 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* more graceful handling of security contexts blocking SharedArrayBuffer * more graceful handling of security contexts blocking SharedArrayBuffer
* CAM add open poly-line offsetting with trace op * CAM add open poly-line offsetting with trace op
* CAM clearly delineate ops reachable or not on timeline * CAM clearly delineate ops reachable or not on timeline
* CAM add 4th axis lathe operation for debug and testing (can be optimized)
- add auto-disable for ops mismatched to axis indexed state
- remove clear top (always on) - remove clear top (always on)
- add z top (like z bottom) - add z top (like z bottom)
- stock always on - stock always on

View file

@ -23,6 +23,12 @@ const POLY = polygons;
const RAD2DEG = 180 / Math.PI; const RAD2DEG = 180 / Math.PI;
const DEG2RAD = Math.PI / 180; const DEG2RAD = Math.PI / 180;
function scale(fn, factor = 1, base = 0) {
return (value, msg) => {
fn(base + value * factor, msg);
}
}
class Topo4 { class Topo4 {
constructor() { } constructor() { }
@ -64,7 +70,7 @@ class Topo4 {
onupdate(0, "lathe"); onupdate(0, "lathe");
const range = this.range = { min: Infinity, max: -Infinity }; const range = this.range = { min: Infinity, max: -Infinity };
const slices = this.sliced = await this.slice(onupdate); const slices = this.sliced = await this.slice(scale(onupdate, 0.25, 0));
for (let slice of slices) { for (let slice of slices) {
range.min = Math.min(range.min, slice.z); range.min = Math.min(range.min, slice.z);
range.max = Math.max(range.max, slice.z); range.max = Math.max(range.max, slice.z);
@ -73,7 +79,7 @@ class Topo4 {
.addPolys(slice.topPolys()); .addPolys(slice.topPolys());
} }
const lathe = await this.lathe(onupdate); const lathe = await this.lathe(scale(onupdate, 0.75, 0.25));
// ondone([...slices, ...lathe]); // ondone([...slices, ...lathe]);
onupdate(1, "lathe"); onupdate(1, "lathe");
@ -289,6 +295,7 @@ class Topo4 {
for (let lines of slices.map(s => s.lines)) { for (let lines of slices.map(s => s.lines)) {
rotatePoints(lines, mrot); rotatePoints(lines, mrot);
} }
onupdate(count / steps);
} }
count = recs[0].heights.length / 3; count = recs[0].heights.length / 3;