MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMesh/MRPointCloud.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVector.h"
4#include "MRVector3.h"
5#include "MRBitSet.h"
6#include "MRMeshFwd.h"
9
10namespace MR
11{
12
14
16struct PointCloud
17{
19 VertCoords points;
20
23
25 VertBitSet validPoints;
26
28 [[nodiscard]] size_t calcNumValidPoints() const { return validPoints.count(); }
29
31 [[nodiscard]] bool hasNormals() const { return normals.size() >= points.size(); }
32
34 [[nodiscard]] const VertBitSet & getVertIds( const VertBitSet * region ) const
35 {
36 assert( !region || region->is_subset_of( validPoints ) ); // if region is given, then region must be a subset of valid points
37 return region ? *region : validPoints;
38 }
39
41 MRMESH_API const AABBTreePoints& getAABBTree() const;
42
44 [[nodiscard]] const AABBTreePoints * getAABBTreeNotCreate() const { return AABBTreeOwner_.get(); }
45
47 [[nodiscard]] MRMESH_API Box3f getBoundingBox() const;
48
51 [[nodiscard]] MRMESH_API Box3f computeBoundingBox( const AffineXf3f * toWorld = nullptr ) const;
52
55 [[nodiscard]] MRMESH_API Box3f computeBoundingBox( const VertBitSet * region, const AffineXf3f * toWorld = nullptr ) const;
56
58 [[nodiscard]] MRMESH_API Vector3f findCenterFromPoints() const;
59
61 [[nodiscard]] MRMESH_API Vector3f findCenterFromBBox() const;
62
65 MRMESH_API void transform( const AffineXf3f& xf, const VertBitSet* region = nullptr );
66
68 [[nodiscard]] MRMESH_API std::vector<VertId> getLexicographicalOrder() const;
69
73 MRMESH_API void addPartByMask( const PointCloud& from, const VertBitSet& fromVerts, const CloudPartMapping& outMap = {},
74 const VertNormals * extNormals = nullptr );
75
77 MRMESH_API VertId addPoint( const Vector3f& point );
78
80 MRMESH_API VertId addPoint( const Vector3f& point, const Vector3f& normal );
81
83 MRMESH_API void mirror( const Plane3f& plane );
84
86 MRMESH_API void flipOrientation( const VertBitSet * region = nullptr );
87
91 MRMESH_API bool pack( VertMap * outNew2Old = nullptr );
92
95 MRMESH_API VertBMap pack( Reorder reoder );
96
98 void invalidateCaches() { AABBTreeOwner_.reset(); }
99
101 [[nodiscard]] MRMESH_API size_t heapBytes() const;
102
103private:
104 mutable SharedThreadSafeOwner<AABBTreePoints> AABBTreeOwner_;
105};
106
107} // namespace MR
#define MRMESH_API
Definition MRMeshFwd.h:80
unsafe void addPartByMask(MR.Const_PointCloud from, MR.Const_VertBitSet fromVerts, MR.Const_CloudPartMapping? outMap=null, MR.Const_VertCoords? extNormals=null)
unsafe void mirror(MR.Const_Plane3f plane)
unsafe MR.VertId addPoint(in MR.Vector3f point)
unsafe bool pack(MR.VertMap? outNew2Old=null)
unsafe PointCloud()
unsafe void flipOrientation(MR.Const_VertBitSet? region=null)
new unsafe MR.VertBitSet validPoints
unsafe void transform(in MR.AffineXf3f xf, MR.Const_VertBitSet? region=null)
unsafe void invalidateCaches()
new unsafe MR.VertCoords points
new unsafe MR.VertCoords normals
Definition MRCameraOrientationPlugin.h:8
Vector3f normal(const MeshTopology &topology, const VertCoords &points, FaceId f)
computes triangular face normal from its vertices
Definition MRMeshMath.h:221