Commit Graph

136 Commits (9723f4e44fb383a15aaf210af702929e167c2706)

Author SHA1 Message Date
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 8e484beec1 Add a warning when zero-length edges appear in the sketch, since
those screw a lot of things up. And add data structure for
clipboard entities, though no code yet.

[git-p4: depot-paths = "//depot/solvespace/": change = 2082]
2009-12-03 11:14:34 -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 e7c8d31500 Move code to find outer and inner contours (and which inner
contours go with which outer contour) out of exportstep.cpp, since
I'll need that to do filled contour export for the 2d file formats.

Also add user interface to specify fill color.

[git-p4: depot-paths = "//depot/solvespace/": change = 2057]
2009-10-22 09:16:20 -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 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 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 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 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 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 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 66c93aab73 Add a mechanism to record the lines drawn when we display a
constraint, so that we can export that too. This includes the lines
for the vector font.

A little ugly; it needs some kind of line style (color or width) to
distinguish those lines from the real geometry in the exported
file.

[git-p4: depot-paths = "//depot/solvespace/": change = 2007]
2009-07-03 12:55:57 -08:00
Jonathan Westhues 3f5c439873 A very important optimisation; if we know that our mesh/shell is
identical to the previous group's (because our thisShell and
thisMesh are empty), then display the previous group's instead.
This saves us re-triangulating the shell (or recalculating the
edges of a triangle mesh) every time our group gets regenerated,
which was horribly slow.

[git-p4: depot-paths = "//depot/solvespace/": change = 2004]
2009-06-29 23:24:36 -08:00
Jonathan Westhues 438d517c5a If a Boolean fails, then make a note of it in the group's text
window screen, and remind the user that they could 'fix' the
problem by working with meshes instead.

[git-p4: depot-paths = "//depot/solvespace/": change = 1962]
2009-05-30 00:49:09 -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 03ecbad981 Add beginnings of stuff to represent surfaces as either meshes or
exact surface shells. And add interference checking; I'll be lazy
and just do that on the meshes, by modifying the self-intersection
tester to ignore coplanar triangles (since that can happen in an
assembly).

[git-p4: depot-paths = "//depot/solvespace/": change = 1958]
2009-05-22 02:02:02 -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 bc6bdfade8 Save the exact surfaces in the exported file, and import and
transform them for assembly.

[git-p4: depot-paths = "//depot/solvespace/": change = 1954]
2009-05-18 23:26:38 -08:00
Jonathan Westhues 4d742a5777 The constraint solver now compiles as a library, and I have a
little test app that links against it. I still need to polish a few
things, but this is more or less as it should be.

[git-p4: depot-paths = "//depot/solvespace/": change = 1944]
2009-04-19 23:30:09 -08:00
Jonathan Westhues b293c0ef41 Split the Entity and Constraint classes into Xxx and XxxBase, with
the fundamental geometric stuff in XxxBase. Next I hope to make the
constraint solver use only the XxxBase types.

[git-p4: depot-paths = "//depot/solvespace/": change = 1941]
2009-04-18 20:28:21 -08:00
Jonathan Westhues 71adc0bf54 Split ratpoly.cpp; now that contains only the mathematical stuff,
and curve.cpp and surface.cpp contain the rest.

Also get rid of the meshError stuff; will just use the nakedEdges
mechanism for that. And I won't run the interference test
continuously, have added a menu item for that.

[git-p4: depot-paths = "//depot/solvespace/": change = 1934]
2009-03-28 22:05:28 -08:00
Jonathan Westhues bb4b767e99 Tear everything apart, moving away from meshes and toward shells.
Add stubs for functions to perform Booleans, and get rid of mesh
stuff, including the kd tree accelerated snap to vertex (which
should not be required if the shell triangulation performs as it
should).

Also check that a sketch is not self-intersecting before extruding
it or whatever. This is dead slow, needs n*log(n) implementation.

[git-p4: depot-paths = "//depot/solvespace/": change = 1902]
2009-01-22 19:30:30 -08:00
Jonathan Westhues ebca6130ec Early attempts at rational polynomial surfaces. I can create one
from an extrusion, with piecewise linear trim curves for everything
(that are shared, so that they appear only once for the two
surfaces that each trims). No Boolean operations on them, and the
triangulation is bad, because gl seems to merge collinear edges.

So before going further, I seem to need my own triangulation code.
I have not had great luck in the past, but I can't live without it
now.

[git-p4: depot-paths = "//depot/solvespace/": change = 1899]
2009-01-19 02:37:10 -08:00
Jonathan Westhues 25ed4e1ef1 SPolyCurve (i.e., polynomial curve) vs. SPolygon got too confusing;
let's call those Beziers instead.

[git-p4: depot-paths = "//depot/solvespace/": change = 1898]
2009-01-18 19:51:00 -08:00
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 7a874c20c0 Remove old sweep/helical sweep code for meshes, and add some
untested stuff to start making exact surface shells.

[git-p4: depot-paths = "//depot/solvespace/": change = 1896]
2009-01-16 21:28:49 -08:00
Jonathan Westhues f904c0fbee Entities now generate rational polynomial curves instead of
piecwise linear segments. These are piecewise linear approximated
for display, and currently for the mesh too, but that's the first
step to replace the mesh with exact curved surfaces.

[git-p4: depot-paths = "//depot/solvespace/": change = 1895]
2009-01-14 19:55:42 -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 984956cbc7 Add a constraint to make line length equal arc length. That's quite
tricky; can't just use the dot product, since that blows up when
you cross pi radians. A gear shift approach, use either sin or cos,
same kind of thing as the 3d-parallel constraint.

And report a NaN constraint as unconverged, of course.

[git-p4: depot-paths = "//depot/solvespace/": change = 1890]
2009-01-08 09:22:59 -08:00
Jonathan Westhues 8d656bc600 Add feature to find the degrees of freedom; strike the
corresponding to each param from the Jacobian, and see if it loses
rank. If it does then that one was important, so it's bound. Then
display a big blue square around its point until the next normal
solve.

[git-p4: depot-paths = "//depot/solvespace/": change = 1887]
2009-01-04 04:01:46 -08:00
Jonathan Westhues 816a1ee8b4 Auto-remove point-on-line constraints when at-midpoint constraints
are added. There was already precedent for that, since I
auto-remove horiz/vert constraints when symmetry constraints are
added.

[git-p4: depot-paths = "//depot/solvespace/": change = 1875]
2008-09-06 13:36:31 -08:00
Jonathan Westhues 92f55dd195 Speed up the inconsistent constraint detection; there's no reason
not to solve by substitution before rank testing. And report the
unsatisfied constraints when we don't converge.

[git-p4: depot-paths = "//depot/solvespace/": change = 1874]
2008-09-05 03:25:53 -08:00
Jonathan Westhues bd0e97bad0 Now I can suppress an imported part; so the entities still show up,
but the mesh doesn't get combined. That effectively hides it, good
for looking inside and such.

[git-p4: depot-paths = "//depot/solvespace/": change = 1860]
2008-02-15 03:35:15 -08:00
Jonathan Westhues 22b78e4427 Assemble the group polygon ourselves when exporting a DXF; that
lets us export open curves, if the user drew them that way.

Also increase the limits on how many pwls we will generate for a
single curve.

[git-p4: depot-paths = "//depot/solvespace/": change = 1854]
2008-02-10 04:43:48 -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 304c8f8be9 Add equal-angle constraints. These are implemented by brute force,
as the difference between the cosines of the two angles. All of the
angle stuff generates huge expressions (Expr *), but doesn't seem
noticeably slow.

[git-p4: depot-paths = "//depot/solvespace/": change = 1847]
2008-07-20 04:24:43 -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 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 6269d702fb Report the number of degrees of freedom for each group.
[git-p4: depot-paths = "//depot/solvespace/": change = 1834]
2008-07-09 23:42:35 -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 fd4abd5519 Add a perpendicular constraint; identical to constraining a ninety
degree angle, but shows with a right angle symbol instead of a
numerical angle you can edit.

[git-p4: depot-paths = "//depot/solvespace/": change = 1819]
2008-07-02 01:21:29 -08:00
Jonathan Westhues 48c5018613 Add symmetric about line constraint. This applies only when locked
in a workplane, since it would otherwise be ambiguous.

[git-p4: depot-paths = "//depot/solvespace/": change = 1817]
2008-07-01 22:59:49 -08:00