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)
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 \triangs triangulation neighbours of each point.
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; \triangs triangulation neighbours of each point, which are oriented during the call as well.
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< PointCloudMR::makeUniformSampledCloud (const PointCloud &pointCloud, const UniformSamplingSettings &settings)

Detailed Description

Function Documentation

◆ 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

◆ 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; \triangs triangulation 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 \triangs triangulation neighbours of each point.

Parameters
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
radiusof neighborhood to consider
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