MeshLib C Docs
Loading...
Searching...
No Matches
MRMeshToPointCloud.h File Reference
#include <MRCMesh/MREnums.h>
#include <MRCMisc/exports.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

MRC_API MR_PointCloud * MR_meshToPointCloud (const MR_Mesh *mesh, const MR_VertNormalsMode *normals, const MR_VertBitSet *verts)
MRC_API MR_expected_MR_PointCloud_std_string * MR_meshToDensePointCloud (const MR_MeshPart *mp, float radius, const MR_VertNormalsMode *normals, const MR_std_function_bool_from_float *cb)
MRC_API bool MR_isCoveredByVertices (const MR_MeshPart *mp, float radius)

Function Documentation

◆ MR_isCoveredByVertices()

MRC_API bool MR_isCoveredByVertices ( const MR_MeshPart * mp,
float radius )

returns true if every point of the mesh part is within the radius from one of the vertices of its triangle, which is exactly when meshToDensePointCloud( mp, radius ) returns the vertices of the mesh and no other samples Generated from function MR::isCoveredByVertices. Parameter mp can not be null. It is a single object.

◆ MR_meshToDensePointCloud()

MRC_API MR_expected_MR_PointCloud_std_string * MR_meshToDensePointCloud ( const MR_MeshPart * mp,
float radius,
const MR_VertNormalsMode * normals,
const MR_std_function_bool_from_float * cb )

Converts the mesh or its part in a point cloud dense enough to stop any ball of given radius: no ball of the radius can pass through the sampled surface without touching at least one point of the cloud, because every point of that surface is within the radius from some point of the cloud. The cloud consists of 1) all vertices of the sampled faces, having the same ids as in the mesh; 2) samples inside every triangle that its own vertices cannot cover, and on the edges of it. A triangle needs no samples at all, however long its edges are, if every point of it is within the radius from one of its vertices, as in a sliver with the third vertex near the longest edge. Please note that the number of samples grows as 1/radius^2.

Parameters
mpthe mesh or the part of it to be covered; nothing outside the part is sampled
normalsunless No, the normals of the cloud are set as well: AreaWeighted - the normals of the mesh vertices, and their interpolation in the samples on the edges and inside the triangles; AngleWeighted - Mesh::pseudonormal in every point: of the vertex, of the edge on an edge, of the triangle inside it Generated from function MR::meshToDensePointCloud. Parameter mp can not be null. It is a single object. Parameter normals has a default argument: MR::VertNormalsMode::AreaWeighted, pass a null pointer to use it. Parameter cb is a single object. Parameter cb has a default argument: {}, pass a null pointer to use it. Never returns null. Returns an instance allocated on the heap! Must call MR_expected_MR_PointCloud_std_string_Destroy() to free it when you're done using it.

◆ MR_meshToPointCloud()

MRC_API MR_PointCloud * MR_meshToPointCloud ( const MR_Mesh * mesh,
const MR_VertNormalsMode * normals,
const MR_VertBitSet * verts )

converts the mesh vertices (or only given ones) in a point cloud with the same vertex ids Generated from function MR::meshToPointCloud. Parameter mesh can not be null. It is a single object. Parameter normals has a default argument: MR::VertNormalsMode::AreaWeighted, pass a null pointer to use it. Parameter verts defaults to a null pointer in C++. Never returns null. Returns an instance allocated on the heap! Must call MR_PointCloud_Destroy() to free it when you're done using it.