Files Class List
PointCloud< PointType, FType, DIMENSIONS, SIZE_TYPE > Class Template Reference

Detailed Description

template<typename PointType, typename FType, uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
class cy::PointCloud< PointType, FType, DIMENSIONS, SIZE_TYPE >

A point cloud class that uses a k-d tree for storing points.

The GetPoints and GetClosest methods return the neighboring points to a given location.

#include <cyPointCloud.h>

Classes

struct  PointInfo
 Used by one of the PointCloud::GetPoints() methods. More...
 

Public Member Functions

Closest point methods
bool GetClosest (PointType const &position, FType radius, SIZE_TYPE &closestIndex, PointType &closestPosition, FType &closestDistanceSquared) const
 Returns the closest point to the given position within the given radius. It returns true, if a point is found.
 
bool GetClosest (PointType const &position, SIZE_TYPE &closestIndex, PointType &closestPosition, FType &closestDistanceSquared) const
 Returns the closest point to the given position. It returns true, if a point is found.
 
bool GetClosest (PointType const &position, FType radius, SIZE_TYPE &closestIndex, PointType &closestPosition) const
 Returns the closest point index and position to the given position within the given index. It returns true, if a point is found.
 
bool GetClosest (PointType const &position, SIZE_TYPE &closestIndex, PointType &closestPosition) const
 Returns the closest point index and position to the given position. It returns true, if a point is found.
 
bool GetClosestIndex (PointType const &position, FType radius, SIZE_TYPE &closestIndex) const
 Returns the closest point index to the given position within the given radius. It returns true, if a point is found.
 
bool GetClosestIndex (PointType const &position, SIZE_TYPE &closestIndex) const
 Returns the closest point index to the given position. It returns true, if a point is found.
 
bool GetClosestPosition (PointType const &position, FType radius, PointType &closestPosition) const
 Returns the closest point position to the given position within the given radius. It returns true, if a point is found.
 
bool GetClosestPosition (PointType const &position, PointType &closestPosition) const
 Returns the closest point position to the given position. It returns true, if a point is found.
 
bool GetClosestDistanceSquared (PointType const &position, FType radius, FType &closestDistanceSquared) const
 Returns the closest point distance squared to the given position within the given radius. It returns true, if a point is found.
 
bool GetClosestDistanceSquared (PointType const &position, FType &closestDistanceSquared) const
 Returns the closest point distance squared to the given position. It returns true, if a point is found.
 

Constructors and Destructor

 PointCloud ()
 @ Access to internal data
 
 PointCloud (SIZE_TYPE numPts, PointType const *pts, SIZE_TYPE const *customIndices=nullptr)
 @ Access to internal data
 
 ~PointCloud ()
 @ Access to internal data
 
SIZE_TYPE GetPointCount () const
 @ Access to internal data
 
PointType const & GetPoint (SIZE_TYPE i) const
 Returns the point at position i.
 
SIZE_TYPE GetPointIndex (SIZE_TYPE i) const
 Returns the index of the point at position i.
 
void Build (SIZE_TYPE numPts, PointType const *pts)
 @ Initialization
 
void Build (SIZE_TYPE numPts, PointType const *pts, SIZE_TYPE const *customIndices)
 Builds a k-d tree for the given points. The positions are stored internally, along with the indices to the given array. The build is parallelized using Intel's Thread Building Library (TBB) or Microsoft's Parallel Patterns Library (PPL), if ttb.h or ppl.h is included prior to including cyPointCloud.h.
 
template<typename PointPosFunc >
void BuildWithFunc (SIZE_TYPE numPts, PointPosFunc ptPosFunc)
 Builds a k-d tree for the given points. The positions are stored internally, retrieved from the given function. The build is parallelized using Intel's Thread Building Library (TBB) or Microsoft's Parallel Patterns Library (PPL), if ttb.h or ppl.h is included prior to including cyPointCloud.h.
 
template<typename PointPosFunc , typename CustomIndexFunc >
void BuildWithFunc (SIZE_TYPE numPts, PointPosFunc ptPosFunc, CustomIndexFunc custIndexFunc)
 Builds a k-d tree for the given points. The positions are stored internally, along with the indices to the given array. The positions and custom indices are retrieved from the given functions. The build is parallelized using Intel's Thread Building Library (TBB) or Microsoft's Parallel Patterns Library (PPL), if ttb.h or ppl.h is included prior to including cyPointCloud.h.
 
template<typename _CALLBACK >
void GetPoints (PointType const &position, FType radius, _CALLBACK pointFound) const
 @ General search methods
 
int GetPoints (PointType const &position, FType radius, SIZE_TYPE maxCount, PointInfo *closestPoints) const
 Returns the closest points to the given position within the given radius. It returns the number of points found.
 
int GetPoints (PointType const &position, SIZE_TYPE maxCount, PointInfo *closestPoints) const
 Returns the closest points to the given position. It returns the number of points found.
 
static bool IsBuildParallel ()
 Returns true if the Build or BuildWithFunc methods would perform the build in parallel using multi-threading. The build is parallelized using Intel's Thread Building Library (TBB) or Microsoft's Parallel Patterns Library (PPL), if ttb.h or ppl.h are included prior to including cyPointCloud.h.
 

Constructor & Destructor Documentation

◆ PointCloud() [1/2]

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
PointCloud ( )

@ Access to internal data

Returns the point count

◆ PointCloud() [2/2]

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
PointCloud ( SIZE_TYPE numPts,
PointType const * pts,
SIZE_TYPE const * customIndices = nullptr )

@ Access to internal data

Returns the point count

◆ ~PointCloud()

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
~PointCloud ( )

@ Access to internal data

Returns the point count

Member Function Documentation

◆ GetPointCount()

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
SIZE_TYPE GetPointCount ( ) const

@ Access to internal data

Returns the point count

◆ Build()

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
void Build ( SIZE_TYPE numPts,
PointType const * pts )

@ Initialization

Builds a k-d tree for the given points. The positions are stored internally. The build is parallelized using Intel's Thread Building Library (TBB) or Microsoft's Parallel Patterns Library (PPL), if ttb.h or ppl.h is included prior to including cyPointCloud.h.

◆ GetPoints()

template<typename PointType , typename FType , uint32_t DIMENSIONS, typename SIZE_TYPE = uint32_t>
template<typename _CALLBACK >
void GetPoints ( PointType const & position,
FType radius,
_CALLBACK pointFound ) const

@ General search methods

Returns all points to the given position within the given radius. Calls the given pointFound function for each point found.

The given pointFound function can reduce the radiusSquared value. However, increasing the radiusSquared value can have unpredictable results. The callback function must be in the following form:

void _CALLBACK(SIZE_TYPE index, PointType const &p, FType distanceSquared, FType &radiusSquared)