wire up basic slicing visualization

This commit is contained in:
Stewart Allen 2022-01-26 23:13:50 -05:00
commit 96f50d36a7
5 changed files with 52 additions and 47 deletions

View file

@ -158,7 +158,21 @@ mesh.model = class MeshModel extends mesh.object {
matrix: this.matrix,
id: this.id
}).then(data => {
console.log({rebuild: this.od, data});
console.log({rebuild: this.id, data});
let points = [];
for (let arr of data) {
arr.push(arr[0]);
for (let i=0; i<arr.length-1; i++) {
let p1 = arr[i];
let p2 = arr[i+1];
points.push(new THREE.Vector3().fromArray(p1));
points.push(new THREE.Vector3().fromArray(p2));
}
}
let material = new THREE.LineBasicMaterial( { color: 0xdddddd } );
let geometry = new THREE.BufferGeometry().setFromPoints(points);
let line = new THREE.LineSegments(geometry, material);
space.scene.add(line);
});
}