MeshLib C++ Docs
Loading...
Searching...
No Matches
PointCloud

Classes

struct  MR::PointCloud
struct  MR::PointCloudRelaxParams
struct  MR::PointCloudApproxRelaxParams
class  MR::RegularMapMesher
 Class for making mesh from regular distance map. More...

Functions

bool MR::improveSampling (const PointCloud &cloud, VertBitSet &samples, const ImproveSamplingSettings &settings)
Expected< FPFHDescriptors > MR::computeFPFH (const PointCloud &pointCloud, float radius, const ProgressCallback &progress={})
 Computes Fast Point Feature Histograms for all valid points of given point cloud, which can be compared to find corresponding points in two clouds independently of their relative position; the descriptors do not change under rigid motions and uniform scaling of the cloud (if radius is scaled as well)
VertScalars MR::computeFPFHUniqueness (const FPFHDescriptors &descriptors, const VertBitSet &points)
 Computes for each of given points how unusual its descriptor is: (d - mu) / sigma, where d is the distance of the point's descriptor from the mean descriptor of all given points, and mu and sigma are the mean and the standard deviation of these distances; positive for descriptors farther from the mean than average, negative for more typical ones; deviations |d - mu| up to 1e-6, which come from float rounding of equal descriptors, give 0.
VertBitSet MR::findUniqueFPFHPoints (const FPFHDescriptors &descriptors, const VertBitSet &points, float beta)
 Finds the points with unique descriptors, which are less likely to be matched ambiguously: the points whose distance from the mean descriptor of all given points is outside the interval mu +- beta * sigma, where mu and sigma are the mean and the standard deviation of these distances, i.e. |computeFPFHUniqueness(...)| > beta.
Expected< VertBitSet > MR::findUniqueFPFHPoints (const PointCloud &pointCloud, float radius, float beta, const ProgressCallback &progress={})
 Computes FPFH descriptors of all valid points of given point cloud and finds the points with unique descriptors among them.
Expected< std::vector< VertPair > > MR::findFPFHMatches (const FPFHDescriptors &srcDescriptors, const VertBitSet &srcPoints, const FPFHDescriptors &tgtDescriptors, const VertBitSet &tgtPoints, bool mutual=true, const ProgressCallback &progress={})
 Finds for every source point the target point with the closest descriptor (in Euclidean distance) by comparing all pairs of points, which is fast enough for clouds of several thousand points.
std::optional< VertNormals > MR::makeUnorientedNormals (const PointCloud &pointCloud, float radius, const ProgressCallback &progress={}, OrientNormals orient=OrientNormals::Smart)
 Makes normals for valid points of given point cloud by directing them along the normal of best plane through the neighbours.
std::optional< VertNormals > MR::makeUnorientedNormals (const PointCloud &pointCloud, const AllLocalTriangulations &triangs, const ProgressCallback &progress={}, OrientNormals orient=OrientNormals::Smart)
 Makes normals for valid points of given point cloud by averaging neighbor triangle normals weighted by triangle's angle.
std::optional< VertNormals > MR::makeUnorientedNormals (const PointCloud &pointCloud, const Buffer< VertId > &closeVerts, int numNei, const ProgressCallback &progress={}, OrientNormals orient=OrientNormals::Smart)
 Makes normals for valid points of given point cloud by directing them along the normal of best plane through the neighbours.
bool MR::orientNormals (const PointCloud &pointCloud, VertNormals &normals, float radius, const ProgressCallback &progress={})
 Select orientation of given normals to make directions of close points consistent;.
bool MR::orientNormals (const PointCloud &pointCloud, VertNormals &normals, const AllLocalTriangulations &triangs, const ProgressCallback &progress={})
 Select orientation of given normals to make directions of close points consistent;.
bool MR::orientNormals (const PointCloud &pointCloud, VertNormals &normals, const Buffer< VertId > &closeVerts, int numNei, const ProgressCallback &progress={})
 Select orientation of given normals to make directions of close points consistent;.
std::optional< VertNormals > MR::makeOrientedNormals (const PointCloud &pointCloud, float radius, const ProgressCallback &progress={})
 Makes normals for valid points of given point cloud; directions of close points are selected to be consistent;.
std::optional< VertNormals > MR::makeOrientedNormals (const PointCloud &pointCloud, AllLocalTriangulations &triangs, const ProgressCallback &progress={})
 Makes normals for valid points of given point cloud; directions of close points are selected to be consistent;.
VertNormals MR::makeNormals (const PointCloud &pointCloud, int avgNeighborhoodSize=48)
 Makes consistent normals for valid points of given point cloud.
float MR::findAvgPointsRadius (const PointCloud &pointCloud, int avgPoints, int samples=1024)
 Finds the radius of ball, so on average that ball contained avgPoints excluding the central point.
bool MR::relax (PointCloud &pointCloud, const PointCloudRelaxParams &params={}, ProgressCallback cb={})
bool MR::relaxKeepVolume (PointCloud &pointCloud, const PointCloudRelaxParams &params={}, ProgressCallback cb={})
bool MR::relaxApprox (PointCloud &pointCloud, const PointCloudApproxRelaxParams &params={}, ProgressCallback cb={})
std::optional< VertBitSet > MR::pointUniformSampling (const PointCloud &pointCloud, const UniformSamplingSettings &settings)
std::optional< PointCloud > MR::makeUniformSampledCloud (const PointCloud &pointCloud, const UniformSamplingSettings &settings)

Detailed Description

Function Documentation

◆ computeFPFH()

Expected< FPFHDescriptors > MR::computeFPFH ( const PointCloud & pointCloud,
float radius,
const ProgressCallback & progress = {} )
nodiscard

#include <MRMesh/MRPointCloudFPFH.h>

Computes Fast Point Feature Histograms for all valid points of given point cloud, which can be compared to find corresponding points in two clouds independently of their relative position; the descriptors do not change under rigid motions and uniform scaling of the cloud (if radius is scaled as well)

Parameters
radiusof neighborhood to consider, usually about 5 times larger than the distance between neighbour points
Returns
error if the cloud has no normals or progress returned false; the normals must be oriented consistently, e.g. by makeOrientedNormals(...)

◆ computeFPFHUniqueness()

VertScalars MR::computeFPFHUniqueness ( const FPFHDescriptors & descriptors,
const VertBitSet & points )
nodiscard

#include <MRMesh/MRPointCloudFPFH.h>

Computes for each of given points how unusual its descriptor is: (d - mu) / sigma, where d is the distance of the point's descriptor from the mean descriptor of all given points, and mu and sigma are the mean and the standard deviation of these distances; positive for descriptors farther from the mean than average, negative for more typical ones; deviations |d - mu| up to 1e-6, which come from float rounding of equal descriptors, give 0.

◆ findAvgPointsRadius()

float MR::findAvgPointsRadius ( const PointCloud & pointCloud,
int avgPoints,
int samples = 1024 )

#include <MRMesh/MRPointCloudRadius.h>

Finds the radius of ball, so on average that ball contained avgPoints excluding the central point.

Parameters
samplesthe number of test points to find given number of samples in each

◆ findFPFHMatches()

Expected< std::vector< VertPair > > MR::findFPFHMatches ( const FPFHDescriptors & srcDescriptors,
const VertBitSet & srcPoints,
const FPFHDescriptors & tgtDescriptors,
const VertBitSet & tgtPoints,
bool mutual = true,
const ProgressCallback & progress = {} )
nodiscard

#include <MRMesh/MRPointCloudFPFH.h>

Finds for every source point the target point with the closest descriptor (in Euclidean distance) by comparing all pairs of points, which is fast enough for clouds of several thousand points.

Parameters
mutualif true, keeps only the pairs where the source point is also the closest one to the target point
Returns
(source point, target point) pairs ordered by source point, or error if progress returned false

