Ocean
|
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 ¶meters=Parameters()) | |
Creates a new Octree for a given set of 3D points. More... | |
~OctreeT () | |
Destructs this tree node. More... | |
const BoundingBox & | boundingBox () const |
Returns the bounding box containing all points of this node (of all points in all child leaf nodes) More... | |
const Indices32 & | pointIndices () 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... | |
OctreeT & | operator= (OctreeT &&octree) |
Move operator. More... | |
OctreeT & | operator= (const OctreeT &octree)=delete |
Disabled copy constructor. More... | |
Protected Member Functions | |
OctreeT (const Parameters ¶meters, 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... | |
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).
typedef T Ocean::Geometry::OctreeT< T >::Type |
The data type of this octree.
|
default |
Default constructor creating an empty tree.
|
delete |
Disabled copy constructor.
octree | The octree which would be copied |
Ocean::Geometry::OctreeT< T >::OctreeT | ( | OctreeT< T > && | octree | ) |
Move constructor.
octree | The octree to be moved |
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.
treePoints | The points for which the tree will be created, can be 'nullptr' if 'numberTreePoints == 0' |
numberTreePoints | The number given tree points, with range [0, infinity) |
parameters | The parameters to used to construct the tree, must be valid |
Ocean::Geometry::OctreeT< T >::~OctreeT |
Destructs this tree node.
|
protected |
Creates a new octree node.
parameters | The parameters to be used, must be valid |
treePoints | The points for which the tree will be created, must be valid |
reusablePointIndicesInput | The indices of the points for which the new node will be created, must be valid |
reusablePointIndicesOutput | Memory block of indices with same size as 'reusableIndicesInput' which can be re-used internally, must be valid |
numberPointIndices | The number of given indices in 'reusablePointIndicesInput', with range [0, infinity) |
boundingBox | The bounding box of the new child node; will be ignored if parameters.useTightBoundingBoxes_ == true |
|
inline |
Returns the bounding box containing all points of this node (of all points in all child leaf nodes)
|
inline |
Returns the eight child nodes of this tree node.
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.
queryPoint | The query point for which the closest leaf nodes will be returned |
maximalDistance | The maximal distance between the query point and any potential point in a leaf node, with range [0, infinity) |
leafs | The resulting leaf nodes, mainly the point indices of the tree points which stored in the closest leaf nodes |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
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.
treePoints | The 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 |
queryPoint | The query point for which the closest points will be returned |
maximalDistance | The maximal distance between the query point and any potential tree point in a leaf node, with range [0, infinity) |
pointIndices | The resulting indices of the tree points which have a maximal distance of 'maximalDistance' to the query point |
points | Optional 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 |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
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.
queryRay | The 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 |
tanHalfAngle | The tangent of the cone's half apex angle, e.g., Numeric::tan(Numeric::deg2rad(1)), with range [0, 1) |
leafs | The resulting leaf nodes, mainly the point indices of the tree points which stored in the intersecting leaf nodes |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
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.
queryRay | The 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 |
leafs | The resulting leaf nodes, mainly the point indices of the tree points which stored in the intersecting leaf nodes |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
|
inline |
Returns whether this node is valid (if this node has a valid bounding box)
|
delete |
Disabled copy constructor.
octree | The octree which would be copied |
OctreeT< T > & Ocean::Geometry::OctreeT< T >::operator= | ( | OctreeT< T > && | octree | ) |
Move operator.
octree | The octree to be moved |
|
inline |
Returns the indices of the tree points which belong to this leaf node.
|
protected |
The bounding box of this tree node.
|
protected |
The eight child nodes.
|
protected |
The indicies of the tree points which belong to this leaf node, empty if this node is not a leaf node.