org.reprap.geometry.polygons
Class AllSTLsToBuild

java.lang.Object
  extended by org.reprap.geometry.polygons.AllSTLsToBuild

public class AllSTLsToBuild
extends java.lang.Object

This class holds a list of STLObjects that represents everything that is to be built. An STLObject may consist of items from several STL files, possible of different materials. But they are all tied together relative to each other in space.

Author:
Adrian

Nested Class Summary
(package private)  class AllSTLsToBuild.BoundingBox
          3D bounding box
(package private)  class AllSTLsToBuild.LineSegment
          Line segment consisting of two points.
(package private)  class AllSTLsToBuild.SliceCache
          Ring buffer cache to hold previously computed slices for doing infill and support material calculations.
 
Field Summary
private  AllSTLsToBuild.SliceCache cache
          Recently computed slices
private  boolean frozen
          Is the list editable?
private  java.util.List<STLObject> newstls
          New list of things to be built for reordering
private  java.util.List<RrRectangle> rectangles
          A plan box round each item
private  java.util.List<STLObject> stls
          The list of things to be built
private  AllSTLsToBuild.BoundingBox XYZbox
          The XYZ box around everything
private  RrInterval Zrange
          The lowest and highest points
 
Constructor Summary
AllSTLsToBuild()
          Simple constructor
 
Method Summary
 void add(AllSTLsToBuild a)
          Add a new collection
 void add(STLObject s)
          Add a new STLObject
private  void addAllEdges(javax.media.j3d.Shape3D shape, javax.media.j3d.Transform3D trans, double z, Attributes att, java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
          Run through a Shape3D and set edges from it at plane z Apply the transform first
private  void addEdge(javax.vecmath.Point3d p, javax.vecmath.Point3d q, javax.vecmath.Point3d r, double z, Attributes att, java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
          Add the edge where the plane z cuts the triangle (p, q, r) (if it does).
private  AllSTLsToBuild.BoundingBox BBox(java.lang.Object value, javax.media.j3d.Transform3D trans)
          Unpack the Shape3D(s) from value and find their exclosing XYZ box
private  AllSTLsToBuild.BoundingBox BBoxPoints(javax.media.j3d.Shape3D shape, javax.media.j3d.Transform3D trans)
          Run through a Shape3D and find its enclosing XYZ box
 RrPolygonList computeInfill(int stl, LayerRules layerConditions)
          Compute the infill hatching polygons for this set of patterns
 RrPolygonList computeOutlines(int stl, LayerRules layerConditions, RrPolygonList hatchedPolygons, boolean shield)
          Compute the outline polygons for this set of patterns.
 RrPolygonList computeSupport(int stl, LayerRules layerConditions)
          Compute the support hatching polygons for this set of patterns
 void destroyLayer()
           
private  int findSTL(STLObject st)
          Find an object in the list
private  void freeze()
          Freeze the list - no more editing.
 STLObject get(int i)
          Get the i-th STLObject
 STLObject getNextOne(STLObject st)
          Find an object in the list and return the next one.
private  RrPolygon getNextPolygon(java.util.ArrayList<AllSTLsToBuild.LineSegment> edges)
          Stitch together the some of the edges to form a polygon.
 double maxZ()
          Find the top of the highest object.
 RrRectangle ObjectPlanRectangle()
          Return the XY box round everything
private  void recursiveSetEdges(java.lang.Object value, javax.media.j3d.Transform3D trans, double z, Attributes att, java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
          Unpack the Shape3D(s) from value and set edges from them
 void remove(int i)
          Delete an object
 boolean reorderAdd(STLObject st)
          Reorder the list under user control.
private  RrPolygonList simpleCull(java.util.ArrayList<AllSTLsToBuild.LineSegment> edges)
          Get all the polygons represented by the edges.
 int size()
          Return the number of objects.
private  BooleanGridList slice(int stl, int layer, LayerRules layerRules)
          Generate a set of pixel-map representations, one for each extruder, for STLObject stl at height z.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stls

private java.util.List<STLObject> stls
The list of things to be built


rectangles

private java.util.List<RrRectangle> rectangles
A plan box round each item


newstls

private java.util.List<STLObject> newstls
New list of things to be built for reordering


XYZbox

private AllSTLsToBuild.BoundingBox XYZbox
The XYZ box around everything


Zrange

private RrInterval Zrange
The lowest and highest points


frozen

private boolean frozen
Is the list editable?


cache

private AllSTLsToBuild.SliceCache cache
Recently computed slices

Constructor Detail

AllSTLsToBuild

public AllSTLsToBuild()
Simple constructor

Method Detail

add

public void add(STLObject s)
Add a new STLObject

Parameters:
s -

add

public void add(AllSTLsToBuild a)
Add a new collection

Parameters:
s -

get

public STLObject get(int i)
Get the i-th STLObject

Parameters:
i -
Returns:

remove

public void remove(int i)
Delete an object

Parameters:
i -

findSTL

private int findSTL(STLObject st)
Find an object in the list

Parameters:
st -
Returns:

getNextOne

public STLObject getNextOne(STLObject st)
Find an object in the list and return the next one.

Parameters:
st -
Returns:

size

public int size()
Return the number of objects.

Returns:

reorderAdd

public boolean reorderAdd(STLObject st)
Reorder the list under user control. The user sends items from the old list one by one. These are added to a new list in that order. When there's only one left that is added last automatically. Needless to say, this process must be carried through to completion. The function returns true while the process is ongoing, false when it's complete.

Parameters:
st -
Returns:

freeze

private void freeze()
Freeze the list - no more editing. Also compute the XY box round everything. Also compute the individual plan boxes round each STLObject.


BBoxPoints

private AllSTLsToBuild.BoundingBox BBoxPoints(javax.media.j3d.Shape3D shape,
                                              javax.media.j3d.Transform3D trans)
Run through a Shape3D and find its enclosing XYZ box

Parameters:
shape -
trans -
z -

BBox

private AllSTLsToBuild.BoundingBox BBox(java.lang.Object value,
                                        javax.media.j3d.Transform3D trans)
Unpack the Shape3D(s) from value and find their exclosing XYZ box

Parameters:
value -
trans -
z -

ObjectPlanRectangle

public RrRectangle ObjectPlanRectangle()
Return the XY box round everything

Returns:

maxZ

public double maxZ()
Find the top of the highest object. Calling this freezes the list.

Returns:

getNextPolygon

private RrPolygon getNextPolygon(java.util.ArrayList<AllSTLsToBuild.LineSegment> edges)
Stitch together the some of the edges to form a polygon.

Parameters:
edges -
Returns:

simpleCull

private RrPolygonList simpleCull(java.util.ArrayList<AllSTLsToBuild.LineSegment> edges)
Get all the polygons represented by the edges.

Parameters:
edges -
Returns:

computeSupport

public RrPolygonList computeSupport(int stl,
                                    LayerRules layerConditions)
Compute the support hatching polygons for this set of patterns

Parameters:
stl -
layerConditions -
Returns:

computeInfill

public RrPolygonList computeInfill(int stl,
                                   LayerRules layerConditions)
Compute the infill hatching polygons for this set of patterns

Parameters:
stl -
layerConditions -
startNearHere -
Returns:

computeOutlines

public RrPolygonList computeOutlines(int stl,
                                     LayerRules layerConditions,
                                     RrPolygonList hatchedPolygons,
                                     boolean shield)
Compute the outline polygons for this set of patterns.

Parameters:
layerConditions -
hatchedPolygons -
shield -
Returns:

slice

private BooleanGridList slice(int stl,
                              int layer,
                              LayerRules layerRules)
Generate a set of pixel-map representations, one for each extruder, for STLObject stl at height z.

Parameters:
stl -
z -
extruders -
Returns:

destroyLayer

public void destroyLayer()

addEdge

private void addEdge(javax.vecmath.Point3d p,
                     javax.vecmath.Point3d q,
                     javax.vecmath.Point3d r,
                     double z,
                     Attributes att,
                     java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
Add the edge where the plane z cuts the triangle (p, q, r) (if it does). Also update the triangulation of the object below the current slice used for the simulation window.

Parameters:
p -
q -
r -
z -

addAllEdges

private void addAllEdges(javax.media.j3d.Shape3D shape,
                         javax.media.j3d.Transform3D trans,
                         double z,
                         Attributes att,
                         java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
Run through a Shape3D and set edges from it at plane z Apply the transform first

Parameters:
shape -
trans -
z -

recursiveSetEdges

private void recursiveSetEdges(java.lang.Object value,
                               javax.media.j3d.Transform3D trans,
                               double z,
                               Attributes att,
                               java.util.ArrayList<AllSTLsToBuild.LineSegment>[] edges)
Unpack the Shape3D(s) from value and set edges from them

Parameters:
value -
trans -
z -