Commit Graph

92 Commits (0e623c90c05431c48c51c33b0f9fe8f49d83183d)

Author SHA1 Message Date
Jonathan Westhues 6031c99bec Scale columns of the Jacobian before least squares solving; this
lets me reweight the parameters, e.g. to encourage the solver to
make changes to the point being dragged.

[git-p4: depot-paths = "//depot/solvespace/": change = 1719]
2008-05-12 18:35:31 -08:00
Jonathan Westhues f4d2651031 Get rid of assumptions, which always did cause trouble. Instead,
solve the Newton's method iterations in a least squares sense. This
is much less likely to result in numerical disaster; a parameter
will never make a very large change, unless that really is the only
way to satisfy the constraints.

[git-p4: depot-paths = "//depot/solvespace/": change = 1717]
2008-05-11 23:29:50 -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 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 c05659753a Add the substitution solver. That speeds things up a bit, and
improves the quality of assumptions.

[git-p4: depot-paths = "//depot/solvespace/": change = 1709]
2008-05-06 23:10:20 -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
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 853c6cb59c A big change, to add a concept of normals. These are "oriented
vectors", represented by unit quaternions. This permits me to add
circles, where the normal defines the plane of the circle.

Still many things painful. The interface for editing normals is not
so intuitive, and it's not yet clear how I would e.g. export a
circle entity and recreate it properly, since that entity has a
param not associated with a normal or point.

And the transformed points/normals do not yet support rotations.
That will be necessary soon.

[git-p4: depot-paths = "//depot/solvespace/": change = 1705]
2008-05-04 22:18:01 -08:00
Jonathan Westhues f1c5d07e39 Sort the parameters by sensitivity before solving, and always sort
the point that's being dragged first, to guarantee that that one
gets the max possible degrees of freedom. The sort code (sort a
list of integers, then apply the permutations by swaps) was more
painful than it should have been.

[git-p4: depot-paths = "//depot/solvespace/": change = 1700]
2008-04-30 22:25:38 -08:00
Jonathan Westhues 498ffd07ea Add symmetric and at midpoint constraints. The symmetry constraint
turned out straightforward, in great part because the planes are
workplanes (6 DOF, represented by a unit quaternion and a point),
and therefore make it easy to get a vector in the plane, as well as
a normal.

And on that subject, replace the previous hack for parallel vector
constraints with a better hack: pivot on the initial numerical
guess, to choose which components of the cross product to drive to
zero. Ugly, but I think that will be as robust as I can get.

[git-p4: depot-paths = "//depot/solvespace/": change = 1699]
2008-04-30 00:14:32 -08:00
Jonathan Westhues 01cff278bd Include the remap lists (when we copy entities, that we used to
assign the new ids) in the saved file, and split the file load from
table stuff into its own function.

