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 (void) | |
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 (void) | |
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 (void) 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 (void) | |
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 (void) | |
Initializes the size of the internal structure. More... | |
virtual void Clear (void) | |
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 (void) | |
Rebuilds the grid structure. More... | |
unsigned long HasElements (void) 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.
Constructor & Destructor Documentation
◆ PointsGrid() [1/5]
PointsGrid::PointsGrid | ( | const PointKernel & | rclM | ) |
Construction.
References RebuildGrid().
◆ PointsGrid() [2/5]
PointsGrid::PointsGrid | ( | void | ) |
Construction.
◆ PointsGrid() [3/5]
PointsGrid::PointsGrid | ( | const PointKernel & | rclM, |
int | iCtGridPerAxis | ||
) |
Construction.
References Rebuild().
◆ PointsGrid() [4/5]
PointsGrid::PointsGrid | ( | const PointKernel & | rclM, |
double | fGridLen | ||
) |
◆ PointsGrid() [5/5]
PointsGrid::PointsGrid | ( | const PointKernel & | rclM, |
unsigned long | ulX, | ||
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) |
Construction.
References Rebuild().
◆ ~PointsGrid()
|
virtual |
Destruction.
Member Function Documentation
◆ AddPoint()
|
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()
|
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]
|
protectedvirtual |
Calculates the grid length dependent on the number of grids per axis.
References Base::BoundBox3< _Precision >::Add(), Base::BoundBox3< _Precision >::CalcDiagonalLength(), CalculateGridLength(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), and Base::BoundBox3< _Precision >::LengthZ().
◆ CalculateGridLength() [2/2]
|
protectedvirtual |
Calculates the grid length dependent on maximum number of grids.
References Base::BoundBox3< _Precision >::Add(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), and Base::BoundBox3< _Precision >::LengthZ().
Referenced by CalculateGridLength(), InitGrid(), and Rebuild().
◆ CheckPos()
|
protected |
Checks if this is a valid grid position.
◆ Clear()
|
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 | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Returns the bounding box of a given grid element.
◆ GetBoundBox() [2/2]
Base::BoundBox3d Points::PointsGrid::GetBoundBox | ( | void | ) | const |
Returns the bounding box of the whole.
Referenced by InSide(), and SearchNearestFromPoint().
◆ 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 |
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 |
Returns the lengths of the grid elements in x,y and z direction.
◆ GetHull()
|
protected |
Get the indices of all elements lying in the grids around a given grid with distance ulDistance.
References GetElements().
Referenced by SearchNearestFromPoint().
◆ HasElements()
|
protected |
Returns the number of stored elements.
Referenced by Rebuild().
◆ InitGrid()
|
protectedvirtual |
Initializes the size of the internal structure.
References Base::BoundBox3< _Precision >::Add(), CalculateGridLength(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), Base::BoundBox3< _Precision >::LengthZ(), Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, and Base::BoundBox3< _Precision >::MinZ.
Referenced by RebuildGrid().
◆ InSide() [1/3]
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
◆ InSide() [2/3]
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
◆ InSide() [3/3]
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::CalcDiagonalLength(), Base::DistanceP2(), GetBoundBox(), Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
◆ Pos()
|
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()
|
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]
|
virtual |
Rebuilds the grid structure.
References CalculateGridLength(), HasElements(), and RebuildGrid().
◆ Rebuild() [2/3]
|
virtual |
Rebuilds the grid structure.
References CalculateGridLength(), HasElements(), and RebuildGrid().
Referenced by PointsGrid().
◆ Rebuild() [3/3]
|
virtual |
Rebuilds the grid structure.
References HasElements(), and RebuildGrid().
◆ RebuildGrid()
|
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 |
Searches for the nearest grids that contain elements from a point, the result are grid indices.
References Base::BoundBox3< double >::BACK, Base::BoundBox3< double >::BOTTOM, Base::BoundBox3< double >::FRONT, GetBoundBox(), Base::BoundBox3< _Precision >::GetCenter(), GetHull(), Base::BoundBox3< _Precision >::GetSideFromRay(), Base::BoundBox3< _Precision >::IsInBox(), Base::BoundBox3< double >::LEFT, Position(), Base::BoundBox3< double >::RIGHT, and Base::BoundBox3< double >::TOP.
◆ Validate() [1/2]
|
virtual |
Validates the grid structure and rebuilds it if needed.
References Attach(), RebuildGrid(), and Points::PointKernel::size().
◆ Validate() [2/2]
|
virtual |
Validates the grid structure and rebuilds it if needed.
References RebuildGrid().
◆ Verify()
|
virtual |
Verifies the grid structure and returns false if inconsistencies are found.
References Points::PointsGridIterator::GetBoundBox(), Points::PointsGridIterator::GetElements(), Points::PointsGridIterator::Init(), Base::BoundBox3< _Precision >::IsInBox(), Points::PointsGridIterator::More(), and Points::PointsGridIterator::Next().
Friends And Related Function Documentation
◆ PointsGridIterator
|
friend |
◆ PointsGridIteratorStatistic
|
friend |
The documentation for this class was generated from the following files:
- src/Mod/Points/App/PointsGrid.h
- src/Mod/Points/App/PointsGrid.cpp