Commit Graph

12 Commits (b484c2649393041add20e71e010ff60a0a5f6fb8)

Author SHA1 Message Date
Jonathan Westhues 727ac126fb Some ugly hacks; discard zero-area triangles, randomize the
triangle list before adding to the BSP, and check if a point in
plane lies in multiple triangles and choose the one with the
biggest normal magnitude (i.e., area) when testing normal
direction.

[git-p4: depot-paths = "//depot/solvespace/": change = 1745]
2008-05-25 22:23:05 -08:00
Jonathan Westhues d750344653 Even if one vertex is collinear, the other one could be reflex;
triangle merging code was screwing up.

[git-p4: depot-paths = "//depot/solvespace/": change = 1744]
2008-05-25 20:27:34 -08:00
Jonathan Westhues c58dbf1676 When a triangle gets split when it's added, retriangulate in an
effort to reduce the number of pieces.

[git-p4: depot-paths = "//depot/solvespace/": change = 1743]
2008-05-25 19:39:45 -08:00
Jonathan Westhues 05b50e0af8 Various tweaks, including a numerical improvement, to make the
epsilon in the csg stuff meaningfully apply everywhere to the
length.

[git-p4: depot-paths = "//depot/solvespace/": change = 1742]
2008-05-25 06:36:03 -08:00
Jonathan Westhues 248f74547e Add user interface to specify union/difference for extrudes, and
implement that. Also make solver work only between the first and
last visible group; earlier can just work from previous solve
result, and later don't matter.

There's some issues with the csg code; it will eventually produce
an open mesh, which is very bad. Not sure whether that's a logic
bug, or a numerical issue; still generating absurd triangles pretty
routinely.

[git-p4: depot-paths = "//depot/solvespace/": change = 1741]
2008-05-25 05:11:44 -08:00
Jonathan Westhues 1909d4c520 The rule for when to keep coplanar surfaces was very wrong; fix it.
[git-p4: depot-paths = "//depot/solvespace/": change = 1740]
2008-05-24 16:37:11 -08:00
Jonathan Westhues 0ad8644df4 As we break things against the BSP, keep an arbitrary convex
polygon, not just triangles. This helps to avoid needless
splitting. Also test if an entire triangle got inserted in multiple
pieces; if yes, back things out, and just insert the triangle.

Also remove the extra partition stuff, since it didn't seem to help
consistently, and this does.

Still could do some better merging, in the case where an inserted
triangle does not get fully inserted, but we can find a better
triangulation than what the BSP naturally gives.

[git-p4: depot-paths = "//depot/solvespace/": change = 1739]
2008-05-24 15:10:00 -08:00
Jonathan Westhues 097d0ddfa9 Add a workaround for OpenGL, which likes to tesselate with
zero-area triangles, apparently. And make the number of line
segments used to approximate a triangle depend on its scale on
screen.

[git-p4: depot-paths = "//depot/solvespace/": change = 1738]
2008-05-24 05:23:25 -08:00
Jonathan Westhues 70ccbebc8f Add extra split planes (not coplanar with any triangle) to the BSP
while building it. That may improve performance, by building a more
balanced tree and actually reducing splitting. Not dramatic
improvements, though; half the triangles for some parts, but no
change or slightly worse for others.

[git-p4: depot-paths = "//depot/solvespace/": change = 1737]
2008-05-24 04:23:25 -08:00
Jonathan Westhues 4d7ffc85f9 Make coplanar faces work properly, by implementing a 2d BSP on each
set of coplanar faces. The polygon count still gets stupid fast;
I'm thinking I can fix that by adding some extra test planes at the
top of the 3d BSP, to quickly cull out stuff that doesn't intersect
us.

[git-p4: depot-paths = "//depot/solvespace/": change = 1736]
2008-05-24 02:34:06 -08:00
Jonathan Westhues de46118324 Add code to extrude a triangle mesh, and to perform Boolean ops on
a triangle mesh in a BSP. That works, although it splits too often,
the initial triangulations are not good quality, and coplanar faces
are not yet handled. I'll do the coplanar thing tomorrow.

[git-p4: depot-paths = "//depot/solvespace/": change = 1735]
2008-05-23 02:05:07 -08:00
Jonathan Westhues c079497762 And add mesh.cpp, which I had forgotten.
[git-p4: depot-paths = "//depot/solvespace/": change = 1734]
2008-05-22 02:28:50 -08:00