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); SBsp3 *pb = SBsp3::FromMesh(mb);
SMesh br; ZERO(&br); SMesh br; ZERO(&br);
br.flipNormal = true; br.keepCoplanar = false; br.flipNormal = true;
br.keepCoplanar = false;
br.AddAgainstBsp(mb, pa); br.AddAgainstBsp(mb, pa);
br.flipNormal = false; br.keepCoplanar = false;
br.flipNormal = false;
br.keepCoplanar = false;
br.AddAgainstBsp(ma, pb); br.AddAgainstBsp(ma, pb);
dbp("triangles in = %d %d out = %d", ma->l.n, mb->l.n, br.l.n); dbp("triangles in = %d %d out = %d", ma->l.n, mb->l.n, br.l.n);

View File

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