Open clothbot opened 14 years ago
As I try to sketch out some pseudo-code, maybe the Path2D class would be a better fit for the boolean ops.
Looks like the Java built-in Area class may be all it takes: http://download.oracle.com/javase/6/docs/api/java/awt/geom/Area.html
That Area class is beautiful. We do need one other thing in addition to boolean geometry operators, though... we need an inset/outset/offset operator. This could be implemented using clever boolean operators, but I suspect that may be a slow way of doing that.
Wrote up a simple example to exercise the Java Area class in Processing: http://github.com/clothbot/Processing/tree/master/tests/AreaBooleans/
Half-way there. I reworked some of the Java class inheritance and exercise the SlicePath approach in the DXF export function.
Got the Area class working and added shelling and bridge detection to the DXF export. Very handy being able to visualize the post-op slices in OpenSCAD. :-)
Did some rework of the DXF export; SliceAreaList and ShellAreaList are written to separate files to.
GCode output is using the Area-based stuff as well. Got it writing out the Slice outline and one internal shell.
Next up is the fill pattern generation. It's the most complex part, but shouldn't be too hard by intersecting sparse arrays of long+thin rectangles (alternating directions per layer) with each slice area, and dense arrays with bridges (bottom and top surfaces are just degenerate bridge cases).
Basic sparse, bridge and local maxima fill added. Needs lots of work, but the basic idea is there and it all operates off the Java 2D boolean operation functions.
It almost looks passable when you write out the GCode bring up the resulting code in Pleasant 3D for visualizing.
It's far from done though. The bridge loops always need to start at supported points; it's currently an arbitrary starting point.
Note to self: This Darth Vader head is a nice and dirty STL to exercise slice-level repair operations on - http://www.thingiverse.com/thing:609
For the record, my benchmark with one of my poseable Blender models went as follows: Skeinforge: 3 minutes SuperSkein: 27 seconds Skeinforge: blatantly switched off the extruder for large parts of the mesh SuperSkein: well, had some jittery bits I'm not happy about, but it'd print.
Things are going WELL right now.
At the very least, we need fast versions of the following 2D geometric boolean operations supported. It'll make generating fill and shell operations a lot easier, and enable more complex inter-slice operations for things like bridge-detection, adding support structures, etc. I'm borrowing the operation names used in the EDA/IC Design world for these sorts of functions:
geomAnd: Equivalent to the "intersection" operation in OpenSCAD (see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#intersection)
geomOr: Equivalent to the "union" operation in OpenSCAD (see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#union)
geomAndNot: Equivalent to the "difference" operation in OpenSCAD (see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#difference)