Points::PointsGrid Class Reference

The PointsGrid allows to divide a global point cloud into smaller regions of elements depending on the resolution of the grid. More...

#include <PointsGrid.h>

Public Member Functions

Construction
 PointsGrid (const PointKernel &rclM)
 Construction. More...
 
 PointsGrid ()
 Construction. More...
 
 PointsGrid (const PointKernel &rclM, int iCtGridPerAxis)
 Construction. More...
 
 PointsGrid (const PointKernel &rclM, double fGridLen)
 Construction. More...
 
 PointsGrid (const PointKernel &rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ)
 Construction. More...
 
virtual ~PointsGrid ()
 Destruction. More...
 
virtual void Attach (const PointKernel &rclM)
 Attaches the point kernel to this grid, an already attached point cloud gets detached. More...
 
virtual void Rebuild (unsigned long ulPerGrid=POINTS_CT_GRID, unsigned long ulMaxGrid=POINTS_MAX_GRIDS)
 Rebuilds the grid structure. More...
 
virtual void Rebuild (int iCtGridPerAxis=POINTS_CT_GRID_PER_AXIS)
 Rebuilds the grid structure. More...
 
virtual void Rebuild (unsigned long ulX, unsigned long ulY, unsigned long ulZ)
 Rebuilds the grid structure. More...
 
Search
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::vector< unsigned long > &raulElements, bool bDelDoubles=true) const
 Searches for elements lying in the intersection area of the grid and the bounding box. More...
 
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::set< unsigned long > &raulElementss) const
 Searches for elements lying in the intersection area of the grid and the bounding box. More...
 
virtual unsigned long InSide (const Base::BoundBox3d &rclBB, std::vector< unsigned long > &raulElements, const Base::Vector3d &rclOrg, double fMaxDist, bool bDelDoubles=true) const
 Searches for elements lying in the intersection area of the grid and the bounding box. More...
 
void SearchNearestFromPoint (const Base::Vector3d &rclPt, std::set< unsigned long > &rclInd) const
 Searches for the nearest grids that contain elements from a point, the result are grid indices. More...
 
virtual void GetGridLengths (double &rfLenX, double &rfLenY, double &rfLenZ) const
 Returns the lengths of the grid elements in x,y and z direction. More...
 
