This commit consists of numerous small changes, none significant enough to
merit a commit on their own:
* Added extra braces to quash for-loop variable scoping issues for older
compilers (or "g++ -fno-for-scope")
* Appeased "unreachable code" warnings, spurious or otherwise
* Added casts to fix integer-variable signedness warnings
* Added a dummy virtual method to the VectorFileWriter class to silence the
-Wweak-vtables warning from Clang++
* Renamed some parameters in the Expr and GraphicsWindow classes to
eliminate "parameter shadows a field" warnings
* Removed an inert "0 ||" from a conditional, and changed a "&& 0" into an
"#if 0"
* Added missing elements to array/struct/class initializers to zap further
warnings
* Indented some cpp conditionals where appropriate
* Qualified some variables and functions as static to quiet "no previous
declaration" warnings
* toolbar.cpp needed to #include<icons-proto.h> to fix those same "no
previous declaration" warnings from icons.h
* Added some casts and const qualifiers to the Win32 code to address
warnings produced by g++ when compiling under MinGW
* Rewrote Cnf{Freeze,Thaw}Float() to use a union rather than pointer
aliasing; this makes g++ a lot happier
* Removed redundant #includes from win32/w32util.cpp
* With Jonathan's blessing, shortened the last line of the About dialog
text to better match the preceding lines
This commit contains a grab bag of minor changes not worth committing
individually:
* Replaced raw Latin-1 characters with octal escapes to avoid source-file
encoding issues
* Undefined some convenience macros after they've served their purpose
* Rewrote SEdge::From() to avoid confusing less-capable C++ compilers
* Have oops() print a newline at the end of its message
* Removed "static" keyword from the Bernstein() function definition, as it
has a non-static prototype in srf/surface.h
* Added casts (and changed a variable type) to quell warnings about integer
size and signedness
* Simplified an expression with our handy arraylen() macro
This addresses a grab bag of compiler grievances relating to C++ syntax,
type, and scope, as observed on Linux with g++ and Solaris with Sun
WorkShop 6.
Whether or not there is any actual danger of these variables being used
without initialization, the warnings are noise, and getting rid of them is
trivial.
easy and useful. Also make the volume measurement use Message(),
and not a separate text window screen.
And make Edit -> Unselect All (Esc) clear the marks drawn to
indicate free parameters, since it clears all the other temporary
stuff drawn in the graphics window.
[git-p4: depot-paths = "//depot/solvespace/": change = 2121]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
* 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]
trim curves for all surfaces lie between 0 and 1. And add routines
to merge the curves and surfaces from two shells into one, and to
split the trim curves into their piecewise linear segments and then
reassemble them into trim curves.
[git-p4: depot-paths = "//depot/solvespace/": change = 1905]
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]
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]
A touches edge B, but does not share a vertex with edge B, then
that's an intersection.
Adjust the ear clipping so that it generates strip-like
triangulations, not fan-like.
And rearrange deck chairs on the bridge-finding code, which is
still pathetically slow. It may not be possible to get reasonable
performance without kd tree type acceleration.
[git-p4: depot-paths = "//depot/solvespace/": change = 1901]
is O(n^2), not perfectly robust, and the bridge-finding code is
particularly bad. But it works, triangulates, and shouldn't ever
generate zero-area triangles like gl does.
[git-p4: depot-paths = "//depot/solvespace/": change = 1900]
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]
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]
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]
groups, rename "drawing" groups to "sketch" groups, and keep
assembling even after finding an open curve.
[git-p4: depot-paths = "//depot/solvespace/": change = 1835]
which I will shortly revert. gl does a much better job, and I'll
have to spend more time to get something reasonable.
[git-p4: depot-paths = "//depot/solvespace/": change = 1809]
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]
and rotates, auto-constrain translates in active workplane, speed
up remap list search with a hash table, other stuff.
[git-p4: depot-paths = "//depot/solvespace/": change = 1786]
just the mesh, no derived entities (but I suppose that I could turn
all points into circles).
And fix some bugs where equations didn't get unique IDs, and make
it possible to lock on to the group's workplane automatically, if
you press W while free in 3d with no workplane selected.
[git-p4: depot-paths = "//depot/solvespace/": change = 1780]
to save our registry stuff (because we were calling exit() instead
of doing a PostQuitMessage()), and a misclassification of triangles
coplanar with the test surface, when the test surface contained
zero-area triangles.
[git-p4: depot-paths = "//depot/solvespace/": change = 1773]
metadata. And add point-on-face constraints to go with that. Still
needs some cleanup for the user interface.
[git-p4: depot-paths = "//depot/solvespace/": change = 1766]
create a `new' stack-allocated instance of an object; just From,
possibly different versions with different arg types.
[git-p4: depot-paths = "//depot/solvespace/": change = 1763]
csg ops; so the union of a red part and a blue part has both red
and blue faces. And some user interface to pick the color in the
text window.
The metadata also include a face, which will be an entity; I can
use that to constrain against. But none of that is yet implemented.
[git-p4: depot-paths = "//depot/solvespace/": change = 1757]
set of coplanar faces. The polygon count still gets stupid fast;
I'm thinking I can fix that by adding some extra test planes at the
top of the 3d BSP, to quickly cull out stuff that doesn't intersect
us.
[git-p4: depot-paths = "//depot/solvespace/": change = 1736]
a triangle mesh in a BSP. That works, although it splits too often,
the initial triangulations are not good quality, and coplanar faces
are not yet handled. I'll do the coplanar thing tomorrow.
[git-p4: depot-paths = "//depot/solvespace/": change = 1735]
for that, and storing the triangles instead of rendering them
immediately. Not sure if that's smart; in theory could change from
implementation to implementation, but the results look much better
than I would get myself.
[git-p4: depot-paths = "//depot/solvespace/": change = 1733]
not very well; I'm doing a b-rep, where the boundaries are complex
polygons, and there's too many special cases. I should probably
replace this with a triangle mesh solution.
[git-p4: depot-paths = "//depot/solvespace/": change = 1731]
sketch (e.g., a line whose length is constrained gets deleted, but
the constraint is left behind; or the point that's the origin for a
drawing group in plane gets deleted), then deleted the dependencies
too.
[git-p4: depot-paths = "//depot/solvespace/": change = 1725]
workplanes. And fix up our polygon normals, so that everything gets
shaded correctly (and so that later we can generate our STL files
with correct normals).
[git-p4: depot-paths = "//depot/solvespace/": change = 1706]