Commit Graph

59 Commits (ba8ac7dcd3b19044d3ce3321f8988ffc3b85ac17)

Author SHA1 Message Date
Jonathan Westhues b974a4adeb A big nasty change, originally just to add paste transformed. So it
does that, and adds a scale factor to that transformation (instead
of just mirroring, as before), but also:

    * Replace the "import mirrored" mechanism with a scale factor,
      which if negative corresponds to a reflection as well.

    * Fix self-intersection checker to report a meaningful point
      when edges are collinear.

    * Don't blow an assertion on some types of invalid file;
      instead provide a nice error message to the user.

    * Clear the naked edges before each regen.

    * Don't create zero-length line segments by snapping a line
      segment's end to its beginning.

[git-p4: depot-paths = "//depot/solvespace/": change = 2086]
2009-12-15 04:26:22 -08:00
Jonathan Westhues e7c8d31500 Move code to find outer and inner contours (and which inner
contours go with which outer contour) out of exportstep.cpp, since
I'll need that to do filled contour export for the 2d file formats.

Also add user interface to specify fill color.

[git-p4: depot-paths = "//depot/solvespace/": change = 2057]
2009-10-22 09:16:20 -08:00
Jonathan Westhues 2ca5334bdf Add interpolating splines: both periodic splines (that form a
loop), and open-ended splines, with their tangents specified at
their endpoints.

Also change constraint solver matrix size to 1024, on the theory
that a power of two will generate better array indexing, and
replace fabs() with my own function that for some reason is
faster.

[git-p4: depot-paths = "//depot/solvespace/": change = 2055]
2009-10-20 20:46:01 -08:00
Jonathan Westhues c153e23f49 Add option to mirror imported geometry, including the shell, mesh,
and parametric entities. Also consolidate the text screen functions
to change group options into a single function for everything.

[git-p4: depot-paths = "//depot/solvespace/": change = 2051]
2009-10-09 04:57:10 -08:00
Jonathan Westhues 2e9e0da71f Add ability to relax the constraints, applying only
point-coincident constraints and the entity- or group-generated
constraints. Also fix a bug where a dragged point was not released
when the mouse pointer left the window.

[git-p4: depot-paths = "//depot/solvespace/": change = 2045]
2009-10-01 03:22:56 -08:00
Jonathan Westhues db565438e3 Add text angle for styles. Add ability to quickly change between
perspective and parallel projections. Add a snap grid, for points
and for text comments. Draw text comments in the plane of their
workplane if they have one, otherwise always facing forward.

And fix a few nasty bugs: the possibility of an extremely long
animation onto a workplane, accidental use of the wrong style line
width for constraints, misplaced text box in style screen for
default styles, other little stuff.

[git-p4: depot-paths = "//depot/solvespace/": change = 2037]
2009-09-29 03:35:19 -08:00
Jonathan Westhues 4634961054 Add ability to assign styles to cosmetic text (in the form of
Constraint::COMMENTs), including line width and color, and text
height and origin location.

[git-p4: depot-paths = "//depot/solvespace/": change = 2033]
2009-09-24 07:52:48 -08:00
Jonathan Westhues 517c5edbfa Add user interface to modify styles: change the color, line width,
line width units, on-screen and export visibility. So now we can
use that to modify the default styles, or to create custom styles.

Also add code to draw fat lines, with round endcaps, since gl
doesn't do that.

Next we need some user interface to assign styles to entities, and
to make all the export file formats support the style attributes.

