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

#include <MRMesh/MRPointCloud.h>

Public Member Functions

size_t calcNumValidPoints () const
 computes the total number of valid points in the cloud
bool hasNormals () const
 returns true if there is a normal for each point
const VertBitSet & getVertIds (const VertBitSet *region) const
 if region pointer is not null then converts it in reference, otherwise returns all valid points in the cloud
const AABBTreePointsgetAABBTree () const
 returns cached aabb-tree for this point cloud, creating it if it did not exist in a thread-safe manner
const AABBTreePointsgetAABBTreeNotCreate () const
 returns cached aabb-tree for this point cloud, but does not create it if it did not exist
Box3f getBoundingBox () const
 returns the minimal bounding box containing all valid vertices (implemented via getAABBTree())
Box3f computeBoundingBox (const AffineXf3f *toWorld=nullptr) const
Box3f computeBoundingBox (const VertBitSet *region, const AffineXf3f *toWorld=nullptr) const
Vector3f findCenterFromPoints () const
 computes average position of all valid points
Vector3f findCenterFromBBox () const
 computes bounding box and returns its center
void transform (const AffineXf3f &xf, const VertBitSet *region=nullptr)
std::vector< VertId > getLexicographicalOrder () const
 returns all valid point ids sorted lexicographically by their coordinates (optimal for uniform sampling)
void addPartByMask (const PointCloud &from, const VertBitSet &fromVerts, const CloudPartMapping &outMap={}, const VertNormals *extNormals=nullptr)
VertId addPoint (const Vector3f &point)
 appends a point and returns its VertId
VertId addPoint (const Vector3f &point, const Vector3f &normal)
 appends a point with normal and returns its VertId
void mirror (const Plane3f &plane)
 reflects the points from a given plane
void flipOrientation (const VertBitSet *region=nullptr)
 flip orientation (normals) of given points (or all valid points is nullptr)
bool pack (VertMap *outNew2Old=nullptr)
VertBMap pack (Reorder reoder)
void invalidateCaches ()
 Invalidates caches (e.g. aabb-tree) after a change in point cloud.
size_t heapBytes () const
 returns the amount of memory this object occupies on heap

Public Attributes

VertCoords points
 coordinates of points
VertNormals normals
 unit normal directions of points (can be empty if no normals are known)
VertBitSet validPoints
 only points and normals corresponding to set bits here are valid

Member Function Documentation

◆ addPartByMask()

void MR::PointCloud::addPartByMask ( const PointCloud & from,
const VertBitSet & fromVerts,
const CloudPartMapping & outMap = {},
const VertNormals * extNormals = nullptr )

appends points (and normals if it possible) (from) in addition to this points if this obj have normals and from obj has not it then don't do anything

Parameters
extNormalsif given then they will be copied instead of from.normals

◆ addPoint() [1/2]

VertId MR::PointCloud::addPoint ( const Vector3f & point)

appends a point and returns its VertId

◆ addPoint() [2/2]

VertId MR::PointCloud::addPoint ( const Vector3f & point,
const Vector3f & normal )

appends a point with normal and returns its VertId

◆ calcNumValidPoints()

size_t MR::PointCloud::calcNumValidPoints ( ) const
inlinenodiscard

computes the total number of valid points in the cloud

◆ computeBoundingBox() [1/2]

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

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

◆ computeBoundingBox() [2/2]

Box3f MR::PointCloud::computeBoundingBox ( const VertBitSet * region,
const AffineXf3f * toWorld = nullptr ) const
nodiscard

passes through all given vertices (or all valid vertices if region == null) and finds the minimal bounding box containing all of them if toWorld transformation is given then returns minimal bounding box in world space

◆ findCenterFromBBox()

Vector3f MR::PointCloud::findCenterFromBBox ( ) const
nodiscard

computes bounding box and returns its center

◆ findCenterFromPoints()

Vector3f MR::PointCloud::findCenterFromPoints ( ) const
nodiscard

computes average position of all valid points

◆ flipOrientation()

void MR::PointCloud::flipOrientation ( const VertBitSet * region = nullptr)

flip orientation (normals) of given points (or all valid points is nullptr)

◆ getAABBTree()

const AABBTreePoints & MR::PointCloud::getAABBTree ( ) const

returns cached aabb-tree for this point cloud, creating it if it did not exist in a thread-safe manner

◆ getAABBTreeNotCreate()

const AABBTreePoints * MR::PointCloud::getAABBTreeNotCreate ( ) const
inlinenodiscard

returns cached aabb-tree for this point cloud, but does not create it if it did not exist

◆ getBoundingBox()

Box3f MR::PointCloud::getBoundingBox ( ) const
nodiscard

returns the minimal bounding box containing all valid vertices (implemented via getAABBTree())

◆ getLexicographicalOrder()

std::vector< VertId > MR::PointCloud::getLexicographicalOrder ( ) const
nodiscard

returns all valid point ids sorted lexicographically by their coordinates (optimal for uniform sampling)

◆ getVertIds()

const VertBitSet & MR::PointCloud::getVertIds ( const VertBitSet * region) const
inlinenodiscard

if region pointer is not null then converts it in reference, otherwise returns all valid points in the cloud

if region is given, then region must be a subset of valid points

◆ hasNormals()

bool MR::PointCloud::hasNormals ( ) const
inlinenodiscard

returns true if there is a normal for each point

◆ heapBytes()

size_t MR::PointCloud::heapBytes ( ) const
nodiscard

returns the amount of memory this object occupies on heap

◆ invalidateCaches()

void MR::PointCloud::invalidateCaches ( )
inline

Invalidates caches (e.g. aabb-tree) after a change in point cloud.

◆ mirror()

void MR::PointCloud::mirror ( const Plane3f & plane)

reflects the points from a given plane

◆ pack() [1/2]

VertBMap MR::PointCloud::pack ( Reorder reoder)

tightly packs all arrays eliminating invalid points, reorders valid points according to given strategy;

Returns
points mapping: old -> new

◆ pack() [2/2]

bool MR::PointCloud::pack ( VertMap * outNew2Old = nullptr)

tightly packs all arrays eliminating invalid points, but relative order of valid points is preserved; returns false if the cloud was packed before the call and nothing has been changed; if pack is done optionally returns mappings: new.id -> old.id

◆ transform()

void MR::PointCloud::transform ( const AffineXf3f & xf,
const VertBitSet * region = nullptr )

applies given transformation to specified points and corresponding transformation to their normals if present; if region is nullptr, all valid points are modified

Member Data Documentation

◆ normals

VertNormals MR::PointCloud::normals

unit normal directions of points (can be empty if no normals are known)

◆ points

VertCoords MR::PointCloud::points

coordinates of points

◆ validPoints

VertBitSet MR::PointCloud::validPoints

only points and normals corresponding to set bits here are valid


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