updates for radial raster
This commit is contained in:
parent
0fa2843fbf
commit
494397706f
1 changed files with 8 additions and 12 deletions
|
|
@ -171,23 +171,21 @@ export class Topo {
|
||||||
}
|
}
|
||||||
let toolData = { positions: toolPos, bounds: toolBounds };
|
let toolData = { positions: toolPos, bounds: toolBounds };
|
||||||
|
|
||||||
console.time('swap XZ vertices');
|
// console.time('swap XZ vertices');
|
||||||
// swap XZ vertices for gpu code
|
// swap XZ vertices for gpu code
|
||||||
for (let i=0; i<vertices.length; i+= 3) {
|
for (let i=0; i<vertices.length; i+= 3) {
|
||||||
let tmp = vertices[i+2];
|
let tmp = vertices[i+2];
|
||||||
vertices[i+2] = vertices[i+0];
|
vertices[i+2] = vertices[i+0];
|
||||||
vertices[i+0] = tmp;
|
vertices[i+0] = tmp;
|
||||||
}
|
}
|
||||||
console.timeEnd('swap XZ vertices');
|
// console.timeEnd('swap XZ vertices');
|
||||||
// let bbox = new THREE.Box3().setFromArray(vertices);
|
|
||||||
// console.log({ bbox, bounds });
|
|
||||||
|
|
||||||
let gpu = await self.get_raster_gpu({
|
let gpu = await self.get_raster_gpu({
|
||||||
mode: "radial",
|
mode: "radial",
|
||||||
resolution,
|
resolution,
|
||||||
rotationStep: angle
|
rotationStep: angle
|
||||||
});
|
});
|
||||||
let tickperstep = Math.round(this.step / resolution);
|
let xStep = Math.max(1, Math.round(this.step / resolution));
|
||||||
let boundsOverride = this.bounds.clone();
|
let boundsOverride = this.bounds.clone();
|
||||||
boundsOverride.min.x += offStart * unit;
|
boundsOverride.min.x += offStart * unit;
|
||||||
boundsOverride.max.x -= offEnd * unit;
|
boundsOverride.max.x -= offEnd * unit;
|
||||||
|
|
@ -195,26 +193,24 @@ export class Topo {
|
||||||
triangles: vertices,
|
triangles: vertices,
|
||||||
boundsOverride
|
boundsOverride
|
||||||
});
|
});
|
||||||
console.log({ terrainData });
|
|
||||||
let output = await gpu.generateToolpaths({
|
let output = await gpu.generateToolpaths({
|
||||||
terrainData,
|
terrainData,
|
||||||
toolData,
|
toolData,
|
||||||
xStep: 1,
|
xStep,
|
||||||
yStep: this.step,
|
yStep: 1,
|
||||||
zFloor: zBottom,
|
zFloor: zBottom,
|
||||||
onProgress(pct) { onupdate(pct/100) }
|
onProgress(pct) { onupdate(pct/100) }
|
||||||
});
|
});
|
||||||
console.log({ output });
|
|
||||||
|
|
||||||
let { numScanlines, pointsPerLine, pathData } = output;
|
let { numScanlines, pointsPerLine, pathData } = output;
|
||||||
let degPerRow = 360 / numScanlines;
|
let degPerRow = 360 / numScanlines;
|
||||||
let slices = this.gpu_slices = [];
|
let slices = this.gpu_slices = [];
|
||||||
let xmult = tickperstep * resolution;
|
let xmult = resolution * xStep;
|
||||||
let xoff = toolData.bounds.min.x;
|
let xoff = output.generationBounds.min.x;
|
||||||
let rows = [];
|
let rows = [];
|
||||||
for (let i=0; i<numScanlines; i++) {
|
for (let i=0; i<numScanlines; i++) {
|
||||||
let lineData = pathData.slice(i * pointsPerLine, i * pointsPerLine + pointsPerLine);
|
let lineData = pathData.slice(i * pointsPerLine, i * pointsPerLine + pointsPerLine);
|
||||||
let points = Array.from(lineData).map((v,j) => newPoint(j * xmult + xoff, 0, v).setA(-i * degPerRow));
|
let points = Array.from(lineData).map((v,j) => newPoint(j * xmult + xoff, 0, v).setA(-i * degPerRow - 90));
|
||||||
rows.push(points);
|
rows.push(points);
|
||||||
}
|
}
|
||||||
if (linear) {
|
if (linear) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue