Commit Graph

412 Commits (4628048d45d575451ca3348ccabfdfee34605391)

Author SHA1 Message Date
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 3515748334 Make the EPS, PDF, and SVG targets output filled contours. This
also means that closed contours will get output as a single path
now, vs. one open path per Bezier segment before.

I've simplified the 2d/3d wireframe export targets somewhat; they
now support only Beziers, without an additional special case for
line segments. The performance penalty for that should not be worth
caring about, since that's infrequent.

And fix a memory leak in FindOuterFacesFrom(), fix ugly output of
filled triangles in PDF (because the line join style did bad things
on long skinny triangles), fix non-zero Z coordinates for exported
views or sections in DXF or STEP.

[git-p4: depot-paths = "//depot/solvespace/": change = 2061]
2009-10-30 02:38:34 -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 f6bb680978 Add Wavefront OBJ support, to supplement the existing STL mesh
export. That doesn't seem very useful, but it's only a few dozen
lines of code.

[git-p4: depot-paths = "//depot/solvespace/": change = 2054]
2009-10-12 03:34:43 -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 730bb8f73e Make the export scale factor affect the surfaces in a STEP file,
and lay groundwork for wireframe export.

[git-p4: depot-paths = "//depot/solvespace/": change = 2052]
2009-10-12 01:28:34 -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 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 15729c74f0 Fix two gross memory leaks. I was neglecting to clear the SEdgeList
that I created in SPolygon::SelfIntersecting, and while
triangulating a polygon I would free the SContour, but not the
list of points associated with the contour.

[git-p4: depot-paths = "//depot/solvespace/": change = 2047]
2009-10-02 01:30:12 -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 33dfff2a78 Add option to disable the "not closed contour" warnings and such,
instead of tying that to whether the shaded model is shown. And
rewrite all URLs to solvespace.com, not www.solvespace.com, and get
rid of the nag screen that I just added because opening the website
with ShellExecute seems to freeze a bit on startup.

[git-p4: depot-paths = "//depot/solvespace/": change = 2044]
2009-10-01 02:35:11 -08:00
Jonathan Westhues 6e5b503ac6 Make everything line up in the configuration screen.
[git-p4: depot-paths = "//depot/solvespace/": change = 2043]
2009-09-30 02:02:15 -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 308ef7e345 Add an additional nag screen: open the website whenever they start
the program, if it's unregistered and the trial period has expired.

[git-p4: depot-paths = "//depot/solvespace/": change = 2039]
2009-09-29 04:47:48 -08:00
Jonathan Westhues f7f73bc900 Change the unregistered behavior: instead of limiting the number of
constraints, print a message in anything that we export.

[git-p4: depot-paths = "//depot/solvespace/": change = 2038]
2009-09-29 04:31:07 -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 a887039707 Show info when a Constraint::COMMENT is selected, so that the user
can apply a style that way too; and apply the export scale factor
to the line width.

[git-p4: depot-paths = "//depot/solvespace/": change = 2034]
2009-09-24 08:04:46 -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 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 f7f9000c68 Discard intersection curves that lie entirely outside of one
surface's domain of u, v in [0, 1]. Cache the starting guess when
projecting a point into a ratpoly surface, to avoid brute force
searching for a good one every time. Split edges even if they
aren't quite inside the trim curve, since the trim boundaries are
pwl, not exact; unnecessary splits won't hurt, but failure to split
when necessary will. Make the triangulation code use a better (but
not perfect) epsilon, to avoid "can't find ear" failures on very
fine meshes.

And turn on compiler optimization! I had somehow forgotten about
that, and it's a ~2x improvement.

[git-p4: depot-paths = "//depot/solvespace/": change = 2026]
2009-08-20 20:58:28 -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 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 8b7f45e72e That optimization where I display the previous group's mesh or
shell when the current group has thisMesh and thisShell empty was
broken, since rotate or step and repeat groups don't use those.

So force something (doesn't matter what) into thisMesh or thisShell
in a step and repeat group, to make sure it always gets
recalculated and displayed. Ugly fix though.

[git-p4: depot-paths = "//depot/solvespace/": change = 2017]
2009-07-19 13:30:09 -08:00
Jonathan Westhues f45eb959f4 Split export.cpp; now exportvector.cpp has all the file format
specific stuff.

[git-p4: depot-paths = "//depot/solvespace/": change = 2014]
2009-07-08 01:44:13 -08:00
Jonathan Westhues 4c825a803a When deleting a request, rewrite the constraints on its points in
such a way as to keep all the points that used to be coincident,
still coincident.

[git-p4: depot-paths = "//depot/solvespace/": change = 2013]
2009-07-08 01:36:18 -08:00
Jonathan Westhues 1692382d5a Replace the closed-form solutions for entity-entity splitting with
a method that works on the piecewise linear segments, and then
refines any intersections that it finds by Newton's method. So now
I support cubics too, and circle-circle intersections, and the code
is much simpler.

[git-p4: depot-paths = "//depot/solvespace/": change = 2012]
2009-07-07 00:21: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 a74f85e0d1 I had been using LENGTH_EPS as the tolerance on both xyz points and
uv points. This is inconsistent, unless the surface happens to be a
plane square with side length one.

So modify the SBspUv tests to take a surface, and measure distance
linearized in that surface. That fixes at least one
mis-classification bug, and doesn't seem to break anything.

[git-p4: depot-paths = "//depot/solvespace/": change = 2005]
2009-07-01 19:32:17 -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 4ca7548ffe Don't merge two coincident surfaces unless they share an edge.
Otherwise, we might merge in ways that make things slower (because
the bboxes aren't as tight) or less robust (because the
intersection needs to be split in more places, and that might fail).

[git-p4: depot-paths = "//depot/solvespace/": change = 2003]
2009-06-29 20:38:40 -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 cf77e51ddc I think this fixes an issue importing STEP into Rhino. Something
bad seems to happen when a trim curve's u or v coordinate goes even
slightly outside [0, 1]. And since I considered the bbox of the pwl
segments when merging coincident surfaces (and not the true
curves), that happened. So add a bit of slop, which seems to make
things happy.

[git-p4: depot-paths = "//depot/solvespace/": change = 1999]
2009-06-25 03:58:39 -08:00
Jonathan Westhues 3da334028e Let's use the direction cosines (dot product of unit vectors), not
the arbitrary-magnitude dot product, to classify regions (inside,
outside, coincident) of surfaces against each other.

That lets me always perturb the point for the normals (inside and
outside the edge) by just a chord tolerance, and nothing bad
happens as that distance varies over a few orders of magnitude.

[git-p4: depot-paths = "//depot/solvespace/": change = 1996]
2009-06-21 22:22:30 -08:00
Jonathan Westhues bd36221219 Clean up the marching step size / chord tol stuff, and add code to
export an inexact curve by approximating it with piecwise cubic
segments (whose endpoints lie exactly on the curve, and with exact
tangent directions at the endpoints).

[git-p4: depot-paths = "//depot/solvespace/": change = 1995]
2009-06-21 18:54:09 -08:00
Jonathan Westhues 684ba7deb1 Add a menu item to rotate an imported part by ninety degrees about
the coordinate axis closest to the screen normal.

[git-p4: depot-paths = "//depot/solvespace/": change = 1994]
2009-06-21 12:39:42 -08:00
Jonathan Westhues c6a0148724 When splitting a curve against surfaces, don't split the curve
against the surfaces that it supposedly borders; that will cause
numerical trouble.

[git-p4: depot-paths = "//depot/solvespace/": change = 1993]
2009-06-21 01:54:21 -08:00