MeshLib Documentation
Loading...
Searching...
No Matches
MR::MeshOrPoints Class Reference

#include <MRMeshOrPoints.h>

Classes

struct  ProjectionResult
 

Public Types

using LimitedProjectorFunc = std::function<void( const Vector3f& p, ProjectionResult& res )>
 

Public Member Functions

 MeshOrPoints (const Mesh &mesh)
 
 MeshOrPoints (const MeshPart &mp)
 
 MeshOrPoints (const PointCloud &pc)
 
const MeshPart * asMeshPart () const
 if this object holds a mesh part then returns pointer on it, otherwise returns nullptr
 
const PointCloudasPointCloud () const
 if this object holds a point cloud then returns pointer on it, otherwise returns nullptr
 
MRMESH_API Box3f getObjBoundingBox () const
 
MRMESH_API void cacheAABBTree () const
 if AABBTree is already built does nothing otherwise builds and caches it
 
MRMESH_API Box3f computeBoundingBox (const AffineXf3f *toWorld=nullptr) const
 
MRMESH_API void accumulate (PointAccumulator &accum, const AffineXf3f *xf=nullptr) const
 Adds in existing PointAccumulator the elements of the contained object.
 
MRMESH_API std::optional< VertBitSet > pointsGridSampling (float voxelSize, size_t maxVoxels=500000, const ProgressCallback &cb={}) const
 
MRMESH_API const VertCoords & points () const
 gives access to points-vector (which can include invalid points as well)
 
MRMESH_API const VertBitSet & validPoints () const
 gives access to bit set of valid points
 
MRMESH_API std::function< Vector3f(VertId)> normals () const
 returns normals generating function: VertId->normal (or empty for point cloud without normals)
 
MRMESH_API std::function< float(VertId)> weights () const
 
MRMESH_API std::function< ProjectionResult(const Vector3f &)> projector () const
 returns a function that finds projection (closest) points on this: Vector3f->ProjectionResult
 
MRMESH_API LimitedProjectorFunc limitedProjector () const
 

Detailed Description

This class can hold either mesh part or point cloud. It is used for generic algorithms operating with either of them

Member Typedef Documentation

◆ LimitedProjectorFunc

using MR::MeshOrPoints::LimitedProjectorFunc = std::function<void( const Vector3f& p, ProjectionResult& res )>

Constructor & Destructor Documentation

◆ MeshOrPoints() [1/3]

MR::MeshOrPoints::MeshOrPoints ( const Mesh & mesh)
inline

◆ MeshOrPoints() [2/3]

MR::MeshOrPoints::MeshOrPoints ( const MeshPart & mp)
inline

◆ MeshOrPoints() [3/3]

MR::MeshOrPoints::MeshOrPoints ( const PointCloud & pc)
inline

Member Function Documentation

◆ accumulate()

MRMESH_API void MR::MeshOrPoints::accumulate ( PointAccumulator & accum,
const AffineXf3f * xf = nullptr ) const

Adds in existing PointAccumulator the elements of the contained object.

◆ asMeshPart()

const MeshPart * MR::MeshOrPoints::asMeshPart ( ) const
inlinenodiscard

if this object holds a mesh part then returns pointer on it, otherwise returns nullptr

◆ asPointCloud()

const PointCloud * MR::MeshOrPoints::asPointCloud ( ) const
inlinenodiscard

if this object holds a point cloud then returns pointer on it, otherwise returns nullptr

◆ cacheAABBTree()

MRMESH_API void MR::MeshOrPoints::cacheAABBTree ( ) const

if AABBTree is already built does nothing otherwise builds and caches it

◆ computeBoundingBox()

MRMESH_API Box3f MR::MeshOrPoints::computeBoundingBox ( const AffineXf3f * toWorld = nullptr) const
nodiscard

passes through all valid vertices and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space

◆ getObjBoundingBox()

MRMESH_API Box3f MR::MeshOrPoints::getObjBoundingBox ( ) const
nodiscard

returns the minimal bounding box containing all valid vertices of the object (and not only part of mesh); implemented via obj.getAABBTree()

◆ limitedProjector()

MRMESH_API LimitedProjectorFunc MR::MeshOrPoints::limitedProjector ( ) const
nodiscard

returns a function that updates projection (closest) points on this, the update takes place only if res.distSq on input is more than squared distance to the closest point

◆ normals()

MRMESH_API std::function< Vector3f(VertId)> MR::MeshOrPoints::normals ( ) const
nodiscard

returns normals generating function: VertId->normal (or empty for point cloud without normals)

◆ points()

MRMESH_API const VertCoords & MR::MeshOrPoints::points ( ) const
nodiscard

gives access to points-vector (which can include invalid points as well)

◆ pointsGridSampling()

MRMESH_API std::optional< VertBitSet > MR::MeshOrPoints::pointsGridSampling ( float voxelSize,
size_t maxVoxels = 500000,
const ProgressCallback & cb = {} ) const
nodiscard

performs sampling of vertices or points; subdivides bounding box of the object on voxels of approximately given size and returns at most one vertex per voxel; voxelSize is automatically increased to avoid more voxels than

Parameters
maxVoxels;returns std::nullopt if it was terminated by the callback

◆ projector()

MRMESH_API std::function< ProjectionResult(const Vector3f &)> MR::MeshOrPoints::projector ( ) const
nodiscard

returns a function that finds projection (closest) points on this: Vector3f->ProjectionResult

◆ validPoints()

MRMESH_API const VertBitSet & MR::MeshOrPoints::validPoints ( ) const
nodiscard

gives access to bit set of valid points

◆ weights()

MRMESH_API std::function< float(VertId)> MR::MeshOrPoints::weights ( ) const
nodiscard

returns weights generating function: VertId->float: for mesh it is double area of surrounding triangles, and for point cloud - nothing


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