Fade2.5D Documentation pages v2.12
Delaunay Features
GEOM_FADE25D::CloudPrepare Class Reference

CloudPrepare simplifies overdense point clouds and helps to avoid memory-usage-peaks during data transfer. More...

#include <CloudPrepare.h>

Public Member Functions

size_t adaptiveSimplify (double maxDiffZ, SumStrategy sms, ConvexHullStrategy chs, bool bDryRun=false)
 Simplify the Point Cloud according to a tolerance z-value. More...
 
void add (const std::vector< Point2 > &vPoints)
 Add points to the CloudPrepare object (vector-version) More...
 
void add (double x, double y, double z, int customIndex=-1)
 Add a point to the CloudPrepare object. More...
 
void add (size_t numPoints, double *aCoordinates)
 Add points to the CloudPrepare object (array-version) More...
 
void clear ()
 Clear all stored data.
 
bool computeConvexHull (bool bAllPoints, std::vector< Point2 > &vConvexHull)
 Compute the 2.5D Convex Hull. More...
 
void getBounds (double &minX, double &minY, double &minZ, double &maxX, double &maxY, double &maxZ)
 Get the min/max bounds. More...
 
size_t getNumPoints () const
 Get the number of points. More...
 
void getPoints (std::vector< Point2 > &vPointsOut) const
 Get the simplified point cloud. More...
 
double getRangeX ()
 
double getRangeY ()
 
double getRangeZ ()
 
size_t uniformSimplifyGrid (double gridLength, SumStrategy sms, ConvexHullStrategy chs, bool bDryRun=false)
 Simplify the point cloud according to grid resolution. More...
 
size_t uniformSimplifyNum (int approxNumPoints, SumStrategy sms, ConvexHullStrategy chs)
 Simplify the Point Cloud to a specific target size. More...
 

Detailed Description

This class has two applications:

  1. Simplification of over-dense point clouds from areal and photogrammetry surveys. The reduction is either grid-based or z-adaptive with a tolerance threshold for the height error. Four strategies can be selected for grouping similar points: MIN, MAX, MEDIAN and AVG. MIN corresponds to simple ground filtering, since it favors ground measurement points over those on vegetation. MEDIAN stabilizes the point cloud because it removes outliers while AVG is well suited to reduce noise in the scan.
  2. Avoding memory usage peaks when triangulating a large point cloud: Usually you have all vertices in the data structures of your own software and when you then call Fade_2D::insert(), triangles are created immediately and only after that you have the possibility to remove the points from your own data structures. This means for a short time the vertices are duplicated in memory, and this creates an unnecessary memory peak. The solution is to give the points to the CloudPrepare class in advance (one-by-one or all at once) and to delete them from your own data structures while not a single triangle exists yet. Only then call Fade_2D::insert(&CloudPrepare).This avoids duplicating memory usage for the vertices.

Have a look at the Examples.

Note
This class replaces the EfficientModel class. It is much more memory-efficient and it is extremely fast.
Point Cloud Reduction: Left original, right reduced

Member Function Documentation

◆ adaptiveSimplify()

size_t GEOM_FADE25D::CloudPrepare::adaptiveSimplify ( double  maxDiffZ,
SumStrategy  sms,
ConvexHullStrategy  chs,
bool  bDryRun = false 
)

This method simplifies the point cloud height-adaptively. This means that adjoining points with similar z-values (within the given tolerance maxDiffZ) are combined into one.

Parameters
maxDiffZ[in] is the maximum height (z-coordinate) difference of points, so that these points are combined to one.
sms[in] is the strategy used to summarize similar points into one. Possible values are SMS_MINIMUM, SMS_MAXIMUM, SMS_MEDIAN and SMS_AVERAGE.
chs[in] is the ConvexHullStrategy: Use CHS_MAXHULL to keep all points of the convex hull unchanged. If only convex points but not collinear points of the convex hull are to be considered as convex hull points, then use CHS_MINHULL. If convex hull points should be treated like all other points, then use CHS_NOHULL.
bDryRunis used to avoid point cloud simplification. This is used to determine the number of points that would result from simplification with certain parameters. By default bDryRun=false.
Returns
the resulting number of points

◆ add() [1/3]

void GEOM_FADE25D::CloudPrepare::add ( const std::vector< Point2 > &  vPoints)
Parameters
vPoints[in] are the input points

◆ add() [2/3]

void GEOM_FADE25D::CloudPrepare::add ( double  x,
double  y,
double  z,
int  customIndex = -1 
)
Parameters
x,y,z[in] are the coordinates
[in]customIndexis an optional index that you can use to relate the point to your own data structures.
Note
If you call Point2::getCustomIndex() on this point at a later time, then exactly this index will be returned.

◆ add() [3/3]

void GEOM_FADE25D::CloudPrepare::add ( size_t  numPoints,
double *  aCoordinates 
)
Parameters
numPoints[in] specifies the number of input points
aCoordinates[in] an array that holds 3*numPoints coordinates (x0,y0,z0,x1,y1,z1,...,xn,yn,zn)

◆ computeConvexHull()

bool GEOM_FADE25D::CloudPrepare::computeConvexHull ( bool  bAllPoints,
std::vector< Point2 > &  vConvexHull 
)
Parameters
bAllPointsIf this parameter is true, then all convex hull points are returned. Otherwise, those points are omitted which lie on the convex hull but whose absence does not shrink the convex hull
vConvexHull[out] is used to return the convex hull points

◆ getBounds()

void GEOM_FADE25D::CloudPrepare::getBounds ( double &  minX,
double &  minY,
double &  minZ,
double &  maxX,
double &  maxY,
double &  maxZ 
)
Parameters
minX,minY,minZ,maxX,maxY,maxZ[out]

◆ getNumPoints()

size_t GEOM_FADE25D::CloudPrepare::getNumPoints ( ) const
Returns
the number of points

◆ getPoints()

void GEOM_FADE25D::CloudPrepare::getPoints ( std::vector< Point2 > &  vPointsOut) const
Parameters
vPointsOut[out] is used to return the points
Note
The points of the CloudPrepare object can be inserted directly with Fade_2D::insert(CloudPrepare). This is more memory efficient than getting the points out first only to pass them to insert().
See also
Fade_2D::void insert(CloudPrepare* pCloudPrepare,bool bClear=true)

◆ getRangeX()

double GEOM_FADE25D::CloudPrepare::getRangeX ( )
Returns
the x-Range

◆ getRangeY()

double GEOM_FADE25D::CloudPrepare::getRangeY ( )
Returns
the y-Range

◆ getRangeZ()

double GEOM_FADE25D::CloudPrepare::getRangeZ ( )
Returns
the z-Range

◆ uniformSimplifyGrid()

size_t GEOM_FADE25D::CloudPrepare::uniformSimplifyGrid ( double  gridLength,
SumStrategy  sms,
ConvexHullStrategy  chs,
bool  bDryRun = false 
)

This method uses a thought grid in the xy plane and combines the points of each cell into a single point.

Parameters
gridLength[in] determines the horizontal and vertical cell spacing in the grid.
sms[in] is the SumStrategy used to combine similar points into one. Possible values are SMS_MINIMUM, SMS_MAXIMUM, SMS_MEDIAN and SMS_AVERAGE.
chs[in] is the ConvexHullStrategy: Points of the convex hull can be kept unchanged. Use CHS_MAXHULL for this purpose. If only convex points but not collinear points of the convex hull are to be considered as convex hull points, then use CHS_MINHULL. If convex hull points should be treated like all other points, then use CHS_NOHULL.
bDryRunis used to avoid point cloud simplification. This is used to determine the number of points that would result from simplification with certain parameters. By default bDryRun=false.
Returns
the resulting number of points

◆ uniformSimplifyNum()

size_t GEOM_FADE25D::CloudPrepare::uniformSimplifyNum ( int  approxNumPoints,
SumStrategy  sms,
ConvexHullStrategy  chs 
)

This method uses a thought grid in the xy plane and combines the points of each cell into a single point. The resolution of the grid is automatically determined such that the point cloud is reduced to approximately the desired number of points.

Parameters
approxNumPoints[in] is the desired number of remaining points. The algorithm will reduce the point cloud to approximately that number of points.
sms[in] is the SumStrategy used to combine similar points into one. Possible values are SMS_MINIMUM, SMS_MAXIMUM, SMS_MEDIAN and SMS_AVERAGE.
chs[in] is the ConvexHullStrategy: Points of the convex hull can be kept unchanged. Use CHS_MAXHULL for this purpose. If only convex points but not collinear points of the convex hull are to be considered as convex hull points, then use CHS_MINHULL. If convex hull points should be treated like all other points, then use CHS_NOHULL.
Returns
the resulting number of points

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