fix: respect angle

This commit is contained in:
2024-03-04 22:15:57 +01:00
parent 830fa22bee
commit 67c1c93fa9

View File

@@ -3,6 +3,7 @@ import {
BufferGeometryLoader, BufferGeometryLoader,
Float32BufferAttribute, Float32BufferAttribute,
Line3, Line3,
MathUtils,
Matrix4, Matrix4,
Plane, Plane,
Vector3 Vector3
@@ -18,7 +19,6 @@ import {
addEventListener('message', (event: MessageEvent<WorkerEvent>) => { addEventListener('message', (event: MessageEvent<WorkerEvent>) => {
if (event.data.type === 'slice') { if (event.data.type === 'slice') {
console.log(event.data.data);
slice(event.data.data); slice(event.data.data);
} }
}); });
@@ -205,7 +205,7 @@ function slice({
if ( if (
h1 && h1 &&
h1.point.z < a.z && h1.point.z < a.z &&
h1.point.clone().sub(a).angleTo(bedNormal) > maxNonPlanarAngle Math.abs(Math.PI / 2 - h1.point.clone().sub(a).angleTo(bedNormal)) > maxNonPlanarAngle
) { ) {
withheldLayer.geometry.push(a.x, a.y, a.z, b.x, b.y, b.z); withheldLayer.geometry.push(a.x, a.y, a.z, b.x, b.y, b.z);
return; return;
@@ -214,7 +214,7 @@ function slice({
if ( if (
h2 && h2 &&
h2.point.z < b.z && h2.point.z < b.z &&
h2.point.clone().sub(b).angleTo(bedNormal) > maxNonPlanarAngle Math.abs(Math.PI / 2 - h2.point.clone().sub(b).angleTo(bedNormal)) > maxNonPlanarAngle
) { ) {
withheldLayer.geometry.push(a.x, a.y, a.z, b.x, b.y, b.z); withheldLayer.geometry.push(a.x, a.y, a.z, b.x, b.y, b.z);
return; return;