Commit Graph

74 Commits (ee052b556a71068895c995fb8b0f6a23574c972f)

Author SHA1 Message Date
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 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 9723f4e44f Add support for a clipboard, with cut, copy, and paste. This works
only in a workplane; but this means that plane sketches are
conveniently transformed from one plane to another.

Also tweak snap to grid to ignore unsnappable entities instead of
triggering an error, and to remove arbitrary limit on the number of
entities / comments that will be snapped.

[git-p4: depot-paths = "//depot/solvespace/": change = 2084]
2009-12-04 00:08:41 -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 61da5969f6 Add O(n*log(n)) self-intersection check for polygons. That was
previously a major bottleneck, and is now at least 10x faster for a
practical section.

And fix a horrible uninit memory bug in the triangle kd-tree stuff;
the split planes were apparently random. This would have slowed
things down, but not caused an incorrect result; except when it
ends up NaN, which is the reason I noticed.

[git-p4: depot-paths = "//depot/solvespace/": change = 2073]
2009-11-09 03:51: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 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 daeb0e8430 Oops, was always writing SVG or EPS arcs counter-clockwise; which
breaks with the new path stuff, since circular holes really do have
to go ccw. So fix that.

[git-p4: depot-paths = "//depot/solvespace/": change = 2062]
2009-10-30 03:18:54 -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 0914a27ff4 Put information about which requests generate which entities, and
how many points are associated with each, into a single table.

[git-p4: depot-paths = "//depot/solvespace/": change = 2056]
2009-10-22 06:02:08 -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 83bbc004dc Add 3d wireframe export, in DXF or STEP format. This uses most of
the same plumbing as the 2d vector output.

Also fix piecewise linear tolerance when the export scale factor is
not equal to one; have to scale the chord tol along with that.

[git-p4: depot-paths = "//depot/solvespace/": change = 2053]
2009-10-12 02:40:48 -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 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 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 ea00c7e979 Increment the version number, and add a context menu item to snap
what's hovered to the grid.

[git-p4: depot-paths = "//depot/solvespace/": change = 2042]
2009-09-30 00:54:01 -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 bdf60690c1 Replace copyright notices for SolveSpace with my LLC, not my name.
[git-p4: depot-paths = "//depot/solvespace/": change = 2035]
2009-09-28 01:48:56 -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 9b8f32dad7 Now actually export the line styles, for PDF, EPS, and SVG file
formats, with the proper color and width. This may need a bit of
cleanup for stuff like the hidden line removal, which currently
loses the style.

Also fix a bug in the test for arcs of a circle. A second-order
Bezier with collinear control points really is an arc, but it's an
arc with infinite radius so stuff tends to blow up. So return false
for that one.

[git-p4: depot-paths = "//depot/solvespace/": change = 2030]
2009-09-21 21:46:30 -08:00
Jonathan Westhues e989c86a38 Add ability to set export canvas size (paper size for PDF, bbox
size for EPS, etc.). This can either be fixed, with a given width
and height and offset, or automatic, by the left right bottom top
margins.

And draw nicer dimensions for length, with arrows and more
extension lines. Add code to trim those lines against the
(rectangular, axis-aligned) box that contains the actual number,
and use that (instead of the elliptical interpolation, which was
only approximately right) for diameter dimensions too.

[git-p4: depot-paths = "//depot/solvespace/": change = 2027]
2009-09-03 00:13:09 -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 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 f865901bd2 Group edges into chains (that don't intersect edges from the other
contour, except at the ends of the chain), and classify the entire
chain. That's much faster than going edge by edge.

