Commit Graph

25 Commits (fe75efc6aaec589921dcaa0f44845956f331f2e4)

Author SHA1 Message Date
Jonathan Westhues a5189f7f1a Make step and repeats step the mesh, as well as the entities. This
requires new entitiy types for the faces, by translation or by
axis-angle rotation.

[git-p4: depot-paths = "//depot/solvespace/": change = 1802]
2008-06-21 14:49:57 -08:00
Jonathan Westhues 5a22982e05 Add sweeps. The user specifies a trajectory and a section, in two
separate groups. The section is swept normal to the trajectory,
producing a mesh. I'm doing the triangles only now, not copying
over any entities.

Also fix a bug in the PNG export; rows are 4-aligned, so that was
breaking when the width of the image wasn't divisible by four. Also
fix a bug in lathes, where it generated overlapping triangles for
one segment.

And change the groups to record both "this mesh", the contribution
due to the extrude/lathe/whatever, and the "running mesh", that we
get after applying the requested Boolean op between "this mesh" and
the previous group's "running mesh". I'll use that to make step and
repeats step the mesh too.

[git-p4: depot-paths = "//depot/solvespace/": change = 1801]
2008-06-21 02:18:20 -08:00
Jonathan Westhues e67ea9ca0f Add perspective, by a user-specified factor. So I have to apply
that perspective in the gl matrices, and also everywhere that I
check mouse pointer positions against the model, and for the zoom
to fit.

[git-p4: depot-paths = "//depot/solvespace/": change = 1796]
2008-06-17 11:12:25 -08:00
Jonathan Westhues d471872830 Add reference dimensions, add user-programmable lighting, and add a
configuration screen where all this can be specified.

[git-p4: depot-paths = "//depot/solvespace/": change = 1783]
2008-06-10 20:22:52 -08:00
Jonathan Westhues 71391e6a55 Add an interference check for assembled parts. That's easy once the
BSP stuff works. The failures are reported with red stripes and no
depth buffering, and in a message in the text window.

Also improve convergence of point-on-line constraints, and don't
write triangles to export files with limited precision, because
that was making the coplanar tests fail.

[git-p4: depot-paths = "//depot/solvespace/": change = 1774]
2008-06-03 22:39:32 -08:00
Jonathan Westhues 6748160026 Add selectable faces, by associating an hEntity with the triangle's
metadata. And add point-on-face constraints to go with that. Still
needs some cleanup for the user interface.

[git-p4: depot-paths = "//depot/solvespace/": change = 1766]
2008-06-01 19:31:37 -08:00
Jonathan Westhues 04af0944bc Standardize naming of FromXxx (and XxxFrom) static methods to
create a `new' stack-allocated instance of an object; just From,
possibly different versions with different arg types.

[git-p4: depot-paths = "//depot/solvespace/": change = 1763]
2008-06-01 00:45:11 -08:00
Jonathan Westhues f803806029 Don't initialize the SEdges with ... = { ... }; use a special
function for that.

[git-p4: depot-paths = "//depot/solvespace/": change = 1759]
2008-05-30 00:01:19 -08:00
Jonathan Westhues eb8a43d22b 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]
2008-05-29 23:32:30 -08:00
Jonathan Westhues 69eb2273ac Add color. Now each triangle has metadata, which are preserved in
csg ops; so the union of a red part and a blue part has both red
and blue faces. And some user interface to pick the color in the
text window.

The metadata also include a face, which will be an entity; I can
use that to constrain against. But none of that is yet implemented.

[git-p4: depot-paths = "//depot/solvespace/": change = 1757]
2008-05-29 22:09:41 -08:00
Jonathan Westhues d5a8c431da Oops, Boolean 0 - B was equal to B with the normals flipped, not
zero.

[git-p4: depot-paths = "//depot/solvespace/": change = 1755]
2008-05-28 02:37:54 -08:00
Jonathan Westhues 4375c01c51 Add step and repeat translate, with multiple copies; that all works
nicely. And to do that, I've added the user interface to show an
edit control in the text window.

[git-p4: depot-paths = "//depot/solvespace/": change = 1749]
2008-05-26 22:36:59 -08:00
Jonathan Westhues dd70cb55a2 Make it work when I insert against a NULL bsp3.
[git-p4: depot-paths = "//depot/solvespace/": change = 1747]
2008-05-26 16:34:26 -08:00
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