Commit Graph

41 Commits (715a554637fa8b136e251a793d46485b27a84a5d)

Author SHA1 Message Date
Jonathan Westhues 07ddd62a3a Preparatory work for Boolean. Make the u and v coordinates of the
trim curves for all surfaces lie between 0 and 1. And add routines
to merge the curves and surfaces from two shells into one, and to
split the trim curves into their piecewise linear segments and then
reassemble them into trim curves.

[git-p4: depot-paths = "//depot/solvespace/": change = 1905]
2009-01-25 03:52:29 -08:00
Jonathan Westhues 2e4ec6dd04 Add sin and cos to the expression entry (for dimensions etc.), with
the same precedence as sqrt. Add the code to find naked edges, and
draw them highlighted on the model. And make the direction of trim
curves consistent, always ccw with normal toward viewer; so there's
no need to fix the directions before triangulating.

[git-p4: depot-paths = "//depot/solvespace/": change = 1903]
2009-01-25 01:19:59 -08:00
Jonathan Westhues bb4b767e99 Tear everything apart, moving away from meshes and toward shells.
Add stubs for functions to perform Booleans, and get rid of mesh
stuff, including the kd tree accelerated snap to vertex (which
should not be required if the shell triangulation performs as it
should).

Also check that a sketch is not self-intersecting before extruding
it or whatever. This is dead slow, needs n*log(n) implementation.

[git-p4: depot-paths = "//depot/solvespace/": change = 1902]
2009-01-22 19:30:30 -08:00
Jonathan Westhues 6d7954e167 Fix an issue with edge intersection testing: if a vertex from edge
A touches edge B, but does not share a vertex with edge B, then
that's an intersection.

Adjust the ear clipping so that it generates strip-like
triangulations, not fan-like.

And rearrange deck chairs on the bridge-finding code, which is
still pathetically slow. It may not be possible to get reasonable
performance without kd tree type acceleration.

[git-p4: depot-paths = "//depot/solvespace/": change = 1901]
2009-01-22 02:02:46 -08:00
Jonathan Westhues 7cf3a06274 A very rough set of routines to triangulate by ear clipping. This
is O(n^2), not perfectly robust, and the bridge-finding code is
particularly bad. But it works, triangulates, and shouldn't ever
generate zero-area triangles like gl does.

[git-p4: depot-paths = "//depot/solvespace/": change = 1900]
2009-01-20 21:04:38 -08:00
Jonathan Westhues ebca6130ec Early attempts at rational polynomial surfaces. I can create one
from an extrusion, with piecewise linear trim curves for everything
(that are shared, so that they appear only once for the two
surfaces that each trims). No Boolean operations on them, and the
triangulation is bad, because gl seems to merge collinear edges.

So before going further, I seem to need my own triangulation code.
I have not had great luck in the past, but I can't live without it
now.

[git-p4: depot-paths = "//depot/solvespace/": change = 1899]
2009-01-19 02:37:10 -08:00
Jonathan Westhues 0e623c90c0 Generate the group's polygon from the exact curves, not from edges;
so now we've got the exact curve loops, with their direction
standardized so that we can tell which direction is out. We still
need the polygon in any case, since that's a convenient way to find
each curve's winding number.

And remove some more leftover code from mesh sweeps.

[git-p4: depot-paths = "//depot/solvespace/": change = 1897]
2009-01-18 19:33:15 -08:00
Jonathan Westhues ef11978d2c Add menu item to center view at a point; and move non-ID list data
structure from polygon.h into dsc.h, since it is used outside the
polygon/mesh code.

[git-p4: depot-paths = "//depot/solvespace/": change = 1892]
2009-01-12 22:56:05 -08:00
Jonathan Westhues 962cb1af4a Add cutter radius compensation. That's a bolt on thing at the end;
just applies an offset to the DXF before exporting. Useful enough
to be worth the ugliness, though.

This is the stupid routines from SketchFlat, slightly reworked.

[git-p4: depot-paths = "//depot/solvespace/": change = 1866]
2008-08-14 00:28:25 -08:00
Jonathan Westhues b2f2f90a27 Add DXF export. The complexity comes from all the different ways to
specify the plane from which we want to grab the triangles. Shared
edges are then removed with the same code used to check for
watertight meshes, and the remaining edges are assembled into
polygons.

[git-p4: depot-paths = "//depot/solvespace/": change = 1823]
2008-07-07 22:30:13 -08:00
Jonathan Westhues cad77c9c47 Add routines to remove T intersections from the mesh, which are
introduced by the bsp routines. It's usually, though not always,
possible to generate a watertight mesh. The occasions where it's
not look ugly, floating point issues, no quick fix.

And use those to generate a list of edges where two different faces
meet, which I can emphasize for cosmetic reasons (and some UI to
specify whether to do that, and with what color).

And make the right mouse button rotate the model, since that was
previously doing nothing.

[git-p4: depot-paths = "//depot/solvespace/": change = 1821]
2008-07-05 23:56:24 -08:00
Jonathan Westhues 8a70efed05 Make sliver triangle tests work on the minimum altitude, not on
area.

[git-p4: depot-paths = "//depot/solvespace/": change = 1816]
2008-07-01 20:32:24 -08:00
Jonathan Westhues b77cb053e2 Move `Solve Once Now' to the Edit menu, and call it `Regenerate';
and fix some other problems with the menu labels.

[git-p4: depot-paths = "//depot/solvespace/": change = 1815]
2008-06-30 01:34:03 -08:00
Jonathan Westhues a47a77c37c Back to opengl's tesselator for triangulation. I'll spend more time
writing mine later.

[git-p4: depot-paths = "//depot/solvespace/": change = 1810]
2008-06-25 23:28:29 -08:00
Jonathan Westhues 9b008ad1cd Check in a broken triangulation code (by stupid ear clipping),
which I will shortly revert. gl does a much better job, and I'll
have to spend more time to get something reasonable.

[git-p4: depot-paths = "//depot/solvespace/": change = 1809]
2008-06-25 23:25:42 -08:00
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 b5c87291ea Fix failure to solve when auto-constraining new arc, and make all
paths absolute immediately.

[git-p4: depot-paths = "//depot/solvespace/": change = 1795]
2008-06-16 00:35:05 -08:00
Jonathan Westhues 8969687904 Bits and pieces; option to not include original in step translates
and rotates, auto-constrain translates in active workplane, speed
up remap list search with a hash table, other stuff.

[git-p4: depot-paths = "//depot/solvespace/": change = 1786]
2008-06-11 20:36:33 -08:00
Jonathan Westhues 8498a99588 Add preliminary lathe (solid of revolution) support. I'm generating
just the mesh, no derived entities (but I suppose that I could turn
all points into circles).

And fix some bugs where equations didn't get unique IDs, and make
it possible to lock on to the group's workplane automatically, if
you press W while free in 3d with no workplane selected.

[git-p4: depot-paths = "//depot/solvespace/": change = 1780]
2008-06-06 03:35:28 -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 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 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 010a65894d Now I can rename groups, using that same edit control in the text
window.

[git-p4: depot-paths = "//depot/solvespace/": change = 1750]
2008-05-27 01:52:36 -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 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 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 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 7c4d305895 Add polygon triangulation, by cheating. I'm using the gl tesselator
for that, and storing the triangles instead of rendering them
immediately. Not sure if that's smart; in theory could change from
implementation to implementation, but the results look much better
than I would get myself.

[git-p4: depot-paths = "//depot/solvespace/": change = 1733]
2008-05-22 02:28:28 -08:00
Jonathan Westhues e80328279e Rip out the boundary rep csg stuff. I'll redo that with a triangle
mesh approach.

[git-p4: depot-paths = "//depot/solvespace/": change = 1732]
2008-05-20 19:58:14 -08:00
Jonathan Westhues c4e1270e25 Add constructive solid geometry ops. These work to some extent, but
not very well; I'm doing a b-rep, where the boundaries are complex
polygons, and there's too many special cases. I should probably
replace this with a triangle mesh solution.

[git-p4: depot-paths = "//depot/solvespace/": change = 1731]
2008-05-19 01:23:49 -08:00
Jonathan Westhues 2ec23ffa3e Fix point-on-circle constraints to work with arcs too, and lock
extrudes normal to workplane if a workplane is active when the
extrusion is created.

[git-p4: depot-paths = "//depot/solvespace/": change = 1724]
2008-05-15 22:34:06 -08:00
Jonathan Westhues 4eed7693be Little changes, more pwls in a circle, and make "same orientation"
constraints work mod 180 degrees, so that it snaps to however the
workplane was drawn (more vertical vs. more horizontal).

[git-p4: depot-paths = "//depot/solvespace/": change = 1714]
2008-05-10 18:57:47 -08:00
Jonathan Westhues d048946adc Fix some stupid bugs introduced with the new representation of
workplanes. And fix up our polygon normals, so that everything gets
shaded correctly (and so that later we can generate our STL files
with correct normals).

[git-p4: depot-paths = "//depot/solvespace/": change = 1706]
2008-05-05 01:47:23 -08:00
Jonathan Westhues 30636a6f29 Make the extrude command do a bit more; now I generate all the
faces of the polyhedron. And shade the faces when I draw them, and
fix up our projection matrix so that the depth testing works
properly.

[git-p4: depot-paths = "//depot/solvespace/": change = 1703]
2008-05-02 02:54:22 -08:00
Jonathan Westhues a7cec38656 Add code to assemble the piecewise linear segments in a group into
a polygon, and to fill that polygon.

[git-p4: depot-paths = "//depot/solvespace/": change = 1686]
2008-04-24 23:04:09 -08:00
Jonathan Westhues 1331457928 Rough file/save for SolveSpace; that's all done from a single
table, relatively small code size. No user interface for it,
though.

[git-p4: depot-paths = "//depot/solvespace/": change = 1685]
2008-04-23 22:22:16 -08:00
Jonathan Westhues a8001adf33 Add horizontal and vertical constraints. Those have their own 2d/3d
issues, when the points are not all in the same coordinate system.
All painful, of course. Also add continuous line drawing, and
auto-constraining of line segments as I draw.

[git-p4: depot-paths = "//depot/solvespace/": change = 1683]
2008-04-22 23:29:19 -08:00