[git-p4: depot-paths = "//depot/solvespace/": change = 2029]
2009-09-18 00:14:15 -08:00
Jonathan Westhues ce99217bbb Move colors and line widths for almost everything to the styles
mechanism. This gets filled in from some defaults, and stored in
the registry. The default styles do not get saved in the file, but
user-created styles (which aren't supported yet) do.

[git-p4: depot-paths = "//depot/solvespace/": change = 2028]
2009-09-16 23:32:36 -08:00
Jonathan Westhues 92da6c665b Change how step and repeat works: now I build the union of all the
steps in thisShell or thisMesh, and then let the Boolean proceed as
usual. If everything works, then this is equivalent. And it's less
code, and it makes stuff like stepping the step and repeat work.

Also begin to work on line/entity/constraint styles, but no real
work yet.

[git-p4: depot-paths = "//depot/solvespace/": change = 2018]
2009-07-19 17:47:59 -08:00
Jonathan Westhues ddf9364257 Add a separate display mesh and edge list; so if we're working with
a mesh than that's a copy, and if we're working with a shell then
it's the shell's triangulation.

[git-p4: depot-paths = "//depot/solvespace/": change = 1957]
2009-05-21 01:06:26 -08:00
Jonathan Westhues bc6bdfade8 Save the exact surfaces in the exported file, and import and
transform them for assembly.

[git-p4: depot-paths = "//depot/solvespace/": change = 1954]
2009-05-18 23:26:38 -08:00
Jonathan Westhues a4dc518a89 A monster change; move the parameter, entity, group, and constraint
tables from SolveSpace to their own class. This is intended to
simplify use of the constraint solver in a library.

[git-p4: depot-paths = "//depot/solvespace/": change = 1942]
2009-04-18 21:53:16 -08:00
Jonathan Westhues 995e9397a8 Tolerate files with \r characters in them; we would never write
such a file, but mailers might mangle them.

[git-p4: depot-paths = "//depot/solvespace/": change = 1891]
2009-01-10 00:18:54 -08:00
Jonathan Westhues bd0e97bad0 Now I can suppress an imported part; so the entities still show up,
but the mesh doesn't get combined. That effectively hides it, good
for looking inside and such.

[git-p4: depot-paths = "//depot/solvespace/": change = 1860]
2008-02-15 03:35:15 -08:00
Jonathan Westhues 7b7d2f92e9 Add code to evaluate the volume of a mesh, thanks to the divergence
theorem; it's evaluated as a surface integral over each triangle.

And don't regenerate the emphasized edges unless we have to;
specifically, don't do it when the only dirty group is the
drawing group.

[git-p4: depot-paths = "//depot/solvespace/": change = 1849]
2008-02-07 01:53:52 -08:00
Jonathan Westhues 304c8f8be9 Add equal-angle constraints. These are implemented by brute force,
as the difference between the cosines of the two angles. All of the
angle stuff generates huge expressions (Expr *), but doesn't seem
noticeably slow.

[git-p4: depot-paths = "//depot/solvespace/": change = 1847]
2008-07-20 04:24:43 -08:00
Jonathan Westhues 88fc69116f Add tangency constraints, for line segments against arcs or cubics.
These are just a convenience, since it would be possible to get the
same result by drawing a construction line.

[git-p4: depot-paths = "//depot/solvespace/": change = 1836]
2008-07-13 04:44:05 -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 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 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 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 3b4aa2c2b2 Little fixes for units display, and change file format to binary
(even though it's still a text file), to avoid CRLF issue.

[git-p4: depot-paths = "//depot/solvespace/": change = 1794]
2008-06-14 15:31:36 -08:00
Jonathan Westhues 28e3f0abab Don't keep a dimension or group's user-entered numerical value as
an Expr *, since that complicates multiple units and also memory
management. Now it's just a double.

[git-p4: depot-paths = "//depot/solvespace/": change = 1791]
2008-06-14 00:43:38 -08:00
Jonathan Westhues b284baffce Treatment of numerical faces was screwy, exporting stuff in numXXX.
So fix that, and now I can simplify what's exported for an entity.

And add an extra measurement (face-face distance/angle), and some
other little stuff.

[git-p4: depot-paths = "//depot/solvespace/": change = 1789]
2008-06-12 20:41:27 -08:00
Jonathan Westhues 9bba9425be Add a special constraint type for comments; no equations, just
user-visible text. And make points hoverable/selectable even when
GW.showPoints is false, and zoom to fit before regenerating on file
open, because then we're at the right zoom level (and will use the
right pwl tolerance).

[git-p4: depot-paths = "//depot/solvespace/": change = 1788]
2008-06-12 00:58:58 -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 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 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 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 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 5bbb27fd8e Now requests don't have names anymore, because that didn't seem
useful. The description string is just the type of request.

[git-p4: depot-paths = "//depot/solvespace/": change = 1770]
2008-06-02 01:41:39 -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 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 709b5ad80e Add an axis-angle transformation (rotation about an arbitrary
point), and use that to implement step and repeat rotating.

[git-p4: depot-paths = "//depot/solvespace/": change = 1762]
2008-06-01 00:29:59 -08:00
Jonathan Westhues 2cb4800fbf Start to describe the selected entities in the text window. Also
more starting work on the selectable faces, and fiddling in an
attempt to remove dependencies when stuff gets deleted.

[git-p4: depot-paths = "//depot/solvespace/": change = 1760]
2008-05-31 16:26:41 -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
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 ecee90965e Change the workplanes a bit. Now the active workplane is per group,
so e.g. a new extrude starts in free space, which is likely what
you want. And default to an in-workplane group, and tweak the
display of workplanes.

[git-p4: depot-paths = "//depot/solvespace/": change = 1748]
2008-05-26 18:22:20 -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 b480613763 Add angle constraints. I'm doing these differently from SketchFlat,
as a constraint on the direction cosine, rather than driving the
dot product against a rotated vector to zero. The drawing is the
ugly part; to do that for skew lines, I gave up.

Also add a function to clear non-existent items on the selection
after solving, since that could have caused an oops().

[git-p4: depot-paths = "//depot/solvespace/": change = 1727]
2008-05-17 03:15:14 -08:00
Jonathan Westhues 749e2a0149 Add double-sided extrudes, and user interface for that. Also put
the coordinate system (x, y, z normal vectors) in the bottom left
corner of the screen at all times, and hide group-created
workplanes except when that group is active, and activate that
workplane when the group is activated.

[git-p4: depot-paths = "//depot/solvespace/": change = 1726]
2008-05-17 00:02:39 -08:00
Jonathan Westhues e2263c69c8 Find a memory corruption! I was getting a pointer into the entity
list, and then adding a new entity to that list, and then looking
at that pointer again. Not okay; the add operation might have
forced a realloc. I have to watch for that.

And add a "distance ratio" constraint, plus a new kind of group
that comes with its own workplane. The workplane is not solved for;
it's generated explicitly in terms of elements that are already
solved.

[git-p4: depot-paths = "//depot/solvespace/": change = 1716]
2008-05-11 02:40:37 -08:00
Jonathan Westhues 6042fb3e0f Add transformed points and normals with a rotation (as well as a
translation; or equivalently, rotation about an arbitrary axis).
Those will be important for step and repeats, and for imported
parts.

Also fix a terrible memory corruption bug: I was freeing the remap
list after I loaded it from the file, but the code that put that
into the SS.group list made only a shallow copy.

[git-p4: depot-paths = "//depot/solvespace/": change = 1715]
2008-05-10 22:09:46 -08:00
Jonathan Westhues e11da119f0 Add point-line distance, point-plane distance, and point-on-circle
constraints. And generate the constraint equations for entities
(e.g., that our unit quaternions have magnitude one). Numerical
troubles there, but it sort of works. Also some stuff to draw
projection lines with projected constraints, and to auto-insert
more constraints as you draw.

[git-p4: depot-paths = "//depot/solvespace/": change = 1711]
2008-05-07 23:30:30 -08:00
Jonathan Westhues 328a946cc4 Add a diameter constraint, and add a `distance' entity that I can
remap when I copy circle entities, in order to make the radius
numerical somehow (analogy with the POINT_ and NORMAL_XFRMD) thing.

[git-p4: depot-paths = "//depot/solvespace/": change = 1710]
2008-05-07 00:19:37 -08:00
Jonathan Westhues 6b264a6ba6 Add a convenience command to draw a rectangle (as four line
segments), add the toggle construction command, and color the lines
differently depending on what group you're in.

Also change dynamic memory stuff to use a Win32 heap for everything
(no malloc), and validate that often. I think I've seen it crash,
though I can't reproduce it.

[git-p4: depot-paths = "//depot/solvespace/": change = 1708]
2008-05-06 20:17:29 -08:00