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
 

Public Member Functions

Closest point methods
bool GetClosest (const PointType &position, FType radius, SIZE_TYPE &closestIndex, PointType &closestPosition, FType &closestDistanceSquared) const
 
bool GetClosest (const PointType &position, SIZE_TYPE &closestIndex, PointType &closestPosition, FType &closestDistanceSquared) const
 
bool GetClosest (const PointType &position, FType radius, SIZE_TYPE &closestIndex, PointType &closestPosition) const
 
bool GetClosest (const PointType &position, SIZE_TYPE &closestIndex, PointType &closestPosition) const
 
bool GetClosestIndex (const PointType &position, FType radius, SIZE_TYPE &closestIndex) const
 
bool GetClosestIndex (const PointType &position, SIZE_TYPE &closestIndex) const
 
bool GetClosestPosition (const PointType &position, FType radius, PointType &closestPosition) const
 
bool GetClosestPosition (const PointType &position, PointType &closestPosition) const
 
bool GetClosestDistanceSquared (const PointType &position, FType radius, FType &closestDistanceSquared) const
 
bool GetClosestDistanceSquared (const PointType &position, FType &closestDistanceSquared) const
 

Constructors and Destructor

 PointCloud ()
 
 PointCloud (SIZE_TYPE numPts, const PointType *pts, const SIZE_TYPE *customIndices=nullptr)
 
 ~PointCloud ()
 
SIZE_TYPE GetPointCount () const
 
const PointType & GetPoint (SIZE_TYPE i) const
 
SIZE_TYPE GetPointIndex (SIZE_TYPE i) const
 
void Build (SIZE_TYPE numPts, const PointType *pts)
 
void Build (SIZE_TYPE numPts, const PointType *pts, const SIZE_TYPE *customIndices)
 
template<typename PointPosFunc >
void BuildWithFunc (SIZE_TYPE numPts, PointPosFunc ptPosFunc)
 
template<typename PointPosFunc , typename CustomIndexFunc >
void BuildWithFunc (SIZE_TYPE numPts, PointPosFunc ptPosFunc, CustomIndexFunc custIndexFunc)
 
template<typename _CALLBACK >
void GetPoints (const PointType &position, FType radius, _CALLBACK pointFound) const
 
int GetPoints (const PointType &position, FType radius, SIZE_TYPE maxCount, PointInfo *closestPoints) const
 
int GetPoints (const PointType &position, SIZE_TYPE maxCount, PointInfo *closestPoints) const
 
static bool IsBuildParallel ()
 

Constructor & Destructor Documentation

§ PointCloud() [1/2]

@ Access to internal data

Returns the point count

§ PointCloud() [2/2]

PointCloud ( SIZE_TYPE  numPts,
const PointType *  pts,
const SIZE_TYPE *  customIndices = nullptr 
)

@ Access to internal data

Returns the point count

§ ~PointCloud()

~PointCloud ( )

@ Access to internal data

Returns the point count

Member Function Documentation

§ GetPointCount()

SIZE_TYPE GetPointCount ( ) const

@ Access to internal data

Returns the point count

§ GetPoint()

const PointType& GetPoint ( SIZE_TYPE  i) const

Returns the point at position i.

§ GetPointIndex()

SIZE_TYPE GetPointIndex ( SIZE_TYPE  i) const

Returns the index of the point at position i.

§ Build() [1/2]

void Build ( SIZE_TYPE  numPts,
const PointType *  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.

§ Build() [2/2]

void Build ( SIZE_TYPE  numPts,
const PointType *  pts,
const SIZE_TYPE *  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.

§ BuildWithFunc() [1/2]

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.

§ BuildWithFunc() [2/2]

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.

§ IsBuildParallel()

static bool IsBuildParallel ( )
static

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.

§ GetPoints() [1/3]

void GetPoints ( const PointType &  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, const PointType &p, FType distanceSquared, FType &radiusSquared)

§ GetPoints() [2/3]

int GetPoints ( const PointType &  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.

§ GetPoints() [3/3]

int GetPoints ( const PointType &  position,
SIZE_TYPE  maxCount,
PointInfo closestPoints 
) const

Returns the closest points to the given position. It returns the number of points found.

§ GetClosest() [1/4]

bool GetClosest ( const PointType &  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.

§ GetClosest() [2/4]

bool GetClosest ( const PointType &  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.

§ GetClosest() [3/4]

bool GetClosest ( const PointType &  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.

§ GetClosest() [4/4]

bool GetClosest ( const PointType &  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.

§ GetClosestIndex() [1/2]

bool GetClosestIndex ( const PointType &  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.

§ GetClosestIndex() [2/2]

bool GetClosestIndex ( const PointType &  position,
SIZE_TYPE &  closestIndex 
) const

Returns the closest point index to the given position. It returns true, if a point is found.

§ GetClosestPosition() [1/2]

bool GetClosestPosition ( const PointType &  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.

§ GetClosestPosition() [2/2]

bool GetClosestPosition ( const PointType &  position,
PointType &  closestPosition 
) const

Returns the closest point position to the given position. It returns true, if a point is found.

§ GetClosestDistanceSquared() [1/2]

bool GetClosestDistanceSquared ( const PointType &  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.

§ GetClosestDistanceSquared() [2/2]

bool GetClosestDistanceSquared ( const PointType &  position,
FType &  closestDistanceSquared 
) const

Returns the closest point distance squared to the given position. It returns true, if a point is found.