Ocean
Ocean::Geometry::OctreeT< T > Class Template Reference

Forward declaration. More...

Data Structures

class  Parameters
 This class stores construction parameters for an octree. More...
 
class  ReusableData
 Definition of a class which holds reusable data for internal use. More...
 

Public Types

typedef T Type
 The data type of this octree. More...
 

Public Member Functions

 OctreeT ()=default
 Default constructor creating an empty tree. More...
 
 OctreeT (const OctreeT &octree)=delete
 Disabled copy constructor. More...
 
 OctreeT (OctreeT &&octree)
 Move constructor. More...
 
 OctreeT (const VectorT3< T > *treePoints, const size_t numberTreePoints, const Parameters &parameters=Parameters())
 Creates a new Octree for a given set of 3D points. More...
 
 ~OctreeT ()
 Destructs this tree node. More...
 
const BoundingBoxboundingBox () const
 Returns the bounding box containing all points of this node (of all points in all child leaf nodes) More...
 
const Indices32pointIndices () const
 Returns the indices of the tree points which belong to this leaf node. More...
 
const OctreeT< T > *const * childNodes () const
 Returns the eight child nodes of this tree node. More...
 
void closestLeafs (const VectorT3< T > &queryPoint, const T maximalDistance, std::vector< const Indices32 * > &leafs, const ReusableData &reusableData=ReusableData()) const
 Returns the closest leaf nodes for a given query point. More...
 
void intersectingLeafs (const LineT3< T > &queryRay, std::vector< const Indices32 * > &leafs, const ReusableData &reusableData=ReusableData()) const
 Returns the intersecting leaf nodes for a given query ray. More...
 
void intersectingLeafs (const LineT3< T > &queryRay, const Scalar tanHalfAngle, std::vector< const Indices32 * > &leafs, const ReusableData &reusableData=ReusableData()) const
 Returns the intersecting leaf nodes for a given approximated query cone expressed as a ray with a cone apex angle. More...
 
void closestPoints (const VectorT3< T > *treePoints, const VectorT3< T > &queryPoint, const T maximalDistance, Indices32 &pointIndices, VectorsT3< T > *points=nullptr, const ReusableData &reusableData=ReusableData()) const
 Returns the closest tree points for a given query point. More...
 
bool isValid () const
 Returns whether this node is valid (if this node has a valid bounding box) More...
 
OctreeToperator= (OctreeT &&octree)
 Move operator. More...
 
OctreeToperator= (const OctreeT &octree)=delete
 Disabled copy constructor. More...
 

Protected Member Functions

 OctreeT (const Parameters &parameters, const VectorT3< T > *treePoints, Index32 *reusablePointIndicesInput, Index32 *reusablePointIndicesOutput, const size_t numberPointIndices, const BoundingBox &boundingBox)
 Creates a new octree node. More...
 

Protected Attributes

BoundingBox boundingBox_
 The bounding box of this tree node. More...
 
Indices32 pointIndices_
 The indicies of the tree points which belong to this leaf node, empty if this node is not a leaf node. More...
 
OctreeT< T > * childNodes_ [8] = {nullptr}
 The eight child nodes. More...
 

Detailed Description

template<typename T>
class Ocean::Geometry::OctreeT< T >

Forward declaration.

This class implements an Octree allowing to manage 3D points.

Each node in the Octree has exactly eight child nodes (unless it is a leaf node).

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Ocean::Geometry::OctreeT< T >::Type

The data type of this octree.

Constructor & Destructor Documentation

◆ OctreeT() [1/5]

template<typename T >
Ocean::Geometry::OctreeT< T >::OctreeT ( )
default

Default constructor creating an empty tree.

◆ OctreeT() [2/5]

template<typename T >
Ocean::Geometry::OctreeT< T >::OctreeT ( const OctreeT< T > &  octree)
delete

Disabled copy constructor.

Parameters
octreeThe octree which would be copied

◆ OctreeT() [3/5]

template<typename T >
Ocean::Geometry::OctreeT< T >::OctreeT ( OctreeT< T > &&  octree)

Move constructor.

Parameters
octreeThe octree to be moved

◆ OctreeT() [4/5]

template<typename T >
Ocean::Geometry::OctreeT< T >::OctreeT ( const VectorT3< T > *  treePoints,
const size_t  numberTreePoints,
const Parameters parameters = Parameters() 
)

Creates a new Octree for a given set of 3D points.

The given points must not change afterwards, the points must exist as long as the tree exists.

Parameters
treePointsThe points for which the tree will be created, can be 'nullptr' if 'numberTreePoints == 0'
numberTreePointsThe number given tree points, with range [0, infinity)
parametersThe parameters to used to construct the tree, must be valid

◆ ~OctreeT()

template<typename T >
Ocean::Geometry::OctreeT< T >::~OctreeT

Destructs this tree node.

◆ OctreeT() [5/5]

template<typename T >
Ocean::Geometry::OctreeT< T >::OctreeT ( const Parameters parameters,
const VectorT3< T > *  treePoints,
Index32 reusablePointIndicesInput,
Index32 reusablePointIndicesOutput,
const size_t  numberPointIndices,
const BoundingBox boundingBox 
)
protected

Creates a new octree node.

Parameters
parametersThe parameters to be used, must be valid
treePointsThe points for which the tree will be created, must be valid
reusablePointIndicesInputThe indices of the points for which the new node will be created, must be valid
reusablePointIndicesOutputMemory block of indices with same size as 'reusableIndicesInput' which can be re-used internally, must be valid
numberPointIndicesThe number of given indices in 'reusablePointIndicesInput', with range [0, infinity)
boundingBoxThe bounding box of the new child node; will be ignored if parameters.useTightBoundingBoxes_ == true

Member Function Documentation

◆ boundingBox()

template<typename T >
const BoundingBox & Ocean::Geometry::OctreeT< T >::boundingBox
inline

Returns the bounding box containing all points of this node (of all points in all child leaf nodes)

Returns
The tree node's bounding box

◆ childNodes()

template<typename T >
const OctreeT< T > *const * Ocean::Geometry::OctreeT< T >::childNodes
inline

Returns the eight child nodes of this tree node.

Returns
The node's eight child node, nullptr if this node is a leaf node

◆ closestLeafs()

template<typename T >
void Ocean::Geometry::OctreeT< T >::closestLeafs ( const VectorT3< T > &  queryPoint,
const T  maximalDistance,
std::vector< const Indices32 * > &  leafs,
const ReusableData reusableData = ReusableData() 
) const

Returns the closest leaf nodes for a given query point.

Parameters
queryPointThe query point for which the closest leaf nodes will be returned
maximalDistanceThe maximal distance between the query point and any potential point in a leaf node, with range [0, infinity)
leafsThe resulting leaf nodes, mainly the point indices of the tree points which stored in the closest leaf nodes
reusableDataAn reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other

◆ closestPoints()

template<typename T >
void Ocean::Geometry::OctreeT< T >::closestPoints ( const VectorT3< T > *  treePoints,
const VectorT3< T > &  queryPoint,
const T  maximalDistance,
Indices32 pointIndices,
VectorsT3< T > *  points = nullptr,
const ReusableData reusableData = ReusableData() 
) const

Returns the closest tree points for a given query point.

Parameters
treePointsThe tree points from which the closest points will be determined (must be the same points for which the tree has been created), must be valid
queryPointThe query point for which the closest points will be returned
maximalDistanceThe maximal distance between the query point and any potential tree point in a leaf node, with range [0, infinity)
pointIndicesThe resulting indices of the tree points which have a maximal distance of 'maximalDistance' to the query point
pointsOptional resulting tree points, one for each resulting index, will be {treePoints[pointIndices[0]], treePoints[pointIndices[1]], ..., treePoints[pointIndices[pointIndices.size() - 1]]}; nullptr if not of interest
reusableDataAn reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other

◆ intersectingLeafs() [1/2]

template<typename T >
void Ocean::Geometry::OctreeT< T >::intersectingLeafs ( const LineT3< T > &  queryRay,
const Scalar  tanHalfAngle,
std::vector< const Indices32 * > &  leafs,
const ReusableData reusableData = ReusableData() 
) const

Returns the intersecting leaf nodes for a given approximated query cone expressed as a ray with a cone apex angle.

This function applies an approximation to determine the distance between the cone's apex and leaf nodes.

Parameters
queryRayThe query ray defining the apex and axis of the cone for which the intersecting leaf nodes will be returned, the search treats the ray as an infinite ray in space, must be valid
tanHalfAngleThe tangent of the cone's half apex angle, e.g., Numeric::tan(Numeric::deg2rad(1)), with range [0, 1)
leafsThe resulting leaf nodes, mainly the point indices of the tree points which stored in the intersecting leaf nodes
reusableDataAn reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other

◆ intersectingLeafs() [2/2]

template<typename T >
void Ocean::Geometry::OctreeT< T >::intersectingLeafs ( const LineT3< T > &  queryRay,
std::vector< const Indices32 * > &  leafs,
const ReusableData reusableData = ReusableData() 
) const

Returns the intersecting leaf nodes for a given query ray.

Parameters
queryRayThe query ray for which the intersecting leaf nodes will be returned, the search treats the ray as an infinite ray in space, must be valid
leafsThe resulting leaf nodes, mainly the point indices of the tree points which stored in the intersecting leaf nodes
reusableDataAn reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other

◆ isValid()

template<typename T >
bool Ocean::Geometry::OctreeT< T >::isValid
inline

Returns whether this node is valid (if this node has a valid bounding box)

Returns
True, if so

◆ operator=() [1/2]

template<typename T >
OctreeT& Ocean::Geometry::OctreeT< T >::operator= ( const OctreeT< T > &  octree)
delete

Disabled copy constructor.

Parameters
octreeThe octree which would be copied
Returns
Reference to this octree

◆ operator=() [2/2]

template<typename T >
OctreeT< T > & Ocean::Geometry::OctreeT< T >::operator= ( OctreeT< T > &&  octree)

Move operator.

Parameters
octreeThe octree to be moved
Returns
Reference to this octree

◆ pointIndices()

template<typename T >
const Indices32 & Ocean::Geometry::OctreeT< T >::pointIndices
inline

Returns the indices of the tree points which belong to this leaf node.

Returns
The leaf node's point indices, empty if this node is not a leaf node

Field Documentation

◆ boundingBox_

template<typename T >
BoundingBox Ocean::Geometry::OctreeT< T >::boundingBox_
protected

The bounding box of this tree node.

◆ childNodes_

template<typename T >
OctreeT<T>* Ocean::Geometry::OctreeT< T >::childNodes_[8] = {nullptr}
protected

The eight child nodes.

◆ pointIndices_

template<typename T >
Indices32 Ocean::Geometry::OctreeT< T >::pointIndices_
protected

The indicies of the tree points which belong to this leaf node, empty if this node is not a leaf node.


The documentation for this class was generated from the following file: