Interface OctNode

All Superinterfaces:
Serializable
All Known Implementing Classes:
OctNodeImpl, OctNodeInner, OctNodeLeaf

public interface OctNode extends Serializable
A single node of an Octree. Sharing vertices across meshes is supported (the node links all faces that share the same vertex).
  • Method Summary

    Modifier and Type
    Method
    Description
    getChild(javax.vecmath.Point3d point)
    Returns a child node in which a given 3D point is located.
    javax.vecmath.Point3d
    returns boundary box - corner with the smallest coordinates.
    getOctant(int index)
    Returns a child node (octant) under specific index
    Returns triangles which this oct node holds
    javax.vecmath.Point3d
    returns boundary box - corner with the largest coordinates.
    boolean
    Returns true if the node is a leave node.
    boolean
    isPointInside(javax.vecmath.Point3d point)
    Checks if a 3D point lies inside the cube
    javax.vecmath.Point3d
    Calculates the intersection of a ray with this node.
  • Method Details

    • isLeafNode

      boolean isLeafNode()
      Returns true if the node is a leave node.
      Returns:
      true if the node is a leave node.
    • getOctant

      OctNode getOctant(int index)
      Returns a child node (octant) under specific index
      Parameters:
      index - index of the octant returned. Must be between 0 and 7 including.
      Returns:
      Octant under specific index
    • getChild

      OctNode getChild(javax.vecmath.Point3d point)
      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 isPointInside(javax.vecmath.Point3d)).
      Parameters:
      point - point, must not be null
      Returns:
      Child node or null
    • getTriangles

      List<MeshTriangle> getTriangles()
      Returns triangles which this oct node holds
      Returns:
      triangles which this oct node holds
    • getLowerBound

      javax.vecmath.Point3d getLowerBound()
      returns boundary box - corner with the smallest coordinates.
      Returns:
      boundary box - corner with the smallest coordinates.
    • getUpperBound

      javax.vecmath.Point3d getUpperBound()
      returns boundary box - corner with the largest coordinates.
      Returns:
      boundary box - corner with the largest coordinates.
    • isPointInside

      boolean isPointInside(javax.vecmath.Point3d point)
      Checks if a 3D point lies inside the cube
      Parameters:
      point - A 3D point to be checked. Must not be null.
      Returns:
      true if the point is inside the node.
    • rayIntersection

      javax.vecmath.Point3d rayIntersection(Ray ray)
      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.
      Parameters:
      ray - Ray
      Returns:
      returns the intersection in the direction of the ray
      Throws:
      NullPointerException - if the ray is null