Commit Graph

46 Commits (0e623c90c05431c48c51c33b0f9fe8f49d83183d)

Author SHA1 Message Date
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 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 69cf8d6484 Change fudging when I select edges to generate a section from the
shell. That seems less prone generating stray lines, though it does
sometimes generate gaps.

[git-p4: depot-paths = "//depot/solvespace/": change = 1876]
2008-09-08 21:19:54 -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 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 4c6d350cee Add two more exotic constraints: equal point-line distances, and
point-line distance equal to line segment length. These are
available in both normal and projected versions, with fancy display
for all of these.

[git-p4: depot-paths = "//depot/solvespace/": change = 1793]
2008-06-14 03:16:14 -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 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 ab44c24cfc Major speedups, mostly by playing nicer with OpenGL; batch things
up more. Also change from stupid linear search lists to sorted
binary search lists, remove a stupid bug where I double-generated
entities, and don't do the triple drawing of entities (since
offsets on the Z buffer were doing the same job already).

[git-p4: depot-paths = "//depot/solvespace/": change = 1776]
2008-06-05 23:50:08 -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 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 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 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 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 e8fbf81de5 Do spherical linear interpolation when we animate onto a workplane.
[git-p4: depot-paths = "//depot/solvespace/": change = 1722]
2008-05-14 06:23:58 -08:00
Jonathan Westhues 364938f332 Add an arc entity. That's not allowed to exist in free space (since
we need something to force the points into plane, and the workplane
supplies that), but otherwise straightforward. And add diameter and
equal radius constraints for the arc.

[git-p4: depot-paths = "//depot/solvespace/": change = 1718]
2008-05-12 02:01:44 -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 018e8a0444 Draw an additional projection line, when showing a point-line
projected distance constraint.

[git-p4: depot-paths = "//depot/solvespace/": change = 1712]
2008-05-08 00:12:23 -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 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 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 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 1f77024771 Add an equal length constraint for line segments.
[git-p4: depot-paths = "//depot/solvespace/": change = 1680]
2008-04-21 21:00:49 -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 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 c097fea4f3 Make the tag (for items in an idlist) a member of the templated
data structure, and thus get rid of a level of struct.

[git-p4: depot-paths = "//depot/solvespace/": change = 1671]
2008-04-17 23:21:17 -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 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 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 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 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