Commit Graph

102 Commits (775653a75dc8318c948eafed4dd8593c4b61242d)

Author SHA1 Message Date
Jonathan Westhues 775653a75d Add beginnings of exact curve export. We take the trim curves in
our specified section plane; we then split them according to the
start and endpoints of each STrimBy, using de Castejau's algorithm.
These sections get projected (possibly in perspective, which I do
correctly) into 2d and exported.

Except, for now they just get pwl'd in the export files. That's the
fallback, since it works for any file format. But that's the place
to add special cases for circles etc., or to export them exactly.
DXF supports the latter, but very painfully since I would need to
write a later-versioned file, which requires thousands of lines of
baggage. I'll probably stick with arcs.

[git-p4: depot-paths = "//depot/solvespace/": change = 1936]
2009-04-13 20:19:23 -08:00
Jonathan Westhues 7f3dd91bd9 Add a special case for line-cylinder intersection, solving in
closed form. This is a fairly good speedup, and handles tangency
well.

But that shows that tangency has other problems; need to classify
edges correctly (whether they point to a coincident surface) in
curved surfaces too. I need to tweak SShell::ClassifyPoint().

[git-p4: depot-paths = "//depot/solvespace/": change = 1933]
2009-03-19 09:40:11 -08:00
Jonathan Westhues d4b842a242 Generate additional edges wherever a front- and back-facing
triangle join. And add controls to show and hide the solid model
edges (independently of the shaded mesh), and to suppress the
shaded triangles from SVG/EPS output.

[git-p4: depot-paths = "//depot/solvespace/": change = 1932]
2009-03-17 20:26:04 -08:00
Jonathan Westhues 1a845c3432 Add hidden line and surface removal, and vector shaded surface
export. So I calculate lighting for each triangle in the mesh, make
a BSP, and then traverse it in-order and output those as SVG or
EPS. And I test edges against the mesh, removing those portions of
the edge that overlap a triangle in front of them (using the
kd-tree to accelerate).

