add tool move epsilon to reduce false positive collisions

This commit is contained in:
Stewart Allen 2026-03-06 16:12:29 -05:00
commit 581df0e84f
3 changed files with 12 additions and 4 deletions

View file

@ -1756,7 +1756,9 @@ function edgeKey(a, b) {
const mesh = new THREE.Mesh(built.render, this._material.clone());
mesh.userData.solidId = id;
mesh.userData.solid = true;
const edgesGeom = new THREE.EdgesGeometry(built.render, SOLID_CREASE_ANGLE_DEG);
// Derive visible hard edges from indexed manifold topology, not the
// creased render geometry, to avoid triangle/split seam artifacts.
const edgesGeom = new THREE.EdgesGeometry(built.indexed, SOLID_CREASE_ANGLE_DEG);
const edges = new THREE.LineSegments(edgesGeom, this._edgeMaterial.clone());
edges.userData.solidId = id;
edges.userData.solidEdge = true;
@ -1807,7 +1809,7 @@ function edgeKey(a, b) {
const built = buildSolidGeometry(meshData);
view.mesh.geometry = built.render;
view.indexedGeometry = built.indexed;
view.edges.geometry = new THREE.EdgesGeometry(built.render, SOLID_CREASE_ANGLE_DEG);
view.edges.geometry = new THREE.EdgesGeometry(built.indexed, SOLID_CREASE_ANGLE_DEG);
}
// Build selectable face regions from the same geometry used for ray hits.
// This keeps surface-region hover/selection aligned with rendered shading.

View file

@ -278,6 +278,8 @@ async function rebuildGeneratedSolidsFromSnapshot(snapshot, options = {}) {
const operation = ['new', 'add', 'subtract'].includes(String(params.operation || 'new'))
? String(params.operation || 'new')
: 'new';
// Symmetric is a single extrusion whose local span is shifted to
// [-depth/2, +depth/2], not two opposing extrusions/union.
const localZShift = symmetric ? (-depth / 2) : (direction === 'reverse' ? -depth : 0);
const createdBodyIds = [];
const bySketch = new Map();