The rule for when to keep coplanar surfaces was very wrong; fix it.

[git-p4: depot-paths = "//depot/solvespace/": change = 1740]
This commit is contained in:
Jonathan Westhues 2008-05-24 16:37:11 -08:00
parent 0ad8644df4
commit 1909d4c520
2 changed files with 9 additions and 5 deletions

View File

@ -1189,9 +1189,12 @@ void GraphicsWindow::Paint(int w, int h) {
SBsp3 *pb = SBsp3::FromMesh(mb);
SMesh br; ZERO(&br);
br.flipNormal = true; br.keepCoplanar = false;
br.flipNormal = true;
br.keepCoplanar = false;
br.AddAgainstBsp(mb, pa);
br.flipNormal = false; br.keepCoplanar = false;
br.flipNormal = false;
br.keepCoplanar = false;
br.AddAgainstBsp(ma, pb);
dbp("triangles in = %d %d out = %d", ma->l.n, mb->l.n, br.l.n);

View File

@ -104,10 +104,10 @@ void SBsp3::InsertInPlane(bool pos2, STriangle *tr, SMesh *m) {
}
ll = ll->more;
}
if(m->flipNormal && !pos2 && (!onFace || !sameNormal)) {
if(m->flipNormal && ((!pos2 && !onFace) || (onFace && !sameNormal))) {
m->AddTriangle(tr->c, tr->b, tr->a);
} else if(!(m->flipNormal) && (pos2 ||
} else if(!(m->flipNormal) && ((pos2 && !onFace) ||
(onFace && sameNormal && m->keepCoplanar)))
{
m->AddTriangle(tr->a, tr->b, tr->c);
@ -153,6 +153,7 @@ alt:
} else {
// I suppose this actually is allowed to happen, if the coplanar
// face is the leaf, and all of its neighbors are earlier in tree?
dbp("insert in plane");
InsertInPlane(false, tr, instead);
}
} else {