[git-p4: depot-paths = "//depot/solvespace/": change = 1931]
2009-03-17 08:33:46 -08:00
Jonathan Westhues bc70089dd0 Add code to subdivide (with de Castljau's algorithm) a surface, and
use that for surface-line intersections. That has major problems
with the heuristic on when to stop and do Newton polishing.

There's also an issue with all the Newton stuff when surfaces join
tangent.

And update the wishlist to reflect current needs.

[git-p4: depot-paths = "//depot/solvespace/": change = 1925]
2009-03-08 02:59:57 -08:00
Jonathan Westhues 77cace05ce When clipping ears to triangulate a curved surface, clip the ear
that minimizes the chord tolerance.

[git-p4: depot-paths = "//depot/solvespace/": change = 1921]
2009-02-27 06:05:08 -08:00
Jonathan Westhues 90842131ff Make Boolean union work when the shells have coincident plane
faces. Still on planes only, no curved surface intersections.

[git-p4: depot-paths = "//depot/solvespace/": change = 1912]
2009-02-09 04:40:48 -08:00
Jonathan Westhues 95bded27ee Add eps, hpgl, and svg output (simple, all just for polylines). And
fix convergence tolerance so that points projected into a rational
polynomial surface end up much closer than LENGTH_EPS.

[git-p4: depot-paths = "//depot/solvespace/": change = 1906]
2009-01-26 21:48:40 -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 25ed4e1ef1 SPolyCurve (i.e., polynomial curve) vs. SPolygon got too confusing;
let's call those Beziers instead.

[git-p4: depot-paths = "//depot/solvespace/": change = 1898]
2009-01-18 19:51:00 -08:00
Jonathan Westhues f904c0fbee Entities now generate rational polynomial curves instead of
piecwise linear segments. These are piecewise linear approximated
for display, and currently for the mesh too, but that's the first
step to replace the mesh with exact curved surfaces.

[git-p4: depot-paths = "//depot/solvespace/": change = 1895]
2009-01-14 19:55:42 -08:00
Jonathan Westhues b8da4ed2b3 Split export DXF command into export section and export view, and
add framework for additional vector output formats (ps, pdf).

[git-p4: depot-paths = "//depot/solvespace/": change = 1893]
2009-01-13 21:10:42 -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 8d656bc600 Add feature to find the degrees of freedom; strike the
corresponding to each param from the Jacobian, and see if it loses
rank. If it does then that one was important, so it's bound. Then
display a big blue square around its point until the next normal
solve.

[git-p4: depot-paths = "//depot/solvespace/": change = 1887]
2009-01-04 04:01:46 -08:00
Jonathan Westhues 0a56a63417 Add a trim command. I can now do circles (or arcs) against lines,
or lines against lines. The constraints get rather screwed up
afterwards, of course.

So make arcs with the endpoints coincident into circles, instead
of nothings; since the first split of a circle produces that.

And don't warn after deleting just point-coincident or horiz/vert
constraints as a dependency; that's just a nuisance, because it
happens too often.

[git-p4: depot-paths = "//depot/solvespace/": change = 1884]
2009-01-03 04:27:33 -08:00
Jonathan Westhues 0f228fc0fb Add a toolbar. This requires a tool to convert my PNG icons to
tables in the code, which I have written in perl and am checking
in.

Also get WM_MOUSELEAVE events from win32, so that I can de-hover
everything when the mouse leaves the graphics window. And fix one
of the icons, which was 23x24 instead of 24x24.

[git-p4: depot-paths = "//depot/solvespace/": change = 1883]
2009-01-02 02:38:36 -08:00
Jonathan Westhues 92f55dd195 Speed up the inconsistent constraint detection; there's no reason
not to solve by substitution before rank testing. And report the
unsatisfied constraints when we don't converge.

[git-p4: depot-paths = "//depot/solvespace/": change = 1874]
2008-09-05 03:25:53 -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 96f5663d6e Add a configuration option to hide the back faces; that gets rid of
stray red pixels sometimes, if the mesh is leaky or the graphics
card isn't perfect.

[git-p4: depot-paths = "//depot/solvespace/": change = 1864]
2008-08-11 02:56:08 -08:00
Jonathan Westhues c42033d123 Add a configuration item to specify the maximum number of piecewise
linear segments to generate, irrespective of the chord tolerance.
That used to be hard-coded, and it needs to be small enough to
avoid lags while working interactively, but I also need to export
fine geometry.

[git-p4: depot-paths = "//depot/solvespace/": change = 1857]
2008-02-12 05:00:26 -08:00
Jonathan Westhues 0c10efdab6 Add a simple license key: I take the CRC of the license info, plus
some magic numbers. This would be trivial to break, but still more
difficult than patching the binary to skip the check...

[git-p4: depot-paths = "//depot/solvespace/": change = 1853]
2008-02-09 05:52:01 -08:00
Jonathan Westhues 8fe910da4d Add feature to trace a point; so I can show the path that a
linkage traces out, and export the coordinates.

[git-p4: depot-paths = "//depot/solvespace/": change = 1846]
2008-07-20 03:27:22 -08:00
Jonathan Westhues f70bbb3e7f This BSP split and simplify thing is stupid, but a hard-coded limit
on the number of pieces that we know how to reassemble is even
stupider. Now dynamically allocated.

[git-p4: depot-paths = "//depot/solvespace/": change = 1837]
2008-07-13 04:58:52 -08:00
Jonathan Westhues 7622534b2a Make the piecewise linear stuff for cubics and quadratics adaptive,
based on a chord tolerance. And rewrite the pwl circles to work
against a chord tolerance too (which they really were doing before,
but in funny units).

Also make "assemble" combine type do a union after interference
checking; was previously just copying, which meant that coplanar
faces could break subsequent operations.

And make right-clicking effectively toggle shift key, instead of
forcing it on; so you can pan or rotate with either right or middle
button.

[git-p4: depot-paths = "//depot/solvespace/": change = 1829]
2008-07-09 21:26:08 -08:00
Jonathan Westhues 4c42f329cd Show the open filename in the title bar of the graphics window.
[git-p4: depot-paths = "//depot/solvespace/": change = 1826]
2008-07-08 00:02:22 -08:00
Jonathan Westhues 72d188619d Add a scale factor when exporting; the user specifies a number, and
all coordinates are divided by that number as we export.

And add functions to store a float in the registry. I'm using those
for the scale factor, and also to replace the crazy scaled integers
that I was using for light positions etc. before.

[git-p4: depot-paths = "//depot/solvespace/": change = 1824]
2008-07-07 23:41:29 -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 b4a9ac993c Add export of the mesh as an STL file. That's trivial.
[git-p4: depot-paths = "//depot/solvespace/": change = 1822]
2008-07-06 01:24:31 -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 1bc68779d9 Test the rank of the Jacobian by Gram-Schmidt, instead of by a
questionable tolerance on the pivot while row reducing.

[git-p4: depot-paths = "//depot/solvespace/": change = 1818]
2008-07-02 00:18:25 -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 273339d5c4 Add TrueType font support to SolveSpace. This uses a modified
version of the code from SketchFlat, with all arbitrary limits
removed.

The TTF text is its own entity, and that entity includes the
font file basename and the text. That's an extra 128 bytes in the
entity, which is around a 50% increase, kind of a shame. It was
simple, though.

[git-p4: depot-paths = "//depot/solvespace/": change = 1814]
2008-06-30 01:09:17 -08:00
Jonathan Westhues a31782e1ea If any equations are soluble in a single variable, then handle them
separately, even before doing the rank test. In some cases, that's
a huge speedup.

[git-p4: depot-paths = "//depot/solvespace/": change = 1811]
2008-06-26 01:34:26 -08:00
Jonathan Westhues 12942a74cf Add logic to remember imported files' relative filenames, and use
that to try to find them if we can't find them by absolute path.
This is intended to make everything still work if you copy an
entire directory tree of files that import each other.

Also add a mechanism to not paint the scene if we're not sure it's
consistent; otherwise got some crashes on startup. And disable both
text and graphic window when displaying a modal dialog, wasn't
doing that always.

[git-p4: depot-paths = "//depot/solvespace/": change = 1808]
2008-06-24 21:14:49 -08:00
Jonathan Westhues 3ddd1703b1 Add helical sweeps. These aren't as parametric as I would have
liked, but my more parametric attempts were very difficult to use.
The pitch (both axial and radial) gets specified by typing a
distance in a textbox.

[git-p4: depot-paths = "//depot/solvespace/": change = 1804]
2008-06-23 00:25:17 -08:00
Jonathan Westhues ae566f0380 Link against libpng and zlib, and use that to export graphics;
basically just a screenshot, get the image from the framebuffer.

[git-p4: depot-paths = "//depot/solvespace/": change = 1797]
2008-06-18 00:35:14 -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 d391c43bff Now display dimensions (and stuff in the text window) in the
user-selected units, and enter them the same way.

[git-p4: depot-paths = "//depot/solvespace/": change = 1792]
2008-06-14 01:51:25 -08:00
Jonathan Westhues 650e9db150 Add more measurement information about the selection. And remove
menu items for some features that I suppose I won't add, and fix
some bugs.

[git-p4: depot-paths = "//depot/solvespace/": change = 1787]
2008-06-11 23:31:41 -08:00
Jonathan Westhues f8636eaddf The lights are directional, so call those triples directions, not
positions.

[git-p4: depot-paths = "//depot/solvespace/": change = 1784]
2008-06-10 20:30:18 -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 48612bde3d Add undo/redo. This saves the param guesses, constraints, groups,
and requests to a separate list. It's messy, because I have to make
a deep copy (e.g. of the remap list for the groups, or Expr *
stuff) of some things. Others (e.g. the polygon or mesh) will be
regenerated, so they should be discarded, but they must not get
double-freed.

In any case, works superficially. And fix a few memory leaks
unrelated to this, and remove some dead code.

[git-p4: depot-paths = "//depot/solvespace/": change = 1775]
2008-06-04 02:22:30 -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 ea6db67c7d Improve convergence of constraints involving parallel vectors, by
using the initial numerical guess of whichever vector is already
known to choose our projection planes.

And add a mechanism to defer showing the text window or
regenerating, in order to simplify dependencies on valid actives.
Also yes/no/cancel when about to abandon an unsaved file, and a
bugfix when rotating a rot/trans point.

[git-p4: depot-paths = "//depot/solvespace/": change = 1772]
2008-06-03 10:28:41 -08:00
Jonathan Westhues 7d4a4fbb76 We now have selective solve; a group (and all the groups afterward)
becomes dirty when the user makes a change, and only the dirty
groups get solved. That's a huge effective speedup.

Also add delete function for groups. That has an interesting issue;
it actually ends up recursing on GenerateAll(), since GenerateAll()
calls ClearSuper(), ClearSuper() might need to recreate a group (if
all the groups were deleted), and that would activate the group,
which calls GenerateAll. The right solution is probably a deferred
execution mechanism, where you can schedule something to happen
before we go idle, but not do it right now.

[git-p4: depot-paths = "//depot/solvespace/": change = 1771]
2008-06-02 03:43:27 -08:00
Jonathan Westhues 236ee16da6 Consolidate the code that determines whether an entity is visible
in one place. And remove the ability to disable the solver, since
that's unlikely to be anything but confusing (and in any case, was
badly implemented). This is in preparation for selective solving,
of only the dirty groups.

[git-p4: depot-paths = "//depot/solvespace/": change = 1769]
2008-06-02 01:31:26 -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 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 4bd44bf18a Initial work on the assembly (`import') feature. I can import a
part, including all of its entities and the triangle mesh. These
are transformed by a rotation and translation, and appear in the
sketch; the transformation may be set with constraints.

[git-p4: depot-paths = "//depot/solvespace/": change = 1756]
2008-05-29 02:10:12 -08:00