[git-p4: depot-paths = "//depot/solvespace/": change = 1694]
2008-04-27 02:01:23 -08:00
Jonathan Westhues 49ec1346d7 Add the first `derived' group, that generates entities based on
other entities. This requires a new point type, for a point that's
defined as a transformation of some other point. All works nicely,
I think. There's ugliness because entities are no longer guaranteed
to have a parent request.

Also speed up display of the text window, by caching brushes
instead of recreating for each character (!), and add a bit more
user interface in the text window.

[git-p4: depot-paths = "//depot/solvespace/": change = 1692]
2008-04-27 01:03:01 -08:00
Jonathan Westhues bfc7109e0c Standardize the behaviour of constraints, by assigning them a
workplane: a free constraint works in three-space (e.g. true
distance), and a constraint in a workplane works in that plane
(e.g. projected distance). And make the solver go automatically,
though solver itself has lots of pieces missing.

[git-p4: depot-paths = "//depot/solvespace/": change = 1691]
2008-04-26 21:00:12 -08:00
Jonathan Westhues 15476d4732 A great renaming. 2d coordinate systems are now called workplanes,
and the associated entities are now just points.

[git-p4: depot-paths = "//depot/solvespace/": change = 1690]
2008-04-26 19:26:27 -08:00
Jonathan Westhues c934737d9e Add a function to combine vertices while tesselating the polygon,
so that OpenGL can fill self-intersecting polygons.

[git-p4: depot-paths = "//depot/solvespace/": change = 1688]
2008-04-25 02:11:29 -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
Jonathan Westhues 1bf7e3deaf Add an ExprVector class, for a 3-vector whose members are
expressions. That simplifies a few things considerably. And some
little UI tweaks.

[git-p4: depot-paths = "//depot/solvespace/": change = 1682]
2008-04-22 05:14:15 -08:00
Jonathan Westhues 9b1b255e85 Now I can display the edit control in the graphics window, and edit
the label associated with a constraint. And that even works,
changes the length of the line.

[git-p4: depot-paths = "//depot/solvespace/": change = 1678]
2008-04-21 02:12:04 -08:00
Jonathan Westhues 2926fa95d9 Start to add some constraint stuff. I now have point-coincident,
and point-in-plane. These work, but the equation is still stupid,
solving everything at once and not substituting trivial equations.

[git-p4: depot-paths = "//depot/solvespace/": change = 1677]
2008-04-21 00:16:38 -08:00
Jonathan Westhues 7220f998fc Rename the variables for the linear system to solve, for a bit more
clarity.

[git-p4: depot-paths = "//depot/solvespace/": change = 1676]
2008-04-20 17:26:36 -08:00
Jonathan Westhues b78b10ac1a Ultra-rough beginnings of a solver. Write the constraint equations,
take the partial derivatives, and run the Newton's method. This
seems to sort of work with a single distance constraint.

[git-p4: depot-paths = "//depot/solvespace/": change = 1675]
2008-04-20 03:35:10 -08:00
Jonathan Westhues cc03fe40aa Big structural change; eliminate the Point type in SolveSpace. The
points are now entities like any others; so a line segment request
will generate three entities, the line segment and its endpoints. I
think that's cleaner.

When I do step and repeats (and imports, and other similar), I'll
need a consistent way to assign those entity ids. That assignment
must not change if the sketch is edited. I don't have a clean way
to do that; best thought right now is to keep a record of what maps
have been used previously, and not pick a new map as long as it's
possible to use one that was used previously.

This all means that more crap gets pushed in to the Entity
structure, so that they can keep track of what solver variables
define them. Still seems better, though. I'm closer to ready
to start solving.

[git-p4: depot-paths = "//depot/solvespace/": change = 1673]
2008-04-19 03:09:47 -08:00
Jonathan Westhues 0d3217c0df Rename some stuff in the IdList again. Rough in the file save
stuff, though no file load stuff, and perhaps this can all be made
to work from a table somehow. Move the quaternion stuff into its
own class, and add a fancy animated view when you orient onto a
csys.

[git-p4: depot-paths = "//depot/solvespace/": change = 1672]
2008-04-18 03:11:48 -08:00
Jonathan Westhues 2f4a3917c5 Add functions to deep-copy Exprs, for those generated from user
expressions that we wish to keep around. And make the 2d coordinate
system (that causes points to generate 2 unknowns, not 3) an
attribute of the request, not the group, and add user interface to
change that.

[git-p4: depot-paths = "//depot/solvespace/": change = 1670]
2008-04-17 23:06:37 -08:00
Jonathan Westhues 1fa7865024 Add a little parser, that takes a string and generates and Expr *
syntax tree. That's what I'll used for entered dimensions, and
algebraic constraints and such. Needs to be extended to handle
stuff like points and entities, but I think that it can be.

[git-p4: depot-paths = "//depot/solvespace/": change = 1669]
2008-04-16 22:42:32 -08:00
Jonathan Westhues 22302dca7a Now I can add a constraint (a length), and it's displayed
on-screen, and I can drag the label. That's progress. Also
implement a bunch of untested expression stuff, since I'll need
that for the values of the dimensions, for example.

[git-p4: depot-paths = "//depot/solvespace/": change = 1668]
2008-04-14 02:28:32 -08:00
Jonathan Westhues 094e10204d Make the points locked in 2d csys (expressed as two parameters, for
the plane basis vectors) work, easy. Tweak the text window a bit,
for cosmetics, and start to add the symbolic expression code.

[git-p4: depot-paths = "//depot/solvespace/": change = 1667]
2008-04-13 06:28:35 -08:00
Jonathan Westhues a0e78e0da2 Tweak the handles to make more space in the request ID, so that I
can use the high bits as an "import ID" for imported parts, for
hierarchy (that retains parametric capabilities).

Implement enought that I can draw a datum point or a line segment,
and drag points around in three-space. Still so much to do.

[git-p4: depot-paths = "//depot/solvespace/": change = 1665]
2008-04-13 02:57:41 -08:00
Jonathan Westhues d76e708c17 Fix memory corruption in the IdList stuff (stupid freeing), and
tweak the way that things are hidden and shown.

[git-p4: depot-paths = "//depot/solvespace/": change = 1664]
2008-04-12 08:28:48 -08:00
Jonathan Westhues d36c70216a Add the keyboard accelerator mechanism for menu items. Use that to
implement zoom in/out, and orient onto a csys.

[git-p4: depot-paths = "//depot/solvespace/": change = 1663]
2008-04-12 07:17:58 -08:00
Jonathan Westhues 6c63d9c8cb Get rid of the command line from the text window; we'll say that's
just for display, and any text entry will happen via some floating
text box, same as entering a dimension on the sketch.

Add the hover and selection mechanism, which now seems to work.

Still not clear how to do imported parts, for assemblies and
hierarchy. The handle formats may still have to change.

[git-p4: depot-paths = "//depot/solvespace/": change = 1662]
2008-04-12 06:12:26 -08:00
Jonathan Westhues bf8ef7b196 Start to use that text window a bit; user interface to show and
hide things.

[git-p4: depot-paths = "//depot/solvespace/": change = 1661]
2008-04-11 04:47:14 -08:00
Jonathan Westhues 181e50f1d9 Add routines to draw a vector font (public domain Hershey Simplex
font, not bad). Use that to label the planes now.

[git-p4: depot-paths = "//depot/solvespace/": change = 1660]
2008-04-11 03:13:47 -08:00
Jonathan Westhues 9c2a8a08dc Drastic changes to the handle structure; that's now just 32 bits,
and I am assuming that many more operations will require lookups in
the IdList<>.

Add code to represent and draw a 2d coordinate system. The origin
is described by a point, and the orientation by a quaternion. So
now it does the same thing before, and draws the reference planes,
but with a lot more lines of code.

[git-p4: depot-paths = "//depot/solvespace/": change = 1658]
2008-04-09 00:39:01 -08:00
Jonathan Westhues a7fa89c2cc Check in some SolveSpace stuff, even though I didn't make much
progress. I want to change the sketch.h stuff fairly significantly,
I think, before proceeding.

[git-p4: depot-paths = "//depot/solvespace/": change = 1657]
2008-04-08 04:54:53 -08:00
Jonathan Westhues 19c6be530f Bits and pieces of SolveSpace; zoom works now, and some stuff to
draw planes that I will use to do the datum planes. Still haven't
settled upon the request/entity/group structure, and that's the
dependency before doing much real.

[git-p4: depot-paths = "//depot/solvespace/": change = 1656]
2008-04-01 02:48:44 -08:00
Jonathan Westhues f201d52247 Add hyperlink and colour support to the text window. Don't redraw
the text window every time we refresh the graphics window, because
that's slow. Use classes instead of structs for everything; I don't
understand the template handling for structs. And implement the
IdList, which I will try to use in many places.

[git-p4: depot-paths = "//depot/solvespace/": change = 1655]
2008-03-28 02:00:37 -08:00
Jonathan Westhues e426fe8a53 Start to add OpenGL support to SolveSpace, for the graphical view.
I've got the user interface to pan and rotate an object, more or
less works.

[git-p4: depot-paths = "//depot/solvespace/": change = 1654]
2008-03-27 01:53:51 -08:00
Jonathan Westhues fcdf43d487 More fragments of SolveSpace work. Improve the command line window,
and add some (non-functional) menus to the graphics window. Start
to rough in some data structures to hold the sketch. No real work
yet, though.

[git-p4: depot-paths = "//depot/solvespace/": change = 1653]
2008-03-26 01:18:12 -08:00
Jonathan Westhues 67139236fc This is my initial checkin for solvespace, a second attempt at
constraint solver drawing. I've started work on the user inteface,
which will be based around two windows: one with the graphical
sketch, and one command line. I've started to implement the command
line, no other work.

[git-p4: depot-paths = "//depot/solvespace/": change = 1652]
2008-03-25 02:02:13 -08:00