Commit Graph

62 Commits (2eff68409e914e2a7291e641400abf5af1c21679)

Author SHA1 Message Date
Jonathan Westhues ba8ac7dcd3 Add a screen to edit the view parameters; scale, translation,
rotation. Also clean up the handling of units, by putting the
conversion factors in only one place, and clean up the
expression-parsing but removing all the copies of the same error
message.

[git-p4: depot-paths = "//depot/solvespace/": change = 2093]
2010-01-03 16:35:28 -08:00
Jonathan Westhues a4a1d3b619 Remove the toggle semantics from all the selection stuff. Now
left-clicking always selects, and there's a special context menu
item to deselect. Also streamline the right-click behavior by
making that select the hovered item, and making all the context
menu items work on the selection.

[git-p4: depot-paths = "//depot/solvespace/": change = 2091]
2010-01-03 02:26:15 -08:00
Jonathan Westhues ee052b556a Tweak drag and selection behavior: selection is kept after dragging
selected entities, but cleared after dragging an unselected entity.
Marquee selection is select-only (not toggle), and "Select All"
replaces "Invert Selection". Left-click on nothing will clear the
selection.

Also add context menu entries for cut, copy, and paste.

[git-p4: depot-paths = "//depot/solvespace/": change = 2089]
2009-12-21 08:44:00 -08:00
Jonathan Westhues 48b79b912c Draw the filled contours last, so that transparency (for the
default fill color for closed non-self-intersecting contours) works
correctly.

[git-p4: depot-paths = "//depot/solvespace/": change = 2081]
2009-11-29 03:20:45 -08:00
Jonathan Westhues b352ca785c My call to glClear (to clear the depth buffer, to place the
background image behind everything) seems to do bad things for
whatever reason. So get rid of that, and instead to a glDepthRange
to force that at the back.

[git-p4: depot-paths = "//depot/solvespace/": change = 2079]
2009-11-20 00:43:10 -08:00
Jonathan Westhues 4cfe7eea64 Split cubic splines and periodic splines too; which is a pain,
because it can't be C2 continuous after splitting (since I'm
doing uniform splines only, and the parametrization changes). So
just knock everything down to cubic Beziers.

Also draw lines to indicate angle and origin when Ctrl+dragging to
rotate in plane of screen.

[git-p4: depot-paths = "//depot/solvespace/": change = 2075]
2009-11-09 19:57:24 -08:00
Jonathan Westhues f3eeae673f Oops, wasn't clearing depth buffer after blitting background image.
[git-p4: depot-paths = "//depot/solvespace/": change = 2072]
2009-11-07 20:50:38 -08:00
Jonathan Westhues d74b1e7ece Add ability to set a background image. I import a png with libpng,
load it as a texture, and show it instead of a flat-color
background. Includes user interface to specify scale and
translation of image, but the rotation is always aligned to the
view.

[git-p4: depot-paths = "//depot/solvespace/": change = 2071]
2009-11-07 17:11:38 -08:00
Jonathan Westhues 28d1bc67bc Two ugly hacks. Don't do the trick where I also deselect the point
under the just-deselected coincident point when I'm working on
batches, which really could have selected that underneath point.
And always pwl curves to at least two line segments (and likewise
retain at least one intermediate point when removing short edges),
to avoid confusion when holes end up square.

[git-p4: depot-paths = "//depot/solvespace/": change = 2070]
2009-11-05 21:34:34 -08:00
Jonathan Westhues e91bf7db79 Don't let invert selection, select edge chain, or marquee selection
work on hidden entities. Also fix bug where undo state wasn't saved
before toggling construction.

[git-p4: depot-paths = "//depot/solvespace/": change = 2067]
2009-11-03 23:59:23 -08:00
Jonathan Westhues c79604f64d Add marquee selection, a view-aligned rectangle such that
everything even partially within that rectangle gets selected when
I release.

Also make deselecting a point deselect all coincident points too;
otherwise there now exist ways to select both coincident points,
which meant that it was impossible to deselect the lower one.

And fix text window to show selection info even if just constraints
are selected, seems more consistent.

[git-p4: depot-paths = "//depot/solvespace/": change = 2066]
2009-11-03 23:52:58 -08:00
Jonathan Westhues b9ab62ab3f Remove arbitrary limits on the selection size, and permit more than
one point to be dragged simultaneously. So now a dragged point
drags all the selected points and entities, and a dragged entity
drags its points (except for circles, which drag the radius).

This means that the number of forced points for the solver must now
be unlimited, and it is.

Also add commands to invert the selection within the active group,
and to select an edge chain starting from the current selection.
And redo the context menus a bit; still not great, but less
cluttered and more systematic.

[git-p4: depot-paths = "//depot/solvespace/": change = 2064]
2009-11-03 10:54:49 -08:00
Jonathan Westhues 2f115ec950 A monster change to add support for filled paths. This requires us
to assemble Beziers into outer and inner loops, and find those
loops made up of entities with filled styles. The open paths are
maintained in a separate list, and we assemble as many closed paths
as possible even when open paths exist.

This changes many things. The coplanar check is now performed on
the Beziers, not the resulting polygon. The way that the polygon is
used to determine loop directions is also modified.

Also fix the mouse behavior when dragging a point: drop it when the
mouse is released, even if it is released outside the window, but
don't drop it if the pointer is dragged out of and then back into
our window.

Also special-case SSurface::ClosestPointTo() for planes, for speed.

[git-p4: depot-paths = "//depot/solvespace/": change = 2058]
2009-10-28 23:16:28 -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 ce37b1cf72 A better fix to the display mesh issue; instead of drawing the
previous group, copy the previous group's mesh into ours, and draw
ours. This makes other stuff that uses that mesh (like the export
and analysis code) work properly.