◆ findUniqueFPFHPoints() [1/2]

VertBitSet MR::findUniqueFPFHPoints ( const FPFHDescriptors & descriptors,
const VertBitSet & points,
float beta )
nodiscard

#include <MRMesh/MRPointCloudFPFH.h>

Finds the points with unique descriptors, which are less likely to be matched ambiguously: the points whose distance from the mean descriptor of all given points is outside the interval mu +- beta * sigma, where mu and sigma are the mean and the standard deviation of these distances, i.e. |computeFPFHUniqueness(...)| > beta.

Parameters
betathe half-width of the interval in standard deviations, non-negative, usually 1..2

◆ findUniqueFPFHPoints() [2/2]

Expected< VertBitSet > MR::findUniqueFPFHPoints ( const PointCloud & pointCloud,
float radius,
float beta,
const ProgressCallback & progress = {} )
nodiscard

#include <MRMesh/MRPointCloudFPFH.h>

Computes FPFH descriptors of all valid points of given point cloud and finds the points with unique descriptors among them.

Parameters
radiusof neighborhood to consider in computeFPFH(...)
betathe half-width of the interval in standard deviations in findUniqueFPFHPoints(...), usually 1..2

◆ improveSampling()

bool MR::improveSampling ( const PointCloud & cloud,
VertBitSet & samples,
const ImproveSamplingSettings & settings )

#include <MRMesh/MRImproveSampling.h>

Finds more representative sampling starting from a given one following k-means method;

Parameters
samplesinput and output selected sample points from
cloud;
Returns
false if it was terminated by the callback

◆ makeNormals()

VertNormals MR::makeNormals ( const PointCloud & pointCloud,
int avgNeighborhoodSize = 48 )

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes consistent normals for valid points of given point cloud.

Parameters
avgNeighborhoodSizeavg num of neighbors of each individual point

[[deprecated( "use makeOrientedNormals(...) instead" )]]

◆ makeOrientedNormals() [1/2]

std::optional< VertNormals > MR::makeOrientedNormals ( const PointCloud & pointCloud,
AllLocalTriangulations & triangs,
const ProgressCallback & progress = {} )
nodiscard

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes normals for valid points of given point cloud; directions of close points are selected to be consistent;.

Parameters
triangstriangulation neighbours of each point, which are oriented during the call as well
Returns
nullopt if progress returned false

◆ makeOrientedNormals() [2/2]

std::optional< VertNormals > MR::makeOrientedNormals ( const PointCloud & pointCloud,
float radius,
const ProgressCallback & progress = {} )
nodiscard

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes normals for valid points of given point cloud; directions of close points are selected to be consistent;.

Parameters
radiusof neighborhood to consider
Returns
nullopt if progress returned false

◆ makeUniformSampledCloud()

std::optional< PointCloud > MR::makeUniformSampledCloud ( const PointCloud & pointCloud,
const UniformSamplingSettings & settings )
nodiscard

#include <MRMesh/MRUniformSampling.h>

Composes new point cloud consisting of uniform samples of original point cloud; returns std::nullopt if it was terminated by the callback

◆ makeUnorientedNormals() [1/3]

std::optional< VertNormals > MR::makeUnorientedNormals ( const PointCloud & pointCloud,
const AllLocalTriangulations & triangs,
const ProgressCallback & progress = {},
OrientNormals orient = OrientNormals::Smart )
nodiscard

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes normals for valid points of given point cloud by averaging neighbor triangle normals weighted by triangle's angle.

Parameters
triangstriangulation neighbours of each point
orientOrientNormals::Smart here means orientation from normals of neigbour triangles
Returns
nullopt if progress returned false

◆ makeUnorientedNormals() [2/3]

std::optional< VertNormals > MR::makeUnorientedNormals ( const PointCloud & pointCloud,
const Buffer< VertId > & closeVerts,
int numNei,
const ProgressCallback & progress = {},
OrientNormals orient = OrientNormals::Smart )
nodiscard

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes normals for valid points of given point cloud by directing them along the normal of best plane through the neighbours.

