fix stitching open case
This commit is contained in:
parent
e97eb9ad1d
commit
7d5f5f934a
2 changed files with 20 additions and 3 deletions
|
|
@ -185,6 +185,10 @@
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getXYZ(v) {
|
||||||
|
return {x: vertices[v], y: vertices[v+1], z: vertices[v+2]};
|
||||||
|
}
|
||||||
|
|
||||||
for (let i=0, l=this.faces.length; i<l; i += 3) {
|
for (let i=0, l=this.faces.length; i<l; i += 3) {
|
||||||
let v1 = faces[i];
|
let v1 = faces[i];
|
||||||
let v2 = faces[i+1];
|
let v2 = faces[i+1];
|
||||||
|
|
@ -265,7 +269,7 @@
|
||||||
}
|
}
|
||||||
let nuloop;
|
let nuloop;
|
||||||
if (l1[0].touches(l2[0])) {
|
if (l1[0].touches(l2[0])) {
|
||||||
nuloop = [...l1, ...l2.reverse()];
|
nuloop = [...l2.reverse(), ...l1];
|
||||||
} else if (l1[0].touches(l2.last())) {
|
} else if (l1[0].touches(l2.last())) {
|
||||||
nuloop = [...l2, ...l1];
|
nuloop = [...l2, ...l1];
|
||||||
} else if (l1.last().touches(l2[0])) {
|
} else if (l1.last().touches(l2[0])) {
|
||||||
|
|
@ -284,7 +288,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loops = loops = loops.filter(l => l && l.length > 2);
|
this.loops = loops = loops.filter(l => l && l.length > 2);
|
||||||
console.log({loops});
|
// console.log({
|
||||||
|
// loops,
|
||||||
|
// ends: loops.map(loop => {
|
||||||
|
// return [loop[0], loop.last()];
|
||||||
|
// }),
|
||||||
|
// coor: loops.map(loop => {
|
||||||
|
// return [
|
||||||
|
// getXYZ(loop[0].v1),
|
||||||
|
// getXYZ(loop[0].v2),
|
||||||
|
// getXYZ(loop.last().v2),
|
||||||
|
// getXYZ(loop.last().v1)
|
||||||
|
// ];
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
|
||||||
// progressive boundary run algorithm
|
// progressive boundary run algorithm
|
||||||
function emitLoop1(loop) {
|
function emitLoop1(loop) {
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO.heal = function(debug) {
|
PRO.heal = function(debug) {
|
||||||
let mesh = this.debugMesh(undefined);
|
let mesh = this.debugMesh();
|
||||||
mesh.heal();
|
mesh.heal();
|
||||||
if (debug) {
|
if (debug) {
|
||||||
let verts = mesh.vertices;
|
let verts = mesh.vertices;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue