Commit Graph

33 Commits (7a279c4e3f93a610fd1ff136b1cebfb5a7302542)

Author SHA1 Message Date
Jonathan Westhues d6d198ee40 Add triangulation of surfaces with compound curvature; I just build
a grid of quads, with adaptive spacing. The quads that lie entirely
within the trim polygon are triangulated and knocked out from the
polygon, and then the polygon is triangulated.

That works okay, though rather slow. But there are issues with
surfaces of revolution that touch the axis, since they end up with
a singularity. That will require some thought.

[git-p4: depot-paths = "//depot/solvespace/": change = 1951]
2009-05-08 00:33:04 -08:00
Jonathan Westhues 22afc5ea15 The hidden line removal unnecessarily splits our edges, which
bloats the output file size. So reassemble the edges whenever
possible.

[git-p4: depot-paths = "//depot/solvespace/": change = 1935]
2009-04-07 20:54:07 -08:00
Jonathan Westhues acadc0a918 Many changes:
* Rewrite surface handles in curves, so that Booleans beyond
      the first don't screw up.

    * If an intersection curve is identical to an existing curve
      (as happens when faces are coincident), take the piecewise
      linearization of the existing curve; this stops us from
      screwing up when different shells are pwl'd at different
      chord tols.

    * Hook up the plane faces again.

    * Remove coincident (parallel or anti-parallel) edges from the
      coincident-face edge lists when doing Booleans; those may
      happen if two faces are coincident with ours.

    * Miscellaneous bugfixes.

It doesn't seem to screw up very much now, although tangent edges
(and insufficient pwl resolution) may still cause problems.

[git-p4: depot-paths = "//depot/solvespace/": change = 1929]
2009-03-15 15:04:45 -08:00
Jonathan Westhues 9ade574d36 Fix triangulation issues when a polygon has more than two edges at
a vertex.

[git-p4: depot-paths = "//depot/solvespace/": change = 1916]
2009-02-18 03:15:33 -08:00
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 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 36870360cb Little stuff: show polygon assembly errors only for draw-in-plane
groups, rename "drawing" groups to "sketch" groups, and keep
assembling even after finding an open curve.

[git-p4: depot-paths = "//depot/solvespace/": change = 1835]
2008-07-13 01:57:46 -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 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 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 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 64c7a4e61b Fix bugs: problem drag-rotating normals with the mouse, a failure
to save our registry stuff (because we were calling exit() instead
of doing a PostQuitMessage()), and a misclassification of triangles
coplanar with the test surface, when the test surface contained
zero-area triangles.

[git-p4: depot-paths = "//depot/solvespace/": change = 1773]
2008-06-03 10:48:47 -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 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 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 3cdbbb83b1 If a deletion makes it impossible to define other elements of the
sketch (e.g., a line whose length is constrained gets deleted, but
the constraint is left behind; or the point that's the origin for a
drawing group in plane gets deleted), then deleted the dependencies
too.

[git-p4: depot-paths = "//depot/solvespace/": change = 1725]
2008-05-16 22:04:55 -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