add tool move epsilon to reduce false positive collisions
This commit is contained in:
parent
2f1c57e0ae
commit
581df0e84f
3 changed files with 12 additions and 4 deletions
|
|
@ -138,6 +138,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
toolType,
|
toolType,
|
||||||
toolDiam,
|
toolDiam,
|
||||||
toolDiamMove,
|
toolDiamMove,
|
||||||
|
toolDiamEpsilon,
|
||||||
travelBounds,
|
travelBounds,
|
||||||
spindle = 0,
|
spindle = 0,
|
||||||
spindleMax = device.spindleMax,
|
spindleMax = device.spindleMax,
|
||||||
|
|
@ -211,6 +212,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
toolType = tool.getType();
|
toolType = tool.getType();
|
||||||
toolDiam = tool.fluteDiameter();
|
toolDiam = tool.fluteDiameter();
|
||||||
toolDiamMove = (tool.hasTaper() ? tolerance ?? toolDiam : toolDiam) * 2;
|
toolDiamMove = (tool.hasTaper() ? tolerance ?? toolDiam : toolDiam) * 2;
|
||||||
|
toolDiamEpsilon = toolDiam * 0.01,
|
||||||
lastTool = toolID;
|
lastTool = toolID;
|
||||||
}
|
}
|
||||||
feedRate = Math.min(camFastFeed, feed || feedRate || plunge);
|
feedRate = Math.min(camFastFeed, feed || feedRate || plunge);
|
||||||
|
|
@ -593,9 +595,11 @@ export async function prepare_one(widget, settings, print, firstPoint, update) {
|
||||||
if (lastTravelBounds) check.push(...lastTravelBounds);
|
if (lastTravelBounds) check.push(...lastTravelBounds);
|
||||||
let from = toWidgetCoords(printPoint);
|
let from = toWidgetCoords(printPoint);
|
||||||
let to = toWidgetCoords(point);
|
let to = toWidgetCoords(point);
|
||||||
|
let ep = toolDiamEpsilon;
|
||||||
for (let poly of check) {
|
for (let poly of check) {
|
||||||
let ints = poly.intersections(from, to);
|
let ints = poly.intersections(from, to) ?? [];
|
||||||
if (ints.length) {
|
let far = ints.filter(p => p.distTo2D(to) > ep && p.distTo2D(from) > ep);
|
||||||
|
if (far.length) {
|
||||||
if (debug) console.log({ ints, poly, deltaXY, deltaZ });
|
if (debug) console.log({ ints, poly, deltaXY, deltaZ });
|
||||||
upAndOver = "bounds";
|
upAndOver = "bounds";
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1756,7 +1756,9 @@ function edgeKey(a, b) {
|
||||||
const mesh = new THREE.Mesh(built.render, this._material.clone());
|
const mesh = new THREE.Mesh(built.render, this._material.clone());
|
||||||
mesh.userData.solidId = id;
|
mesh.userData.solidId = id;
|
||||||
mesh.userData.solid = true;
|
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());
|
const edges = new THREE.LineSegments(edgesGeom, this._edgeMaterial.clone());
|
||||||
edges.userData.solidId = id;
|
edges.userData.solidId = id;
|
||||||
edges.userData.solidEdge = true;
|
edges.userData.solidEdge = true;
|
||||||
|
|
@ -1807,7 +1809,7 @@ function edgeKey(a, b) {
|
||||||
const built = buildSolidGeometry(meshData);
|
const built = buildSolidGeometry(meshData);
|
||||||
view.mesh.geometry = built.render;
|
view.mesh.geometry = built.render;
|
||||||
view.indexedGeometry = built.indexed;
|
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.
|
// Build selectable face regions from the same geometry used for ray hits.
|
||||||
// This keeps surface-region hover/selection aligned with rendered shading.
|
// This keeps surface-region hover/selection aligned with rendered shading.
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,8 @@ async function rebuildGeneratedSolidsFromSnapshot(snapshot, options = {}) {
|
||||||
const operation = ['new', 'add', 'subtract'].includes(String(params.operation || 'new'))
|
const operation = ['new', 'add', 'subtract'].includes(String(params.operation || 'new'))
|
||||||
? String(params.operation || 'new')
|
? String(params.operation || 'new')
|
||||||
: '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 localZShift = symmetric ? (-depth / 2) : (direction === 'reverse' ? -depth : 0);
|
||||||
const createdBodyIds = [];
|
const createdBodyIds = [];
|
||||||
const bySketch = new Map();
|
const bySketch = new Map();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue