Class OctNodeImpl

java.lang.Object
cz.fidentis.analyst.data.octree.impl.OctNodeImpl
All Implemented Interfaces:
OctNode, Serializable
Direct Known Subclasses:
OctNodeInner, OctNodeLeaf

public abstract class OctNodeImpl extends Object implements OctNode
Implementation of an Octree node.
See Also:
  • Constructor Details

    • OctNodeImpl

      protected OctNodeImpl(javax.vecmath.Point3d smallest, javax.vecmath.Point3d largest, List<MeshTriangle> triangles, List<OctNodeImpl> octants)
  • Method Details

    • isLeafNode

      public boolean isLeafNode()
      Description copied from interface: OctNode
      Returns true if the node is a leave node.
      Specified by:
      isLeafNode in interface OctNode
      Returns:
      true if the node is a leave node.
    • getOctant

      public OctNode getOctant(int index)
      Description copied from interface: OctNode
      Returns a child node (octant) under specific index
      Specified by:
      getOctant in interface OctNode
      Parameters:
      index - index of the octant returned. Must be between 0 and 7 including.
      Returns:
      Octant under specific index
    • getChild

      public OctNode getChild(javax.vecmath.Point3d point)
      Description copied from interface: OctNode
      Returns a child node in which a given 3D point is located. If the point lies on the dividing planes of the cube, then the "lower" child (octant) is returned. If this node is leaf, the null is returned. It is supposed that the point is inside (or at the boundary) of the node's bounding cube (see OctNode.isPointInside(javax.vecmath.Point3d)).
      Specified by:
      getChild in interface OctNode
      Parameters:
      point - point, must not be null
      Returns:
      Child node or null
    • getTriangles

      public List<MeshTriangle> getTriangles()
      Description copied from interface: OctNode
      Returns triangles which this oct node holds
      Specified by:
      getTriangles in interface OctNode
      Returns:
      triangles which this oct node holds
    • getLowerBound

      public javax.vecmath.Point3d getLowerBound()
      Description copied from interface: OctNode
      returns boundary box - corner with the smallest coordinates.
      Specified by:
      getLowerBound in interface OctNode
      Returns:
      boundary box - corner with the smallest coordinates.
    • getUpperBound

      public javax.vecmath.Point3d getUpperBound()
      Description copied from interface: OctNode
      returns boundary box - corner with the largest coordinates.
      Specified by:
      getUpperBound in interface OctNode
      Returns:
      boundary box - corner with the largest coordinates.
    • isPointInside

      public boolean isPointInside(javax.vecmath.Point3d point)
      Description copied from interface: OctNode
      Checks if a 3D point lies inside the cube
      Specified by:
      isPointInside in interface OctNode
      Parameters:
      point - A 3D point to be checked. Must not be null.
      Returns:
      true if the point is inside the node.
    • rayIntersection

      public javax.vecmath.Point3d rayIntersection(Ray ray)
      Description copied from interface: OctNode
      Calculates the intersection of a ray with this node. If the ray's origin is inside the node's cube, then the second (leaving) intersection is returned. Otherwise, the first (entering) intersection is returned.
      Specified by:
      rayIntersection in interface OctNode
      Parameters:
      ray - Ray
      Returns:
      returns the intersection in the direction of the ray
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      protected String toString(int decimalPlaces)
      toString override
      Parameters:
      decimalPlaces - number of decimal places to be used in printing for double numbers
      Returns:
      string representation of the current node
    • toString

      protected String toString(String prefix)
      toString helper function for tree like printing
      Parameters:
      prefix - prefix before representing current node
      Returns:
      string representation of the current node and it's subtree
    • toString

      protected String toString(String prefix, int decimalPlaces)
      toString helper function for tree like printing
      Parameters:
      prefix - prefix before representing current node
      decimalPlaces - number of decimal places to be used in printing for double numbers
      Returns:
      string representation of the current node and it's subtree
    • toString

      protected String toString(String prefix, boolean printEmpty, int decimalPlaces)
      toString helper function for tree like printing
      Parameters:
      prefix - prefix before representing current node
      printEmpty - whether empty nodes should be skipped or printed for their boundaries
      decimalPlaces - number of decimal places to be used in printing for double numbers
      Returns:
      string representation of the current node and it's subtree