[git-p4: depot-paths = "//depot/solvespace/": change = 2050]
2009-10-07 23:55:09 -08:00
Jonathan Westhues 3da0f6e135 Oops, couldn't select the faces in groups that didn't contribute
thisShell or thisMesh; forgot about that when I did the change to
not re-triangulate shells (or re-edge-find meshes) unnecessarily.

[git-p4: depot-paths = "//depot/solvespace/": change = 2049]
2009-10-07 22:48:49 -08:00
Jonathan Westhues 35df6bd06a Split draw.cpp and textscreens.cpp, and move a few things around.
This creates mouse.cpp and confscreen.cpp.

[git-p4: depot-paths = "//depot/solvespace/": change = 2040]
2009-09-29 05:14:47 -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 9f78ee3c33 Treat delete, backspace, and browser back all identically.
[git-p4: depot-paths = "//depot/solvespace/": change = 2036]
2009-09-28 02:01:34 -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 9416faca88 Add a context menu, with a grab bag of options. That will need some
refinement later, but it does not affect file formats so it's not
very critical.

[git-p4: depot-paths = "//depot/solvespace/": change = 2032]
2009-09-23 02:59:59 -08:00
Jonathan Westhues 274005c02c Make hidden line removal keep all the line styles, and don't apply
that to the constraints.

And fix two crashing bugs, embarrassing, both chasing null pointers.

[git-p4: depot-paths = "//depot/solvespace/": change = 2031]
2009-09-21 22:47:11 -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 36182448ce Oops, forgot to consider scale (pixels/mm) for translation from
six-DOF mouse.

[git-p4: depot-paths = "//depot/solvespace/": change = 2022]
2009-07-25 17:29:56 -08:00
Jonathan Westhues 806c3d8cde Decrease Z gain while transforming an imported part with the
six-DOF mouse. That's normal to the screen, so it's otherwise easy
to get a big movement without realizing (especially with a parallel
projection of the part).

[git-p4: depot-paths = "//depot/solvespace/": change = 2021]
2009-07-25 15:46:01 -08:00
Jonathan Westhues 606af2ff39 Add support for the 3dconnexion six degree of freedom input devices
(in my case, a SpaceNavigator). I can transform the view of the
part, or transform a part in an assembly.

Also fix up mouse wheel input, so that it works even if it comes in
chunks of less than 120 units.

[git-p4: depot-paths = "//depot/solvespace/": change = 2019]
2009-07-20 11:05:33 -08:00
Jonathan Westhues ddbd0ff77b Add ability to represent our surfaces as either a shell or a mesh,
according to the user's preference. I templated the housekeeping
stuff for Boolean operations and step and repeat, so it's
relatively clean.

Still need to add the stuff to make a mesh vertex-to-vertex, and to
export sections of a mesh.

[git-p4: depot-paths = "//depot/solvespace/": change = 1959]
2009-05-24 03:37:07 -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 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 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 acadc0a918 Many changes:
* Rewrite surface handles in curves, so that Booleans beyond
      the first don't screw up.

    * If an intersection curve is identical to an existing curve
      (as happens when faces are coincident), take the piecewise
      linearization of the existing curve; this stops us from
      screwing up when different shells are pwl'd at different
      chord tols.

    * Hook up the plane faces again.

    * Remove coincident (parallel or anti-parallel) edges from the
      coincident-face edge lists when doing Booleans; those may
      happen if two faces are coincident with ours.

    * Miscellaneous bugfixes.

It doesn't seem to screw up very much now, although tangent edges
(and insufficient pwl resolution) may still cause problems.

[git-p4: depot-paths = "//depot/solvespace/": change = 1929]
2009-03-15 15:04:45 -08:00
Jonathan Westhues adc910185c Add plane-plane intersection as a special case (to generate the
trimmed line), and plane-line intersection. Terminate the Bezier
surface subdivision on a chord tolerance, and that seems okay now.
And print info about the graphics adapter in the text window, could
be useful.

Also have a cylinder-detection routine that works; should special
case those surfaces in closed form since they are common, but not
doing it yet.

[git-p4: depot-paths = "//depot/solvespace/": change = 1928]
2009-03-14 12:01:20 -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 37795d24ba Don't let the user create workplanes locked in another workplane;
that is almost surely a mistake.

[git-p4: depot-paths = "//depot/solvespace/": change = 1888]
2009-01-04 04:39:55 -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 23a4ce3697 Auto-show the text window when stepping a dimension, in addition to
auto-showing when a solve fails. And accept expressions, not just
numbers, for that new dimension value.

[git-p4: depot-paths = "//depot/solvespace/": change = 1877]
2008-09-17 02:13:37 -08:00
Jonathan Westhues fe77e7cf7e Don't enable GL_POLYGON_SMOOTH. That looks awful on my other
laptop, for some graphics card reason.

[git-p4: depot-paths = "//depot/solvespace/": change = 1869]
2008-08-14 23:37:19 -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 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 d2c4d2cdb7 Swap meaning of middle and right mouse buttons (now center means
drag, right means pan), and extend reference manual.

[git-p4: depot-paths = "//depot/solvespace/": change = 1845]
2008-07-18 05:31:22 -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 7cf0deb9f4 Reassign the keyboard shortcuts so that the constraints don't all
start with Shift, since that's hard to type.

[git-p4: depot-paths = "//depot/solvespace/": change = 1831]
2008-07-09 23:06:07 -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 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 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 89bb81b35c Force the numerical guess for a normal to be exactly correct when a
same orientation constraint is applied; this makes convergence
easy. And don't hover faces or constraints while dragging
something.

[git-p4: depot-paths = "//depot/solvespace/": change = 1798]
2008-06-18 01:18:51 -08:00