topo4 fixups
This commit is contained in:
parent
65dd539149
commit
4496f1dc78
3 changed files with 18 additions and 10 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import { CamOp } from './op.js';
|
import { CamOp } from './op.js';
|
||||||
import { Tool } from './tool.js';
|
import { Tool } from './tool.js';
|
||||||
|
import { Topo4 } from './topo4.js';
|
||||||
import { newPoint } from '../../../geo/point.js';
|
import { newPoint } from '../../../geo/point.js';
|
||||||
|
|
||||||
function createFilter(op) {
|
function createFilter(op) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { codec } from '../../core/codec.js';
|
||||||
import { newPoint } from '../../../geo/point.js';
|
import { newPoint } from '../../../geo/point.js';
|
||||||
import { newPolygon } from '../../../geo/polygon.js';
|
import { newPolygon } from '../../../geo/polygon.js';
|
||||||
import { sliceConnect } from '../../../geo/slicer.js';
|
import { sliceConnect } from '../../../geo/slicer.js';
|
||||||
|
import { newSlice } from '../../core/slice.js';
|
||||||
import { Tool } from './tool.js';
|
import { Tool } from './tool.js';
|
||||||
import { Slicer as topo_slicer } from './slicer_topo.js';
|
import { Slicer as topo_slicer } from './slicer_topo.js';
|
||||||
|
|
||||||
|
|
@ -16,7 +17,7 @@ function scale(fn, factor = 1, base = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Topo4 {
|
class Topo {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
async generate(opt = {}) {
|
async generate(opt = {}) {
|
||||||
|
|
@ -132,7 +133,8 @@ class Topo4 {
|
||||||
slices.push(slice);
|
slices.push(slice);
|
||||||
// console.log({ shards, range, step, slices });
|
// console.log({ shards, range, step, slices });
|
||||||
|
|
||||||
if (kiri.minions.running > 1) {
|
const { minions } = self.kiri_worker;
|
||||||
|
if (minions?.running > 1) {
|
||||||
return await this.sliceMinions(onupdate);
|
return await this.sliceMinions(onupdate);
|
||||||
} else {
|
} else {
|
||||||
return await this.sliceWorker(onupdate);
|
return await this.sliceWorker(onupdate);
|
||||||
|
|
@ -202,7 +204,8 @@ class Topo4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
async lathe(onupdate) {
|
async lathe(onupdate) {
|
||||||
if (kiri.minions.running > 1) {
|
const { minions } = self.kiri_worker;
|
||||||
|
if (minions?.running > 1) {
|
||||||
return await this.latheMinions(onupdate);
|
return await this.latheMinions(onupdate);
|
||||||
} else {
|
} else {
|
||||||
return await this.latheWorker(onupdate);
|
return await this.latheWorker(onupdate);
|
||||||
|
|
@ -444,24 +447,27 @@ class Topo4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
putCache(key, data) {
|
putCache(key, data) {
|
||||||
kiri.worker.putCache({ key, data }, { done: data => { } });
|
const { dispatch } = self.kiri_worker;
|
||||||
|
dispatch.putCache({ key, data }, { done: data => { } });
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache() {
|
clearCache() {
|
||||||
kiri.worker.clearCache({}, { done: data => { } });
|
const { dispatch } = self.kiri_worker;
|
||||||
|
dispatch.clearCache({}, { done: data => { } });
|
||||||
}
|
}
|
||||||
|
|
||||||
queue(cmd, params) {
|
queue(cmd, params) {
|
||||||
|
const { minions } = self.kiri_worker;
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
kiri.minions.queue({ cmd, ...params }, resolve);
|
minions.queue({ cmd, ...params }, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rotatePoints(lines, rot) {
|
export function rotatePoints(lines, rot) {
|
||||||
new THREE.BufferAttribute(lines, 3).applyMatrix4(rot);
|
new THREE.BufferAttribute(lines, 3).applyMatrix4(rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Topo4(opt) {
|
export function Topo4(opt) {
|
||||||
return new Topo4().generate(opt);
|
return new Topo().generate(opt);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,11 @@ import { codec, encode, encodePointArray } from '../core/codec.js';
|
||||||
import { doTopShells } from '../mode/fdm/post.js';
|
import { doTopShells } from '../mode/fdm/post.js';
|
||||||
import { newPoint } from '../../geo/point.js';
|
import { newPoint } from '../../geo/point.js';
|
||||||
import { polygons as POLY } from '../../geo/polygons.js';
|
import { polygons as POLY } from '../../geo/polygons.js';
|
||||||
import { sliceZ } from '../../geo/slicer.js';
|
import { sliceZ, sliceConnect } from '../../geo/slicer.js';
|
||||||
import { Slicer as cam_slicer } from '../mode/cam/slicer.js';
|
import { Slicer as cam_slicer } from '../mode/cam/slicer.js';
|
||||||
import { Slicer as topo_slicer } from '../mode/cam/slicer_topo.js';
|
import { Slicer as topo_slicer } from '../mode/cam/slicer_topo.js';
|
||||||
import { Probe, Trace, raster_slice } from '../mode/cam/topo3.js';
|
import { Probe, Trace, raster_slice } from '../mode/cam/topo3.js';
|
||||||
|
import { Topo4, rotatePoints } from '../mode/cam/topo4.js';
|
||||||
import { wasm_ctrl } from '../../geo/wasm.js';
|
import { wasm_ctrl } from '../../geo/wasm.js';
|
||||||
|
|
||||||
const clib = self.ClipperLib;
|
const clib = self.ClipperLib;
|
||||||
|
|
@ -271,7 +272,7 @@ const funcs = self.minion = {
|
||||||
topo4_slice(data, seq) {
|
topo4_slice(data, seq) {
|
||||||
const { slice, resolution } = data;
|
const { slice, resolution } = data;
|
||||||
const vertices = cache.vertices;
|
const vertices = cache.vertices;
|
||||||
const recs = new kiri.topo_slicer(slice.index)
|
const recs = new topo_slicer(slice.index)
|
||||||
.setFromArray(vertices, slice)
|
.setFromArray(vertices, slice)
|
||||||
.slice(resolution)
|
.slice(resolution)
|
||||||
.map(rec => {
|
.map(rec => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue