MaskedRetriever / SuperSkein

Open Source 3D Mesh Slicer in Processing: Generates gcode from stl files.
http://www.thingiverse.com/thing:3649
GNU General Public License v3.0
70 stars 11 forks source link

Add 2D geometric boolean operations to Slice class #12

Open clothbot opened 14 years ago

clothbot commented 14 years ago

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)

clothbot commented 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.

clothbot commented 14 years ago

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

revarbat commented 14 years ago

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.

clothbot commented 13 years ago

Wrote up a simple example to exercise the Java Area class in Processing: http://github.com/clothbot/Processing/tree/master/tests/AreaBooleans/

clothbot commented 13 years ago

Half-way there. I reworked some of the Java class inheritance and exercise the SlicePath approach in the DXF export function.

clothbot commented 13 years ago

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. :-)

clothbot commented 13 years ago

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).

clothbot commented 13 years ago

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.

clothbot commented 13 years ago

It's far from done though. The bridge loops always need to start at supported points; it's currently an arbitrary starting point.

clothbot commented 13 years ago

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

MaskedRetriever commented 13 years ago

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.