virtual void GetCtGrids (unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const
 Returns the number of grid elements in x,y and z direction. More...
 

Boundings

class PointsGridIterator
 
class PointsGridIteratorStatistic
 
Base::BoundBox3d GetBoundBox (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const
 Returns the bounding box of a given grid element. More...
 
Base::BoundBox3d GetBoundBox () const
 Returns the bounding box of the whole. More...
 
unsigned long GetCtElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const
 Returns the number of elements in a given grid. More...
 
unsigned long FindElements (const Base::Vector3d &rclPoint, std::set< unsigned long > &aulElements) const
 Finds all points that lie in the same grid as the point rclPoint. More...
 
virtual void Validate (const PointKernel &rclM)
 Validates the grid structure and rebuilds it if needed. More...
 
virtual void Validate ()
 Validates the grid structure and rebuilds it if needed. More...
 
virtual bool Verify () const
 Verifies the grid structure and returns false if inconsistencies are found. More...
 
virtual void Position (const Base::Vector3d &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const
 Returns the indices of the grid this point lies in. More...
 
unsigned long GetElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ, std::set< unsigned long > &raclInd) const
 Returns the indices of the elements in the given grid. More...
 
bool CheckPos (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const
 Checks if this is a valid grid position. More...
 
virtual void InitGrid ()
 Initializes the size of the internal structure. More...
 
virtual void Clear ()
 Deletes the grid structure. More...
 
virtual void CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids)
 Calculates the grid length dependent on maximum number of grids. More...
 
virtual void CalculateGridLength (int iCtGridPerAxis)
 Calculates the grid length dependent on the number of grids per axis. More...
 
virtual void RebuildGrid ()
 Rebuilds the grid structure. More...
 
unsigned long HasElements () const
 Returns the number of stored elements. More...
 
void GetHull (unsigned long ulX, unsigned long ulY, unsigned long ulZ, unsigned long ulDistance, std::set< unsigned long > &raclInd) const
 Get the indices of all elements lying in the grids around a given grid with distance ulDistance. More...
 
void AddPoint (const Base::Vector3d &rclPt, unsigned long ulPtIndex, float fEpsilon=0.0f)
 Adds a new point element to the grid structure. More...
 
void Pos (const Base::Vector3d &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const
 Returns the grid numbers to the given point rclPoint. More...
 

Detailed Description

The PointsGrid allows to divide a global point cloud into smaller regions of elements depending on the resolution of the grid.

All grid elements in the grid structure have the same size.

Grids can be used within algorithms to avoid to iterate through all elements, so grids can speed up algorithms dramatically.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ PointsGrid() [1/5]

PointsGrid::PointsGrid ( const PointKernel rclM)

Construction.

References RebuildGrid().

◆ PointsGrid() [2/5]

PointsGrid::PointsGrid ( )

Construction.

◆ PointsGrid() [3/5]

PointsGrid::PointsGrid ( const PointKernel rclM,
int  iCtGridPerAxis 
)

Construction.

References Rebuild().

◆ PointsGrid() [4/5]

◆ PointsGrid() [5/5]

PointsGrid::PointsGrid ( const PointKernel rclM,
unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
)

Construction.

References Rebuild().

◆ ~PointsGrid()

virtual Points::PointsGrid::~PointsGrid ( )
virtual

Destruction.

Member Function Documentation

◆ AddPoint()

void PointsGrid::AddPoint ( const Base::Vector3d rclPt,
unsigned long  ulPtIndex,
float  fEpsilon = 0.0f 
)
protected

Adds a new point element to the grid structure.

rclPt is the geometric point and ulPtIndex the corresponding index in the point kernel.

References Pos(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by RebuildGrid().

◆ Attach()

void PointsGrid::Attach ( const PointKernel rclM)
virtual

Attaches the point kernel to this grid, an already attached point cloud gets detached.

The grid gets rebuilt automatically.

References RebuildGrid().

Referenced by Validate().

◆ CalculateGridLength() [1/2]

void PointsGrid::CalculateGridLength ( int  iCtGridPerAxis)
protectedvirtual

◆ CalculateGridLength() [2/2]

void PointsGrid::CalculateGridLength ( unsigned long  ulCtGrid,
unsigned long  ulMaxGrids 
)
protectedvirtual

◆ CheckPos()

bool Points::PointsGrid::CheckPos ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
) const
protected

Checks if this is a valid grid position.

◆ Clear()

void PointsGrid::Clear ( void  )
protectedvirtual

Deletes the grid structure.

◆ FindElements()

unsigned long PointsGrid::FindElements ( const Base::Vector3d rclPoint,
std::set< unsigned long > &  aulElements 
) const

Finds all points that lie in the same grid as the point rclPoint.

References GetElements(), and Pos().

◆ GetBoundBox() [1/2]

Base::BoundBox3d Points::PointsGrid::GetBoundBox ( ) const

Returns the bounding box of the whole.

Referenced by InSide(), and SearchNearestFromPoint().

◆ GetBoundBox() [2/2]

Base::BoundBox3d Points::PointsGrid::GetBoundBox ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
) const

Returns the bounding box of a given grid element.

◆ GetCtElements()

unsigned long Points::PointsGrid::GetCtElements ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
) const

Returns the number of elements in a given grid.

◆ GetCtGrids()

virtual void Points::PointsGrid::GetCtGrids ( unsigned long &  rulX,
unsigned long &  rulY,
unsigned long &  rulZ 
) const
virtual

Returns the number of grid elements in x,y and z direction.

◆ GetElements()

unsigned long PointsGrid::GetElements ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ,
std::set< unsigned long > &  raclInd 
) const

Returns the indices of the elements in the given grid.