Parameters
closeVertsa buffer where for every valid point i its neighbours are stored at indices [i*numNei; (i+1)*numNei)
orientOrientNormals::Smart here means orientation from best fit plane
Returns
nullopt if progress returned false

◆ makeUnorientedNormals() [3/3]

std::optional< VertNormals > MR::makeUnorientedNormals ( const PointCloud & pointCloud,
float radius,
const ProgressCallback & progress = {},
OrientNormals orient = OrientNormals::Smart )
nodiscard

#include <MRMesh/MRPointCloudMakeNormals.h>

Makes normals for valid points of given point cloud by directing them along the normal of best plane through the neighbours.

Parameters
radiusof neighborhood to consider
orientOrientNormals::Smart here means orientation from best fit plane
Returns
nullopt if progress returned false

◆ orientNormals() [1/3]

bool MR::orientNormals ( const PointCloud & pointCloud,
VertNormals & normals,
const AllLocalTriangulations & triangs,
const ProgressCallback & progress = {} )

#include <MRMesh/MRPointCloudMakeNormals.h>

Select orientation of given normals to make directions of close points consistent;.

Parameters
triangstriangulation neighbours of each point
Returns
false if progress returned false Unlike simple orientNormals this method constructs local triangulations around each point (with most neighbours within given radius and all neighbours within 2*radius) and considers all triangulation neighbors and not other points from the ball around each point.

◆ orientNormals() [2/3]

bool MR::orientNormals ( const PointCloud & pointCloud,
VertNormals & normals,
const Buffer< VertId > & closeVerts,
int numNei,
const ProgressCallback & progress = {} )

#include <MRMesh/MRPointCloudMakeNormals.h>

Select orientation of given normals to make directions of close points consistent;.

Parameters
closeVertsa buffer where for every valid point i its neighbours are stored at indices [i*numNei; (i+1)*numNei)
Returns
false if progress returned false

◆ orientNormals() [3/3]

bool MR::orientNormals ( const PointCloud & pointCloud,
VertNormals & normals,
float radius,
const ProgressCallback & progress = {} )

#include <MRMesh/MRPointCloudMakeNormals.h>

Select orientation of given normals to make directions of close points consistent;.

Parameters
radiusof neighborhood to consider
Returns
false if progress returned false

◆ pointUniformSampling()

std::optional< VertBitSet > MR::pointUniformSampling ( const PointCloud & pointCloud,
const UniformSamplingSettings & settings )
nodiscard

#include <MRMesh/MRUniformSampling.h>

Sample vertices, removing ones that are too close; returns std::nullopt if it was terminated by the callback

◆ relax()

bool MR::relax ( PointCloud & pointCloud,
const PointCloudRelaxParams & params = {},
ProgressCallback cb = {} )

#include <MRMesh/MRPointCloudRelax.h>

applies given number of relaxation iterations to the whole pointCloud ( or some region if it is specified )

Returns
true if was finished successfully, false if was interrupted by progress callback

◆ relaxApprox()

bool MR::relaxApprox ( PointCloud & pointCloud,
const PointCloudApproxRelaxParams & params = {},
ProgressCallback cb = {} )

#include <MRMesh/MRPointCloudRelax.h>

applies given number of relaxation iterations to the whole pointCloud ( or some region if it is specified ) approx neighborhoods

Returns
true if was finished successfully, false if was interrupted by progress callback

◆ relaxKeepVolume()

bool MR::relaxKeepVolume ( PointCloud & pointCloud,
const PointCloudRelaxParams & params = {},
ProgressCallback cb = {} )

#include <MRMesh/MRPointCloudRelax.h>

applies given number of relaxation iterations to the whole pointCloud ( or some region if it is specified ) do not really keeps volume but tries hard

Returns
true if was finished successfully, false if was interrupted by progress callback