Commit Graph

38 Commits (22b78e44274de8e454634f71911e9d43ef2c890b)

Author SHA1 Message Date
Jonathan Westhues 222007f3d8 Oops, make path relative routine was broken when the filenames
shared a prefix (/path/abc.slvs, /path/abcdef.slvs).

[git-p4: depot-paths = "//depot/solvespace/": change = 1843]
2008-07-16 21:29:10 -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 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 d4d5ab578d Add a special case when raising quaternions almost equal to
(+/-1, 0, 0, 0) to some power; that was failing if the magnitude of
w was slightly greater than 1, so that acos() returned NaN.

[git-p4: depot-paths = "//depot/solvespace/": change = 1820]
2008-07-02 01:52:32 -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 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 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 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 727ac126fb Some ugly hacks; discard zero-area triangles, randomize the
triangle list before adding to the BSP, and check if a point in
plane lies in multiple triangles and choose the one with the
biggest normal magnitude (i.e., area) when testing normal
direction.

[git-p4: depot-paths = "//depot/solvespace/": change = 1745]
2008-05-25 22:23:05 -08:00
Jonathan Westhues 05b50e0af8 Various tweaks, including a numerical improvement, to make the
epsilon in the csg stuff meaningfully apply everywhere to the
length.

[git-p4: depot-paths = "//depot/solvespace/": change = 1742]
2008-05-25 06:36:03 -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 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 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 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 01885736e6 Fix my rotation-matrix-to-quaternion code: it broke when the
diagonal elements of the matrix summed to -1. Now it's ugly, but I
think that it's correct. And add a command to flip the view to the
other side, which is what started my problems. And tweak display of
H and V and M for constraints: put them in the constraint plane, so
that they're stationary as you rotate around.

[git-p4: depot-paths = "//depot/solvespace/": change = 1704]
2008-05-02 19:33:35 -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 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 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 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 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