Package snap.gfx3d

Class BinarySpaceTree

java.lang.Object
snap.gfx3d.BinarySpaceTree

public class BinarySpaceTree extends Object
This class is a simple implementation of a Binary Space Partitioning Tree. By recursively adding nodes (shapes) this separates nodes into nodes in front and nodes not in front.
  • Field Details

  • Constructor Details

    • BinarySpaceTree

      public BinarySpaceTree(FacetShape aShape)
      Constructor.
  • Method Details

    • getShape

      public FacetShape getShape()
      Returns the shape.
    • addNode

      public boolean addNode(BinarySpaceTree aNode)
      Adds a node.
    • addCoplanarNode

      public BinarySpaceTree addCoplanarNode(BinarySpaceTree aNode)
      Adds a node to PlanarNode if planar.
    • compareNodePlanes

      public int compareNodePlanes(BinarySpaceTree aNode)
      Compare Node planes.
    • loadBackToFrontList

      public void loadBackToFrontList(List<FacetShape> sortedList)
      Loads a list from this node.
    • createBinarySpaceTree

      public static BinarySpaceTree createBinarySpaceTree(List<FacetShape> theShapes)
      Returns a BinarySpaceNode tree for given list of shapes.
    • sortShapesBackToFront

      public static void sortShapesBackToFront(List<FacetShape> theShapes)
      Sorts a list of shapes in paint order from back to front.