mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-10 02:13:58 +01:00
BREP boolean point on edge corner case(when cutting sketch)
This commit is contained in:
parent
4e784a87a3
commit
1ac7090d91
1 changed files with 23 additions and 1 deletions
|
|
@ -65,6 +65,7 @@ export function BooleanAlgorithm( shell1, shell2, type ) {
|
|||
facesData = facesData.filter(fd => fd.merged !== true);
|
||||
|
||||
for (let faceData of facesData) {
|
||||
fixOppositeEdges(faceData);
|
||||
fixCoincidentEdges(faceData, type === TYPE.UNION)
|
||||
}
|
||||
|
||||
|
|
@ -307,6 +308,27 @@ function areEdgesOpposite(e1, e2) {
|
|||
}
|
||||
|
||||
|
||||
function fixOppositeEdges(faceData) {
|
||||
//corner case there a point on edge ____V____
|
||||
for (let i = 0; i < faceData.newEdges.length; ++i) {
|
||||
const e1 = faceData.newEdges[i];
|
||||
if (e1 == null) continue;
|
||||
for (let j = 0; j < faceData.newEdges.length; ++j) {
|
||||
if (i == j) continue;
|
||||
const e2 = faceData.newEdges[j];
|
||||
if (e2 == null) continue;
|
||||
if (areEdgesOpposite(e1, e2)) {
|
||||
deleteEdge(e1.edge);
|
||||
deleteEdge(e2.edge);
|
||||
faceData.newEdges[i] = null;
|
||||
faceData.newEdges[j] = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
faceData.newEdges = faceData.newEdges.filter(e => e != null);
|
||||
}
|
||||
|
||||
function fixCoincidentEdges(faceData, union) {
|
||||
|
||||
const newEdges = [];
|
||||
|
|
@ -495,7 +517,7 @@ function initSolveData(shell, facesData) {
|
|||
face.data[MY] = solveData;
|
||||
for (let he of face.edges) {
|
||||
EdgeSolveData.clear(he);
|
||||
solveData.vertexToEdge.set(he.vertexA, [he]);
|
||||
addToListInMap(solveData.vertexToEdge, he.vertexA, he);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue