Class KdNodeImpl

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

public class KdNodeImpl extends Object implements KdNode
Implementation of k-D node.
See Also:
  • Constructor Details

    • KdNodeImpl

      public KdNodeImpl(MeshFacet facet, int index, int depth)
      Constructor for storing a vertex of a mesh facet.
      Parameters:
      facet - Mesh facet containing the mesh vertex. Must not be null
      index - The index under which the vertex is stored in the mesh facet. Must be >= 0
      depth - Depth of the node in the kd-tree. Must be >= 0
      Throws:
      IllegalArgumentException - if some parameter is wrong
    • KdNodeImpl

      public KdNodeImpl(List<MeshFacet> facets, List<Integer> indices, int depth)
      Constructor for storing a vertex belonging to multiple mesh facets.
      Parameters:
      facets - Mesh facets containing the mesh vertex. Must not be null or empty
      indices - Indices under which the vertex is stored in the mesh facet. Must be >= 0 and their unmber has to correspond to the number of facets.
      depth - Depth of the node in the kd-tree. Must be >= 0
      Throws:
      IllegalArgumentException - if some parameter is wrong
    • KdNodeImpl

      public KdNodeImpl(javax.vecmath.Point3d point, int depth)
      Constructor for storing an independent point.
      Parameters:
      point - A 3D point. Must not be null
      depth - Depth of the node in the kd-tree. Must be >= 0
      Throws:
      IllegalArgumentException - if some parameter is wrong
    • KdNodeImpl

      public KdNodeImpl(MeshPoint point, int depth)
      Constructor for storing an independent mesh point.
      Parameters:
      point - A meshpoint. Must not be null
      depth - Depth of the node in the kd-tree. Must be >= 0
      Throws:
      IllegalArgumentException - if some parameter is wrong
  • Method Details

    • 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.
    • 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
    • getLesser

      public KdNode 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 KdNode 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 KdNode 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 KdNode 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
    • toString

      public String toString()
      Overrides:
      toString in class Object