Commit Graph

129 Commits (e74a655ffd732704a6d7816d15f918dd09c81f86)

Author SHA1 Message Date
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 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 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 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 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 3b3b7fe680 Add STEP file export for 2d curves too, and disable extrusion not
normal to the sketch.

[git-p4: depot-paths = "//depot/solvespace/": change = 1981]
2009-06-10 21:57:23 -08:00
Jonathan Westhues 1ac083a9a2 Change the licensing so that we run unrestricted for ninety days
after first execution, but limit the number of constraints to 30
after 90 days.

[git-p4: depot-paths = "//depot/solvespace/": change = 1977]
2009-06-09 22:57:27 -08:00
Jonathan Westhues 603f47692e When exporting STEP, identify the outer contours, and group them
and their holes into their own advanced faces. So a single surface
with multiple outer contours generates multiple advanced faces.

Also turn the default chord tol down to 1.5 pixels, seems more
likely to make the exact surface Booleans work.

[git-p4: depot-paths = "//depot/solvespace/": change = 1975]
2009-06-08 08:21:33 -08:00
Jonathan Westhues 9455037e49 Add beginnings of STEP export, which weren't as horrible as I had
feared. Though I don't have rational surfaces or curves going yet,
and I don't have the stuff to handle holes or multiple outer
contours in a single surface.

[git-p4: depot-paths = "//depot/solvespace/": change = 1974]
2009-06-07 22:50:16 -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 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 9efa922795 Add a solver option to not calculate the failing constraints if
we're inconsistent (singular Jacobian). That's slow, so we should
provide a library interface to disable it.

[git-p4: depot-paths = "//depot/solvespace/": change = 1946]
2009-04-20 23:56:17 -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 11e4c7f5d9 Oops, don't just crash when the MAX_UNKNOWNS limit is exceeded.
[git-p4: depot-paths = "//depot/solvespace/": change = 1943]
2009-04-19 12:37:51 -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 bab13b821f Little optimizations in the solver; don't write the Jacobian
redundantly, more zero partial avoidance, slight speedup to linear
system solve.

[git-p4: depot-paths = "//depot/solvespace/": change = 1940]
2009-04-18 19:55:46 -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 775653a75d Add beginnings of exact curve export. We take the trim curves in
our specified section plane; we then split them according to the
start and endpoints of each STrimBy, using de Castejau's algorithm.
These sections get projected (possibly in perspective, which I do
correctly) into 2d and exported.

Except, for now they just get pwl'd in the export files. That's the
fallback, since it works for any file format. But that's the place
to add special cases for circles etc., or to export them exactly.
DXF supports the latter, but very painfully since I would need to
write a later-versioned file, which requires thousands of lines of
baggage. I'll probably stick with arcs.

[git-p4: depot-paths = "//depot/solvespace/": change = 1936]
2009-04-13 20:19:23 -08:00
Jonathan Westhues 7f3dd91bd9 Add a special case for line-cylinder intersection, solving in
closed form. This is a fairly good speedup, and handles tangency
well.

But that shows that tangency has other problems; need to classify
edges correctly (whether they point to a coincident surface) in
curved surfaces too. I need to tweak SShell::ClassifyPoint().

[git-p4: depot-paths = "//depot/solvespace/": change = 1933]
2009-03-19 09:40:11 -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 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 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 77cace05ce When clipping ears to triangulate a curved surface, clip the ear
that minimizes the chord tolerance.

[git-p4: depot-paths = "//depot/solvespace/": change = 1921]
2009-02-27 06:05:08 -08:00
Jonathan Westhues 90842131ff Make Boolean union work when the shells have coincident plane
faces. Still on planes only, no curved surface intersections.

[git-p4: depot-paths = "//depot/solvespace/": change = 1912]
2009-02-09 04:40:48 -08:00
Jonathan Westhues 95bded27ee Add eps, hpgl, and svg output (simple, all just for polylines). And
fix convergence tolerance so that points projected into a rational
polynomial surface end up much closer than LENGTH_EPS.

[git-p4: depot-paths = "//depot/solvespace/": change = 1906]
2009-01-26 21:48:40 -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 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 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 b8da4ed2b3 Split export DXF command into export section and export view, and
add framework for additional vector output formats (ps, pdf).

[git-p4: depot-paths = "//depot/solvespace/": change = 1893]
2009-01-13 21:10: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 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 0a56a63417 Add a trim command. I can now do circles (or arcs) against lines,
or lines against lines. The constraints get rather screwed up
afterwards, of course.

So make arcs with the endpoints coincident into circles, instead
of nothings; since the first split of a circle produces that.

And don't warn after deleting just point-coincident or horiz/vert
constraints as a dependency; that's just a nuisance, because it
happens too often.

[git-p4: depot-paths = "//depot/solvespace/": change = 1884]
2009-01-03 04:27:33 -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 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 962cb1af4a Add cutter radius compensation. That's a bolt on thing at the end;
just applies an offset to the DXF before exporting. Useful enough
to be worth the ugliness, though.

This is the stupid routines from SketchFlat, slightly reworked.

[git-p4: depot-paths = "//depot/solvespace/": change = 1866]
2008-08-14 00:28:25 -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 c42033d123 Add a configuration item to specify the maximum number of piecewise
linear segments to generate, irrespective of the chord tolerance.
That used to be hard-coded, and it needs to be small enough to
avoid lags while working interactively, but I also need to export
fine geometry.

[git-p4: depot-paths = "//depot/solvespace/": change = 1857]
2008-02-12 05:00:26 -08:00
Jonathan Westhues 0c10efdab6 Add a simple license key: I take the CRC of the license info, plus
some magic numbers. This would be trivial to break, but still more
difficult than patching the binary to skip the check...

[git-p4: depot-paths = "//depot/solvespace/": change = 1853]
2008-02-09 05:52:01 -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 f70bbb3e7f This BSP split and simplify thing is stupid, but a hard-coded limit
on the number of pieces that we know how to reassemble is even
stupider. Now dynamically allocated.

[git-p4: depot-paths = "//depot/solvespace/": change = 1837]
2008-07-13 04:58:52 -08:00