Fix stupidity in the triangle simplification; I didn't handle the
case where you bolt a triangle onto a convex poly, and both remaining edges of the tri are coincident with the neighbours from the poly. That was a big source of zero-area triangles. And tweak some colors a bit. [git-p4: depot-paths = "//depot/solvespace/": change = 1758]
This commit is contained in:
parent
69eb2273ac
commit
eb8a43d22b
14
mesh.cpp
14
mesh.cpp
|
@ -69,7 +69,7 @@ void SMesh::Simplify(int start) {
|
|||
for(i = start; i < l.n; i++) {
|
||||
STriangle *tr = &(l.elem[i]);
|
||||
if((tr->Normal()).Magnitude() < LENGTH_EPS*LENGTH_EPS) {
|
||||
tr->tag = 1;
|
||||
tr->tag = 0;
|
||||
} else {
|
||||
tr->tag = 0;
|
||||
}
|
||||
|
@ -128,8 +128,14 @@ void SMesh::Simplify(int start) {
|
|||
|
||||
bDot /= min(ab.Magnitude(), bc.Magnitude());
|
||||
dDot /= min(cd.Magnitude(), de.Magnitude());
|
||||
|
||||
if(fabs(bDot) < LENGTH_EPS && dDot > 0) {
|
||||
|
||||
if(fabs(bDot) < LENGTH_EPS && fabs(dDot) < LENGTH_EPS) {
|
||||
conv[WRAP((j+1), convc)] = c;
|
||||
// and remove the vertex at j, which is a dup
|
||||
memmove(conv+j, conv+j+1,
|
||||
(convc - j - 1)*sizeof(conv[0]));
|
||||
convc--;
|
||||
} else if(fabs(bDot) < LENGTH_EPS && dDot > 0) {
|
||||
conv[j] = c;
|
||||
} else if(fabs(dDot) < LENGTH_EPS && bDot > 0) {
|
||||
conv[WRAP((j+1), convc)] = c;
|
||||
|
@ -161,7 +167,7 @@ void SMesh::Simplify(int start) {
|
|||
double bDot = (ab.Cross(bc)).Dot(n);
|
||||
bDot /= min(ab.Magnitude(), bc.Magnitude());
|
||||
|
||||
if(bDot < 0) return;
|
||||
if(bDot < 0) oops();
|
||||
}
|
||||
|
||||
for(i = 0; i < convc - 2; i++) {
|
||||
|
|
|
@ -79,7 +79,7 @@ void Group::MenuGroup(int id) {
|
|||
case GraphicsWindow::MNU_GROUP_EXTRUDE:
|
||||
g.type = EXTRUDE;
|
||||
g.opA = SS.GW.activeGroup;
|
||||
g.color = RGB(150, 150, 150);
|
||||
g.color = RGB(100, 100, 100);
|
||||
g.wrkpl.entityB = SS.GW.ActiveWorkplane();
|
||||
g.subtype = ONE_SIDED;
|
||||
g.name.strcpy("extrude");
|
||||
|
|
|
@ -72,6 +72,10 @@ void PaintGraphics(void);
|
|||
SDWORD GetMilliseconds(void);
|
||||
|
||||
void dbp(char *str, ...);
|
||||
#define DBPTRI(tri) \
|
||||
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
|
||||
CO((tri).a), CO((tri).b), CO((tri).c))
|
||||
|
||||
void Error(char *str, ...);
|
||||
|
||||
void *AllocTemporary(int n);
|
||||
|
|
|
@ -29,7 +29,7 @@ void TextWindow::Init(void) {
|
|||
modelColor[1] = RGB(100, 100, 100);
|
||||
modelColor[2] = RGB( 30, 30, 30);
|
||||
modelColor[3] = RGB(150, 0, 0);
|
||||
modelColor[4] = RGB( 0, 150, 0);
|
||||
modelColor[4] = RGB( 0, 100, 0);
|
||||
modelColor[5] = RGB( 0, 80, 80);
|
||||
modelColor[6] = RGB( 0, 0, 150);
|
||||
modelColor[7] = RGB( 80, 0, 80);
|
||||
|
|
Loading…
Reference in New Issue
Block a user