[git-p4: depot-paths = "//depot/solvespace/": change = 2002]
2009-06-26 21:53:56 -08:00
Jonathan Westhues 666ea1c047 Add beginnings of marching surface intersection; I can find all the
boundary points, at least. That required some changes to what gets
passed around (for example because to project a point onto this
inexact curve, we need to know which two surfaces it trims so that
we can do a Newton's method on them).

And fix stupidity in the way that I calculated edge normals; I just
did normal in uv space, and there's no particular reason why that
would be normal in xyz. So edges in long skinny surfaces failed,
for example.

[git-p4: depot-paths = "//depot/solvespace/": change = 1990]
2009-06-18 23:56:33 -08:00
Jonathan Westhues 7eefb79127 Show a progress message when regenerating is slow. And update the
version number to 1.4, don't include force-hidden entities when
building the loops, and don't show force-hidden entities when that
entity gets copied.

[git-p4: depot-paths = "//depot/solvespace/": change = 1983]
2009-06-13 20:36:38 -08:00
Jonathan Westhues ae35b3595c Revamp the edge classification for Booleans. I no longer make a
separate polygon of coincident (with same or opposite normal)
faces; I instead test all the edges against the other shell, and
have extended the classify-against-shell stuff to handle those
cases.

And the normals are now perturbed a bit numerically, to either side
of the edge, to distinguish tangency from a coincident surface.

This seems to work fairly well, although things still tend to fail
when the piecewise linear tolerance is too coarse.

[git-p4: depot-paths = "//depot/solvespace/": change = 1964]
2009-06-03 19:59:40 -08:00
Jonathan Westhues 842645d61f Put back code to generate emphasized edges from a mesh; so now we
can show edges for both meshes and shells, and export them and
hidden line remove and all the usual stuff.

And fix the zoom to fit on startup, so that it considers hidden
entities too. That avoids the problem where things get generated at
stupid chord tolerance because no entities were visible and the
mesh of course did not yet exist.

[git-p4: depot-paths = "//depot/solvespace/": change = 1961]
2009-05-28 21:40:17 -08:00
Jonathan Westhues b4dfb1aded Add code to assemble two shells into one, without checking for any
intersections or otherwise trying to make the result not
self-intersecting.

[git-p4: depot-paths = "//depot/solvespace/": change = 1955]
2009-05-19 19:04:36 -08:00
Jonathan Westhues 1d88f96e13 Make surfaces of revolution with control points on the axis
triangulate correctly; don't screw up generating them, and make
sure that the ratpoly stuff doesn't blow up near the singularity.

[git-p4: depot-paths = "//depot/solvespace/": change = 1953]
2009-05-18 00:18:32 -08:00
Jonathan Westhues 40ed1b7ac1 Generate intersection curves for surfaces of extrusion along a
parallel axis (which are always lines parallel to that axis).

Remove short pwl segments when possible, to avoid short edges that
get misclassified.

[git-p4: depot-paths = "//depot/solvespace/": change = 1952]
2009-05-17 23:26:51 -08:00
Jonathan Westhues d6d198ee40 Add triangulation of surfaces with compound curvature; I just build
a grid of quads, with adaptive spacing. The quads that lie entirely
within the trim polygon are triangulated and knocked out from the
polygon, and then the polygon is triangulated.

That works okay, though rather slow. But there are issues with
surfaces of revolution that touch the axis, since they end up with
a singularity. That will require some thought.

[git-p4: depot-paths = "//depot/solvespace/": change = 1951]
2009-05-08 00:33:04 -08:00
Jonathan Westhues 3ca2a6b80b Add direct PDF export. The only curves in PDF are nonrational
cubics, so add routines to approximate a rational Bezier of any
degree in that form. And use those for EPS and SVG when applicable,
so now even stuff like ellipses gets exported smooth.

[git-p4: depot-paths = "//depot/solvespace/": change = 1938]
2009-04-14 22:50:06 -08:00
Jonathan Westhues b5c8aade21 Add exact export of arcs for EPS, DXF, SVG, and of nonrational
polynomial curves for SVG.

[git-p4: depot-paths = "//depot/solvespace/": change = 1937]
2009-04-14 18:55:18 -08:00
Jonathan Westhues d4b842a242 Generate additional edges wherever a front- and back-facing
triangle join. And add controls to show and hide the solid model
edges (independently of the shaded mesh), and to suppress the
shaded triangles from SVG/EPS output.

[git-p4: depot-paths = "//depot/solvespace/": change = 1932]
2009-03-17 20:26:04 -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 bc70089dd0 Add code to subdivide (with de Castljau's algorithm) a surface, and
use that for surface-line intersections. That has major problems
with the heuristic on when to stop and do Newton polishing.

There's also an issue with all the Newton stuff when surfaces join
tangent.

And update the wishlist to reflect current needs.

[git-p4: depot-paths = "//depot/solvespace/": change = 1925]
2009-03-08 02:59:57 -08:00
Jonathan Westhues ddf2b30b98 Remove some of the oops() calls that tend to blow because of issues
in the numerical code.

And clean some other stuff, in particular simplifying whenever I
have to take the maximum (or minimum) of three quantities.

[git-p4: depot-paths = "//depot/solvespace/": change = 1855]
2008-02-10 05:34:32 -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 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 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 4afc881bf2 Add a command to create an arc that's tangent to two line segments.
This was possible before (by drawing everything explicitly), but
now it's easy.

[git-p4: depot-paths = "//depot/solvespace/": change = 1838]
2008-07-13 18:45:11 -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 49b6e9a74d Remove the back button from the text window, since I never used it.
And fix a bug; wasn't asking the user whether to save before
abandoning file when a new file was opened recent.

[git-p4: depot-paths = "//depot/solvespace/": change = 1830]
2008-07-09 22:11:56 -08:00