Referenced by FindElements(), and GetHull().

◆ GetGridLengths()

virtual void Points::PointsGrid::GetGridLengths ( double &  rfLenX,
double &  rfLenY,
double &  rfLenZ 
) const
virtual

Returns the lengths of the grid elements in x,y and z direction.

◆ GetHull()

void PointsGrid::GetHull ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ,
unsigned long  ulDistance,
std::set< unsigned long > &  raclInd 
) const
protected

Get the indices of all elements lying in the grids around a given grid with distance ulDistance.

References GetElements().

Referenced by SearchNearestFromPoint().

◆ HasElements()

unsigned long Points::PointsGrid::HasElements ( void  ) const
protected

Returns the number of stored elements.

Referenced by Rebuild().

◆ InitGrid()

◆ InSide() [1/3]

unsigned long PointsGrid::InSide ( const Base::BoundBox3d rclBB,
std::set< unsigned long > &  raulElementss 
) const
virtual

◆ InSide() [2/3]

unsigned long PointsGrid::InSide ( const Base::BoundBox3d rclBB,
std::vector< unsigned long > &  raulElements,
bool  bDelDoubles = true 
) const
virtual

◆ InSide() [3/3]

unsigned long PointsGrid::InSide ( const Base::BoundBox3d rclBB,
std::vector< unsigned long > &  raulElements,
const Base::Vector3d rclOrg,
double  fMaxDist,
bool  bDelDoubles = true 
) const
virtual

◆ Pos()

void PointsGrid::Pos ( const Base::Vector3d rclPoint,
unsigned long &  rulX,
unsigned long &  rulY,
unsigned long &  rulZ 
) const
protected

Returns the grid numbers to the given point rclPoint.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by AddPoint(), and FindElements().

◆ Position()

void PointsGrid::Position ( const Base::Vector3d rclPoint,
unsigned long &  rulX,
unsigned long &  rulY,
unsigned long &  rulZ 
) const
virtual

Returns the indices of the grid this point lies in.

If the point is outside the grid then the indices of the nearest grid element are taken.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by InSide(), and SearchNearestFromPoint().

◆ Rebuild() [1/3]

void PointsGrid::Rebuild ( int  iCtGridPerAxis = POINTS_CT_GRID_PER_AXIS)
virtual

Rebuilds the grid structure.

References CalculateGridLength(), HasElements(), and RebuildGrid().

◆ Rebuild() [2/3]

void PointsGrid::Rebuild ( unsigned long  ulPerGrid = POINTS_CT_GRID,
unsigned long  ulMaxGrid = POINTS_MAX_GRIDS 
)
virtual

Rebuilds the grid structure.

References CalculateGridLength(), HasElements(), and RebuildGrid().

Referenced by PointsGrid().

◆ Rebuild() [3/3]

void PointsGrid::Rebuild ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
)
virtual

Rebuilds the grid structure.

References HasElements(), and RebuildGrid().

◆ RebuildGrid()

void PointsGrid::RebuildGrid ( void  )
protectedvirtual

Rebuilds the grid structure.

References AddPoint(), and InitGrid().

Referenced by Attach(), PointsGrid(), Rebuild(), and Validate().

◆ SearchNearestFromPoint()

void PointsGrid::SearchNearestFromPoint ( const Base::Vector3d rclPt,
std::set< unsigned long > &  rclInd 
) const

◆ Validate() [1/2]

void PointsGrid::Validate ( void  )
virtual

Validates the grid structure and rebuilds it if needed.

References RebuildGrid().

◆ Validate() [2/2]

void PointsGrid::Validate ( const PointKernel rclM)
virtual

Validates the grid structure and rebuilds it if needed.

References Attach(), RebuildGrid(), and Points::PointKernel::size().

◆ Verify()

Friends And Related Function Documentation

◆ PointsGridIterator

friend class PointsGridIterator
friend

◆ PointsGridIteratorStatistic

friend class PointsGridIteratorStatistic
friend

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