Class TriangleKdNodeImpl

java.lang.Object
cz.fidentis.analyst.data.kdtree.impl.TriangleKdNodeImpl
All Implemented Interfaces:
KdNode, TriangleKdNode, Serializable

public class TriangleKdNodeImpl extends Object implements TriangleKdNode
!!!EXPERIMENTAL!!! Node of a TriangleKdTree. Either an inner node or a leaf node. Inner node stores its splitting plane and left, right, and parent nodes. Leaf node stores MeshTriangles.
See Also:
  • Constructor Details

    • TriangleKdNodeImpl

      public TriangleKdNodeImpl(double split, int depth, TriangleKdNode parent)
      Inner node constructor.
      Parameters:
      split - Position of splitting plane in either x/y/z depending on depth.
      depth - Depth of node in TriangleKdTree.
      parent - Parent TriangleKdNode or null if root node.
    • TriangleKdNodeImpl

      public TriangleKdNodeImpl(List<MeshTriangleBoundingBox> triangles, int depth, TriangleKdNode parent)
      Leaf constructor.
      Parameters:
      triangles - List of stored triangles with their bounding boxes.
      depth - Depth of node in TriangleKdTree.
      parent - Parent TriangleKdNode or null if root node.
  • Method Details

    • getTriangles

      public List<MeshTriangle> getTriangles()
      Gets triangles stored in node.
      Specified by:
      getTriangles in interface TriangleKdNode
      Returns:
      List of triangles stored in node. Empty list if node is not a leaf.
    • getTriangleBoundingBoxes

      public List<MeshTriangleBoundingBox> getTriangleBoundingBoxes()
      Gets triangles with their bounding boxes.
      Specified by:
      getTriangleBoundingBoxes in interface TriangleKdNode
      Returns:
      List of triangles with their bounding boxes stored in node. Empty list if node is not a leaf.
    • getDepth

      public int getDepth()
      Description copied from interface: KdNode
      Returns depth of the node in the tree.
      Specified by:
      getDepth in interface KdNode
      Returns:
      depth of the node in the tree.
    • getSplit

      public double getSplit()
      Description copied from interface: TriangleKdNode
      Gets splitting plane position on axis according to depth.
      Specified by:
      getSplit in interface TriangleKdNode
      Returns:
      Splitting plane position on either x/y/z based on depth.
    • isLeaf

      public boolean isLeaf()
      Description copied from interface: TriangleKdNode
      Check if current node is leaf.
      Specified by:
      isLeaf in interface TriangleKdNode
      Returns:
      true if it is a leaf node. false otherwise.
    • getLocation

      public javax.vecmath.Point3d getLocation()
      Description copied from interface: KdNode
      Returns 3D location of vertices stored in this node
      Specified by:
      getLocation in interface KdNode
      Returns:
      3D location of vertices stored in this node
    • getParent

      public TriangleKdNode getParent()
      Description copied from interface: TriangleKdNode
      Gets parent of this node or null if it is the root node.
      Specified by:
      getParent in interface TriangleKdNode
      Returns:
      Parent node.
    • getLesser

      public TriangleKdNode getLesser()
      Description copied from interface: KdNode
      Tree traversal - go to the "lesser" child.
      Specified by:
      getLesser in interface KdNode
      Returns:
      lesser node, null if current node is leaf
    • getGreater

      public TriangleKdNode getGreater()
      Description copied from interface: KdNode
      Tree traversal - go to the "grater" child.
      Specified by:
      getGreater in interface KdNode
      Returns:
      greater node, null if current node is leaf
    • setLesser

      public TriangleKdNode setLesser(KdNode lesser)
      Description copied from interface: KdNode
      Set lesser node.
      Specified by:
      setLesser in interface KdNode
      Parameters:
      lesser - Node to be set as lesser
      Returns:
      current node
    • setGreater

      public TriangleKdNode setGreater(KdNode greater)
      Description copied from interface: KdNode
      Set lesser node.
      Specified by:
      setGreater in interface KdNode
      Parameters:
      greater - Node to be set as greater
      Returns:
      current node
    • getFacets

      public Map<MeshFacet,Integer> getFacets()
      Description copied from interface: KdNode
      Returns a map of all mesh facets that share the stored vertex. Value in the map contains the index which the vertex is stored in the mesh facet.
      Specified by:
      getFacets in interface KdNode
      Returns:
      Map of facets sharing the stored mesh vertex