Class OctNodeImpl
java.lang.Object
cz.fidentis.analyst.data.octree.impl.OctNodeImpl
- All Implemented Interfaces:
OctNode
,Serializable
- Direct Known Subclasses:
OctNodeInner
,OctNodeLeaf
Implementation of an Octree node.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OctNodeImpl
(javax.vecmath.Point3d smallest, javax.vecmath.Point3d largest, List<MeshTriangle> triangles, List<OctNodeImpl> octants) -
Method Summary
Modifier and TypeMethodDescriptiongetChild
(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 indexReturns triangles which this oct node holdsjavax.vecmath.Point3d
returns boundary box - corner with the largest coordinates.boolean
Returnstrue
if the node is a leave node.boolean
isPointInside
(javax.vecmath.Point3d point) Checks if a 3D point lies inside the cubejavax.vecmath.Point3d
rayIntersection
(Ray ray) Calculates the intersection of a ray with this node.toString()
protected String
toString
(int decimalPlaces) toString overrideprotected String
toString helper function for tree like printingprotected String
toString helper function for tree like printingprotected String
toString helper function for tree like printing
-
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
Returnstrue
if the node is a leave node.- Specified by:
isLeafNode
in interfaceOctNode
- Returns:
true
if the node is a leave node.
-
getOctant
Description copied from interface:OctNode
Returns a child node (octant) under specific index -
getChild
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, thenull
is returned. It is supposed that the point is inside (or at the boundary) of the node's bounding cube (seeOctNode.isPointInside(javax.vecmath.Point3d)
). -
getTriangles
Description copied from interface:OctNode
Returns triangles which this oct node holds- Specified by:
getTriangles
in interfaceOctNode
- 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 interfaceOctNode
- 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 interfaceOctNode
- 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 interfaceOctNode
- Parameters:
point
- A 3D point to be checked. Must not benull
.- Returns:
true
if thepoint
is inside the node.
-
rayIntersection
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 interfaceOctNode
- Parameters:
ray
- Ray- Returns:
- returns the intersection in the direction of the ray
-
toString
-
toString
toString override- Parameters:
decimalPlaces
- number of decimal places to be used in printing for double numbers- Returns:
- string representation of the current node
-
toString
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
toString helper function for tree like printing- Parameters:
prefix
- prefix before representing current nodedecimalPlaces
- number of decimal places to be used in printing for double numbers- Returns:
- string representation of the current node and it's subtree
-
toString
toString helper function for tree like printing- Parameters:
prefix
- prefix before representing current nodeprintEmpty
- whether empty nodes should be skipped or printed for their boundariesdecimalPlaces
- number of decimal places to be used in printing for double numbers- Returns:
- string representation of the current node and it's subtree
-