MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMesh/MRMesh.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRPch/MRBindingMacros.h"
4#include "MRMeshMath.h"
6#include "MRMeshProject.h"
7#include "MREdgePoint.h"
9#include "MRWriter.h"
10#include "MRConstants.h"
11#include "MRProgressCallback.h"
12#include <cfloat>
13
14namespace MR
15{
16
18
22struct [[nodiscard]] Mesh
23{
24 MeshTopology topology;
25 VertCoords points;
26
28 [[nodiscard]] MRMESH_API static Mesh fromTriangles(
29 VertCoords vertexCoordinates,
30 const Triangulation& t, const MeshBuilder::BuildSettings& settings = {}, ProgressCallback cb = {} );
31
33 [[nodiscard]] MRMESH_API static Mesh fromTriMesh(
34 TriMesh && triMesh,
35 const MeshBuilder::BuildSettings& settings = {}, ProgressCallback cb = {} );
36
40 VertCoords vertexCoordinates,
41 Triangulation & t,
42 std::vector<MeshBuilder::VertDuplication> * dups = nullptr,
43 const MeshBuilder::BuildSettings & settings = {} );
44
48 [[nodiscard]] MRMESH_API static Mesh fromFaceSoup(
49 VertCoords vertexCoordinates,
50 const std::vector<VertId> & verts, const Vector<MeshBuilder::VertSpan, FaceId> & faces,
51 const MeshBuilder::BuildSettings& settings = {}, ProgressCallback cb = {} );
52
56 [[nodiscard]] MRMESH_API static Mesh fromPointTriples( const std::vector<Triangle3f> & posTriples, bool duplicateNonManifoldVertices );
57
59 [[nodiscard]] MRMESH_API bool operator ==( const Mesh & b ) const;
60
62 [[nodiscard]] Vector3f orgPnt( EdgeId e ) const { return MR::orgPnt( topology, points, e ); }
63
65 [[nodiscard]] Vector3f destPnt( EdgeId e ) const { return MR::destPnt( topology, points, e ); }
66
68 [[nodiscard]] Vector3f edgeVector( EdgeId e ) const { return MR::edgeVector( topology, points, e ); }
69
71 [[nodiscard]] MRMESH_API LineSegm3f edgeSegment( EdgeId e ) const;
72
74 [[nodiscard]] Vector3f edgePoint( EdgeId e, float f ) const { return MR::edgePoint( topology, points, e, f ); }
75
77 [[nodiscard]] Vector3f edgePoint( const MeshEdgePoint & ep ) const { return MR::edgePoint( topology, points, ep ); }
78
80 [[nodiscard]] Vector3f edgeCenter( UndirectedEdgeId e ) const { return MR::edgeCenter( topology, points, e ); }
81
83 void getLeftTriPoints( EdgeId e, Vector3f & v0, Vector3f & v1, Vector3f & v2 ) const { return MR::getLeftTriPoints( topology, points, e, v0, v1, v2 ); }
84
87 MR_BIND_IGNORE void getLeftTriPoints( EdgeId e, Vector3f (&v)[3] ) const { return MR::getLeftTriPoints( topology, points, e, v ); }
88
90 [[nodiscard]] Triangle3f getLeftTriPoints( EdgeId e ) const { return MR::getLeftTriPoints( topology, points, e ); }
91
93 void getTriPoints( FaceId f, Vector3f & v0, Vector3f & v1, Vector3f & v2 ) const { return MR::getTriPoints( topology, points, f, v0, v1, v2 ); }
94
97 MR_BIND_IGNORE void getTriPoints( FaceId f, Vector3f (&v)[3] ) const { return MR::getTriPoints( topology, points, f, v ); }
98
100 [[nodiscard]] Triangle3f getTriPoints( FaceId f ) const { return MR::getTriPoints( topology, points, f ); }
101
103 [[nodiscard]] Vector3f triPoint( const MeshTriPoint & p ) const { return MR::triPoint( topology, points, p ); }
104
106 [[nodiscard]] Vector3f triCenter( FaceId f ) const { return MR::triCenter( topology, points, f ); }
107
109 [[nodiscard]] float triangleAspectRatio( FaceId f ) const { return MR::triangleAspectRatio( topology, points, f ); }
110
112 [[nodiscard]] float circumcircleDiameterSq( FaceId f ) const { return MR::circumcircleDiameterSq( topology, points, f ); }
113
115 [[nodiscard]] float circumcircleDiameter( FaceId f ) const { return MR::circumcircleDiameter( topology, points, f ); }
116
118 [[nodiscard]] MRMESH_API MeshTriPoint toTriPoint( VertId v ) const;
119
121 [[nodiscard]] MeshTriPoint toTriPoint( FaceId f, const Vector3f & p ) const { return MR::toTriPoint( topology, points, f, p ); }
122
124 [[nodiscard]] MeshTriPoint toTriPoint( const PointOnFace& p ) const { return MR::toTriPoint( topology, points, p ); }
125
127 [[nodiscard]] MRMESH_API MeshEdgePoint toEdgePoint( VertId v ) const;
128
130 [[nodiscard]] MeshEdgePoint toEdgePoint( EdgeId e, const Vector3f & p ) const { return MR::toEdgePoint( topology, points, e, p ); }
131
133 [[nodiscard]] VertId getClosestVertex( const PointOnFace & p ) const { return MR::getClosestVertex( topology, points, p ); }
134
136 [[nodiscard]] VertId getClosestVertex( const MeshTriPoint & p ) const { return MR::getClosestVertex( topology, points, p ); }
137
139 [[nodiscard]] UndirectedEdgeId getClosestEdge( const PointOnFace & p ) const { return MR::getClosestEdge( topology, points, p ); }
140
142 [[nodiscard]] UndirectedEdgeId getClosestEdge( const MeshTriPoint & p ) const { return MR::getClosestEdge( topology, points, p ); }
143
145 [[nodiscard]] float edgeLength( UndirectedEdgeId e ) const { return MR::edgeLength( topology, points, e ); }
146
148 [[nodiscard]] UndirectedEdgeScalars edgeLengths() const { return MR::edgeLengths( topology, points ); }
149
151 [[nodiscard]] float edgeLengthSq( UndirectedEdgeId e ) const { return MR::edgeLengthSq( topology, points, e ); }
152
154 [[nodiscard]] Vector3f leftDirDblArea( EdgeId e ) const { return MR::leftDirDblArea( topology, points, e ); }
155
157 [[nodiscard]] Vector3f dirDblArea( FaceId f ) const { return MR::dirDblArea( topology, points, f ); }
158
160 [[nodiscard]] float dblArea( FaceId f ) const { return MR::dblArea( topology, points, f ); }
161
163 [[nodiscard]] float area( FaceId f ) const { return MR::area( topology, points, f ); }
164
167 [[nodiscard]] MR_BIND_IGNORE double area( const FaceBitSet & fs ) const { return MR::area( topology, points, fs ); }
168
170 [[nodiscard]] double area( const FaceBitSet * fs = nullptr ) const { return MR::area( topology, points, fs ); }
171
174 [[nodiscard]] MR_BIND_IGNORE Vector3d dirArea( const FaceBitSet & fs ) const { return MR::dirArea( topology, points, fs ); }
175
177 [[nodiscard]] Vector3d dirArea( const FaceBitSet * fs = nullptr ) const { return MR::dirArea( topology, points, fs ); }
178
181 [[nodiscard]] MR_BIND_IGNORE double projArea( const Vector3f & dir, const FaceBitSet & fs ) const { return MR::projArea( topology, points, dir, fs ); }
182
184 [[nodiscard]] double projArea( const Vector3f & dir, const FaceBitSet * fs = nullptr ) const { return MR::projArea( topology, points, dir, fs ); }
185
188 [[nodiscard]] double volume( const FaceBitSet* region = nullptr ) const { return MR::volume( topology, points, region ); }
189
191 [[nodiscard]] double holePerimeter( EdgeId e ) const { return MR::holePerimeter( topology, points, e ); }
192
195 [[nodiscard]] Vector3d holeDirArea( EdgeId e ) const { return MR::holeDirArea( topology, points, e ); }
196
198 [[nodiscard]] Vector3f leftTangent( EdgeId e ) const { return MR::leftTangent( topology, points, e ); }
199
201 [[nodiscard]] Vector3f leftNormal( EdgeId e ) const { return MR::leftNormal( topology, points, e ); }
202
204 [[nodiscard]] Vector3f normal( FaceId f ) const { return MR::normal( topology, points, f ); }
205
207 [[nodiscard]] MRMESH_API Plane3f getPlane3f( FaceId f ) const;
208 [[nodiscard]] MRMESH_API Plane3d getPlane3d( FaceId f ) const;
209
211 [[nodiscard]] Vector3f dirDblArea( VertId v ) const { return MR::dirDblArea( topology, points, v ); }
212
214 [[nodiscard]] float dblArea( VertId v ) const { return MR::dblArea( topology, points, v ); }
215
217 [[nodiscard]] Vector3f normal( VertId v ) const { return MR::normal( topology, points, v ); }
218
221 [[nodiscard]] Vector3f normal( const MeshTriPoint & p ) const { return MR::normal( topology, points, p ); }
222
225 [[nodiscard]] Vector3f pseudonormal( VertId v, const FaceBitSet * region = nullptr ) const { return MR::pseudonormal( topology, points, v, region ); }
226
228 [[nodiscard]] Vector3f pseudonormal( UndirectedEdgeId e, const FaceBitSet * region = nullptr ) const { return MR::pseudonormal( topology, points, e, region ); }
229
234 [[nodiscard]] Vector3f pseudonormal( const MeshTriPoint & p, const FaceBitSet * region = nullptr ) const { return MR::pseudonormal( topology, points, p, region ); }
235
239 [[nodiscard]] MRMESH_API float signedDistance( const Vector3f & pt, const MeshProjectionResult & proj, const FaceBitSet * region = nullptr ) const;
240 [[deprecated]] MRMESH_API MR_BIND_IGNORE float signedDistance( const Vector3f & pt, const MeshTriPoint & proj, const FaceBitSet * region = nullptr ) const;
241
245 [[nodiscard]] MRMESH_API float signedDistance( const Vector3f & pt ) const;
246
251 [[nodiscard]] MRMESH_API std::optional<float> signedDistance( const Vector3f & pt, float maxDistSq, const FaceBitSet * region = nullptr ) const;
252
258 [[nodiscard]] MRMESH_API float calcFastWindingNumber( const Vector3f & pt, float beta = 2 ) const;
259
262 [[nodiscard]] bool isOutside( const Vector3f & pt, float windingNumberThreshold = 0.5f, float beta = 2 ) const { return calcFastWindingNumber( pt, beta ) <= windingNumberThreshold; }
263
267 [[nodiscard]] MRMESH_API bool isOutsideByProjNorm( const Vector3f & pt, const MeshProjectionResult & proj, const FaceBitSet * region = nullptr ) const;
268
270 [[nodiscard]] float sumAngles( VertId v, bool * outBoundaryVert = nullptr ) const { return MR::sumAngles( topology, points, v, outBoundaryVert ); }
271
273 [[nodiscard]] Expected<VertBitSet> findSpikeVertices( float minSumAngle, const VertBitSet* region = nullptr, const ProgressCallback& cb = {} ) const { return MR::findSpikeVertices( topology, points, minSumAngle, region, cb ); }
274
279 [[nodiscard]] float dihedralAngleSin( UndirectedEdgeId e ) const { return MR::dihedralAngleSin( topology, points, e ); }
280
285 [[nodiscard]] float dihedralAngleCos( UndirectedEdgeId e ) const { return MR::dihedralAngleCos( topology, points, e ); }
286
292 [[nodiscard]] float dihedralAngle( UndirectedEdgeId e ) const { return MR::dihedralAngle( topology, points, e ); }
293
296 [[nodiscard]] float discreteMeanCurvature( VertId v ) const { return MR::discreteMeanCurvature( topology, points, v ); }
297
300 [[nodiscard]] float discreteMeanCurvature( UndirectedEdgeId e ) const { return MR::discreteMeanCurvature( topology, points, e ); }
301
305 [[nodiscard]] float discreteGaussianCurvature( VertId v, bool * outBoundaryVert = nullptr ) const { return MR::discreteGaussianCurvature( topology, points, v, outBoundaryVert ); }
306
308 [[nodiscard]] UndirectedEdgeBitSet findCreaseEdges( float angleFromPlanar ) const { return MR::findCreaseEdges( topology, points, angleFromPlanar ); }
309
312 [[nodiscard]] float leftCotan( EdgeId e ) const { return MR::leftCotan( topology, points, e ); }
313
316 [[nodiscard]] float cotan( UndirectedEdgeId ue ) const { return MR::cotan( topology, points, ue ); }
317
321 [[nodiscard]] MRMESH_API QuadraticForm3f quadraticForm( VertId v, bool angleWeigted,
322 const FaceBitSet * region = nullptr, const UndirectedEdgeBitSet * creases = nullptr ) const;
323
326 [[nodiscard]] MRMESH_API Box3f getBoundingBox() const;
327
330 [[nodiscard]] MRMESH_API Box3f computeBoundingBox( const AffineXf3f * toWorld = nullptr ) const;
331
334 [[nodiscard]] MRMESH_API Box3f computeBoundingBox( const FaceBitSet* region, const AffineXf3f* toWorld = nullptr ) const;
335
337 [[nodiscard]] float averageEdgeLength() const { return MR::averageEdgeLength( topology, points ); }
338
340 [[nodiscard]] Vector3f findCenterFromPoints() const { return MR::findCenterFromPoints( topology, points ); }
341
343 [[nodiscard]] Vector3f findCenterFromFaces() const { return MR::findCenterFromFaces( topology, points ); }
344
346 [[nodiscard]] Vector3f findCenterFromBBox() const { return MR::findCenterFromBBox( topology, points ); }
347
349 MRMESH_API void zeroUnusedPoints();
350
354 MRMESH_API void transform( const AffineXf3f& xf, const VertBitSet* region = nullptr );
355
357 MRMESH_API VertId addPoint( const Vector3f & pos );
358
361 MRMESH_API EdgeId addSeparateEdgeLoop(const std::vector<Vector3f>& contourPoints);
362
365 MRMESH_API EdgeId addSeparateContours( const Contours3f& contours, const AffineXf3f* xf = nullptr );
366
371 MRMESH_API void attachEdgeLoopPart( EdgeId first, EdgeId last, const std::vector<Vector3f>& contourPoints );
372
381 MRMESH_API EdgeId splitEdge( EdgeId e, const Vector3f & newVertPos, FaceBitSet * region = nullptr, FaceHashMap * new2Old = nullptr );
382 // same, but split given edge on two equal parts
383 EdgeId splitEdge( EdgeId e, FaceBitSet * region = nullptr, FaceHashMap * new2Old = nullptr ) { return splitEdge( e, edgeCenter( e ), region, new2Old ); }
384
388 MRMESH_API VertId splitFace( FaceId f, const Vector3f & newVertPos, FaceBitSet * region = nullptr, FaceHashMap * new2Old = nullptr );
389 // same, putting new vertex in the centroid of original triangle
390 VertId splitFace( FaceId f, FaceBitSet * region = nullptr, FaceHashMap * new2Old = nullptr ) { return splitFace( f, triCenter( f ), region, new2Old ); }
391
393 MRMESH_API void addMesh( const Mesh & from, PartMapping map = {}, bool rearrangeTriangles = false );
394 MRMESH_API void addMesh( const Mesh & from,
395 // optionally returns mappings: from.id -> this.id
396 FaceMap * outFmap, VertMap * outVmap = nullptr, WholeEdgeMap * outEmap = nullptr, bool rearrangeTriangles = false );
397 [[deprecated]] MR_BIND_IGNORE void addPart( const Mesh & from, FaceMap * outFmap = nullptr, VertMap * outVmap = nullptr, WholeEdgeMap * outEmap = nullptr, bool rearrangeTriangles = false )
398 { addMesh( from, outFmap, outVmap, outEmap, rearrangeTriangles ); }
399
401 MRMESH_API void addMeshPart( const MeshPart & from, const PartMapping & map );
402 [[deprecated]] MR_BIND_IGNORE void addPartByMask( const Mesh & from, const FaceBitSet & fromFaces, const PartMapping & map ) { addMeshPart( { from, &fromFaces }, map ); }
403
406 MRMESH_API void addMeshPart( const MeshPart & from, bool flipOrientation = false,
407 const std::vector<EdgePath> & thisContours = {}, // contours on this mesh that have to be stitched with
408 const std::vector<EdgePath> & fromContours = {}, // contours on from mesh during addition
409 // optionally returns mappings: from.id -> this.id
410 PartMapping map = {} );
411 [[deprecated]] MR_BIND_IGNORE void addPartByMask( const Mesh & from, const FaceBitSet & fromFaces, bool flipOrientation = false,
412 const std::vector<EdgePath> & thisContours = {}, const std::vector<EdgePath> & fromContours = {}, const PartMapping & map = {} )
413 { addMeshPart( { from, &fromFaces }, flipOrientation, thisContours, fromContours, map ); }
414
416 MRMESH_API Mesh cloneRegion( const FaceBitSet & region, bool flipOrientation = false, const PartMapping & map = {} ) const;
417
419 MRMESH_API void pack( const PartMapping & map = {}, bool rearrangeTriangles = false );
420 MRMESH_API void pack(
421 FaceMap * outFmap, VertMap * outVmap = nullptr, WholeEdgeMap * outEmap = nullptr, bool rearrangeTriangles = false );
422
425 MRMESH_API Expected<void> pack( const PackMapping & map, ProgressCallback cb = {} );
426
429 MRMESH_API PackMapping packOptimally( bool preserveAABBTree = true );
430 MRMESH_API Expected<PackMapping> packOptimally( bool preserveAABBTree, ProgressCallback cb );
431
433 MRMESH_API void deleteFaces( const FaceBitSet & fs, const UndirectedEdgeBitSet * keepEdges = nullptr );
434
441 [[nodiscard]] MRMESH_API bool projectPoint( const Vector3f& point, PointOnFace& res, float maxDistSq = FLT_MAX, const FaceBitSet* region = nullptr, const AffineXf3f * xf = nullptr ) const;
442
449 [[nodiscard]] MRMESH_API bool projectPoint( const Vector3f& point, MeshProjectionResult& res, float maxDistSq = FLT_MAX, const FaceBitSet* region = nullptr, const AffineXf3f * xf = nullptr ) const;
450 [[nodiscard]] bool findClosestPoint( const Vector3f& point, MeshProjectionResult& res, float maxDistSq = FLT_MAX, const FaceBitSet* region = nullptr, const AffineXf3f * xf = nullptr ) const { return projectPoint( point, res, maxDistSq, region, xf ); }
451
458 [[nodiscard]] MRMESH_API MeshProjectionResult projectPoint( const Vector3f& point, float maxDistSq = FLT_MAX, const FaceBitSet * region = nullptr, const AffineXf3f * xf = nullptr ) const;
459 [[nodiscard]] MeshProjectionResult findClosestPoint( const Vector3f& point, float maxDistSq = FLT_MAX, const FaceBitSet * region = nullptr, const AffineXf3f * xf = nullptr ) const { return projectPoint( point, maxDistSq, region, xf ); }
460
462 MRMESH_API const AABBTree & getAABBTree() const;
463
465 [[nodiscard]] const AABBTree * getAABBTreeNotCreate() const { return AABBTreeOwner_.get(); }
466
468 MRMESH_API const AABBTreePoints & getAABBTreePoints() const;
469
471 [[nodiscard]] const AABBTreePoints * getAABBTreePointsNotCreate() const { return AABBTreePointsOwner_.get(); }
472
474 MRMESH_API const Dipoles & getDipoles() const;
475
477 [[nodiscard]] const Dipoles * getDipolesNotCreate() const { return dipolesOwner_.get(); }
478
481 MRMESH_API void invalidateCaches( bool pointsChanged = true );
482
486 MRMESH_API void updateCaches( const VertBitSet & changedVerts );
487
488 // returns the amount of memory this object occupies on heap
489 [[nodiscard]] MRMESH_API size_t heapBytes() const;
490
492 MRMESH_API void shrinkToFit();
493
495 MRMESH_API void mirror( const Plane3f& plane );
496
497private:
498 mutable SharedThreadSafeOwner<AABBTree> AABBTreeOwner_;
499 mutable SharedThreadSafeOwner<AABBTreePoints> AABBTreePointsOwner_;
500 mutable SharedThreadSafeOwner<Dipoles> dipolesOwner_;
501};
502
503} //namespace MR
constexpr bool operator==(ImVec2 a, ImVec2 b)
Definition MRImGuiVectorOperators.h:117
#define MRMESH_API
Definition MRMeshFwd.h:80
MRMESH_API Mesh fromPointTriples(const std::vector< Triangle3f > &posTriples)
MRMESH_API MeshTopology fromTrianglesDuplicatingNonManifoldVertices(Triangulation &t, std::vector< VertDuplication > *dups=nullptr, const BuildSettings &settings={})
MRMESH_API MeshTopology fromFaceSoup(const std::vector< VertId > &verts, const Vector< VertSpan, FaceId > &faces, const BuildSettings &settings={}, ProgressCallback progressCb={})
construct mesh topology from face soup, where each face can have arbitrary degree (not only triangles...
MRMESH_API MeshTopology fromTriangles(const Triangulation &t, const BuildSettings &settings={}, ProgressCallback progressCb={})
Definition MRCameraOrientationPlugin.h:8
MRMESH_API Vector3f findCenterFromBBox(const MeshTopology &topology, const VertCoords &points)
computes bounding box and returns its center
float discreteGaussianCurvature(const MeshTopology &topology, const VertCoords &points, VertId v, bool *outBoundaryVert=nullptr)
Definition MRMeshMath.h:298
MRMESH_API Vector3f findCenterFromFaces(const MeshTopology &topology, const VertCoords &points)
computes center of mass considering that density of all triangles is the same
MRMESH_API Vector3f findCenterFromPoints(const MeshTopology &topology, const VertCoords &points)
computes average position of all valid mesh vertices
MRMESH_API UndirectedEdgeScalars edgeLengths(const MeshTopology &topology, const VertCoords &points)
computes and returns the lengths of all edges in the mesh
MRMESH_API Expected< VertBitSet > findSpikeVertices(const MeshTopology &topology, const VertCoords &points, float minSumAngle, const VertBitSet *region=nullptr, const ProgressCallback &cb={})
returns vertices where the sum of triangle angles is below given threshold
float area(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns the area of given face
Definition MRMeshMath.h:165
MRMESH_API Vector3f leftTangent(const MeshTopology &topology, const VertCoords &points, EdgeId e)
computes unit vector that is both orthogonal to given edge and to the normal of its left triangle,...
MRMESH_API float circumcircleDiameter(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns circumcircle diameter of given mesh triangle
MRMESH_API double holePerimeter(const MeshTopology &topology, const VertCoords &points, EdgeId e)
computes the perimeter of the hole specified by one of its edges with no valid left face (left is hol...
Vector3f edgeVector(const MeshTopology &topology, const VertCoords &points, EdgeId e)
returns vector equal to edge destination point minus edge origin point
Definition MRMeshMath.h:24
MRMESH_API float dihedralAngle(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
MRMESH_API MeshEdgePoint toEdgePoint(const MeshTopology &topology, const VertCoords &points, EdgeId e, const Vector3f &p)
converts edge and 3d point into edge-point representation
MRMESH_API Vector3f triCenter(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns the centroid of given triangle
MRMESH_API UndirectedEdgeBitSet findCreaseEdges(const MeshTopology &topology, const VertCoords &points, float angleFromPlanar)
finds all mesh edges where dihedral angle is distinct from planar PI angle on at least given value
MRMESH_API float dihedralAngleCos(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
void getTriPoints(const MeshTopology &topology, const VertCoords &points, FaceId f, Vector3f &v0, Vector3f &v1, Vector3f &v2)
returns three points of given face
Definition MRMeshMath.h:69
MRMESH_API Vector3d holeDirArea(const MeshTopology &topology, const VertCoords &points, EdgeId e)
MRMESH_API MeshTriPoint toTriPoint(const MeshTopology &topology, const VertCoords &points, FaceId f, const Vector3f &p)
converts face id and 3d point into barycentric representation
MRMESH_API float averageEdgeLength(const MeshTopology &topology, const VertCoords &points)
computes average length of an edge in the mesh given by (topology, points)
Vector3f destPnt(const MeshTopology &topology, const VertCoords &points, EdgeId e)
returns coordinates of the edge destination
Definition MRMeshMath.h:18
MRMESH_API float leftCotan(const MeshTopology &topology, const VertCoords &points, EdgeId e)
Vector3f dirDblArea(const MeshTopology &topology, const VertCoords &points, FaceId f)
computes directed double area for a triangular face from its vertices
Definition MRMeshMath.h:150
MRMESH_API float triangleAspectRatio(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns aspect ratio of given mesh triangle equal to the ratio of the circum-radius to twice its in-r...
MRMESH_API void getLeftTriPoints(const MeshTopology &topology, const VertCoords &points, EdgeId e, Vector3f &v0, Vector3f &v1, Vector3f &v2)
returns three points of left face of e: v0 = orgPnt( e ), v1 = destPnt( e )
Vector3f edgePoint(const MeshTopology &topology, const VertCoords &points, EdgeId e, float f)
returns a point on the edge: origin point for f=0 and destination point for f=1
Definition MRMeshMath.h:33
MRMESH_API Vector3f pseudonormal(const MeshTopology &topology, const VertCoords &points, VertId v, const FaceBitSet *region=nullptr)
float edgeLengthSq(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
returns squared Euclidean length of the edge (faster to compute than length)
Definition MRMeshMath.h:141
MRMESH_API double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
MRMESH_API Vector3f triPoint(const MeshTopology &topology, const VertCoords &points, const MeshTriPoint &p)
computes coordinates of point given as face and barycentric representation
Vector3f orgPnt(const MeshTopology &topology, const VertCoords &points, EdgeId e)
returns coordinates of the edge origin
Definition MRMeshMath.h:12
MRMESH_API float discreteMeanCurvature(const MeshTopology &topology, const VertCoords &points, VertId v)
MRMESH_API float circumcircleDiameterSq(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns squared circumcircle diameter of given mesh triangle
Vector3f edgeCenter(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
computes the center of given edge
Definition MRMeshMath.h:45
MRMESH_API UndirectedEdgeId getClosestEdge(const MeshTopology &topology, const VertCoords &points, const PointOnFace &p)
returns one of three face edges, closest to given point
float dblArea(const MeshTopology &topology, const VertCoords &points, FaceId f)
returns twice the area of given face
Definition MRMeshMath.h:159
float edgeLength(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
returns Euclidean length of the edge
Definition MRMeshMath.h:132
MRMESH_API MR_BIND_IGNORE Vector3d dirArea(const MeshTopology &topology, const VertCoords &points, const FaceBitSet &fs)
MRMESH_API VertId getClosestVertex(const MeshTopology &topology, const VertCoords &points, const PointOnFace &p)
returns one of three face vertices, closest to given point
MRMESH_API Vector3f leftDirDblArea(const MeshTopology &topology, const VertCoords &points, EdgeId e)
computes directed double area of left triangular face of given edge
MRMESH_API MR_BIND_IGNORE double projArea(const MeshTopology &topology, const VertCoords &points, const Vector3f &dir, const FaceBitSet &fs)
float cotan(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId ue)
Definition MRMeshMath.h:312
Vector3f normal(const MeshTopology &topology, const VertCoords &points, FaceId f)
computes triangular face normal from its vertices
Definition MRMeshMath.h:221
MRMESH_API float sumAngles(const MeshTopology &topology, const VertCoords &points, VertId v, bool *outBoundaryVert=nullptr)
computes the sum of triangle angles at given vertex; optionally returns whether the vertex is on boun...
Vector3f leftNormal(const MeshTopology &topology, const VertCoords &points, EdgeId e)
computes triangular face normal from its vertices
Definition MRMeshMath.h:215
MRMESH_API float dihedralAngleSin(const MeshTopology &topology, const VertCoords &points, UndirectedEdgeId e)
float holePerimeter(MeshTopology topology, VertCoords points, EdgeId e)
float circumcircleDiameter(MeshTopology topology, VertCoords points, FaceId f)
Vector3f leftTangent(MeshTopology topology, VertCoords points, EdgeId e)
EdgePoint toEdgePoint(MeshTopology topology, VertCoords points, EdgeId e, Vector3f p)
float area(MeshTopology topology, VertCoords points, FaceId f)
None getLeftTriPoints(MeshTopology topology, VertCoords points, EdgeId e, Vector3f v0, Vector3f v1, Vector3f v2)
Vector3f edgePoint(MeshTopology topology, VertCoords points, EdgeId e, float f)
UndirectedEdgeBitSet findCreaseEdges(MeshTopology topology, VertCoords points, float angleFromPlanar)
Vector3f destPnt(MeshTopology topology, VertCoords points, EdgeId e)
VertBitSet findSpikeVertices(MeshTopology topology, VertCoords points, float minSumAngle, VertBitSet region=None, func_bool_from_float cb='{}')
ObjectPoints cloneRegion(ObjectPoints objPoints, VertBitSet region)
float edgeLength(MeshTopology topology, VertCoords points, UndirectedEdgeId e)
float cotan(MeshTopology topology, VertCoords points, UndirectedEdgeId ue)
Vector3f dirDblArea(MeshTopology topology, VertCoords points, FaceId f)
LineSegm3f edgeSegment(MeshTopology topology, VertCoords points, EdgeId e)
Vector3f leftDirDblArea(MeshTopology topology, VertCoords points, EdgeId e)
float triangleAspectRatio(MeshTopology topology, VertCoords points, FaceId f)
float discreteGaussianCurvature(MeshTopology topology, VertCoords points, VertId v, bool_output outBoundaryVert=None)
UndirectedEdgeScalars edgeLengths(MeshTopology topology, VertCoords points)
float averageEdgeLength(MeshTopology topology, VertCoords points)
Box3f computeBoundingBox(MeshTopology topology, VertCoords points, FaceBitSet region, AffineXf3f toWorld=None)
Plane3f getPlane3f(MeshTopology topology, VertCoords points, FaceId f)
Vector3f findCenterFromFaces(MeshTopology topology, VertCoords points)
ObjectPoints pack(ObjectPoints pts, Reorder reorder, VertBitSet newValidVerts=None, func_bool_from_float cb='{}')
float projArea(MeshTopology topology, VertCoords points, Vector3f dir, FaceBitSet fs=None)
QuadraticForm3f quadraticForm(MeshTopology topology, VertCoords points, VertId v, bool angleWeigted, FaceBitSet region=None, UndirectedEdgeBitSet creases=None)
float leftCotan(MeshTopology topology, VertCoords points, EdgeId e)
Vector3f pseudonormal(MeshTopology topology, VertCoords points, VertId v, FaceBitSet region=None)
float calcFastWindingNumber(Dipoles dipoles, AABBTree tree, Mesh mesh, Vector3f q, float beta, FaceId skipFace)
Vector3f triPoint(MeshTopology topology, VertCoords points, MeshTriPoint p)
UndirectedEdgeId getClosestEdge(MeshTopology topology, VertCoords points, PointOnFace p)
MeshTriPoint toTriPoint(MeshTopology topology, VertCoords points, FaceId f, Vector3f p)
Vector3f orgPnt(MeshTopology topology, VertCoords points, EdgeId e)
Vector3f findCenterFromPoints(MeshTopology topology, VertCoords points)
Vector3d dirArea(MeshTopology topology, VertCoords points, FaceBitSet fs=None)
int heapBytes(FloatGrid grid)
float discreteMeanCurvature(MeshTopology topology, VertCoords points, VertId v)
Vector3f leftNormal(MeshTopology topology, VertCoords points, EdgeId e)
float volume(MeshTopology topology, VertCoords points, FaceBitSet region=None)
Vector3f triCenter(MeshTopology topology, VertCoords points, FaceId f)
Vector3f edgeVector(MeshTopology topology, VertCoords points, EdgeId e)
float dihedralAngleCos(MeshTopology topology, VertCoords points, UndirectedEdgeId e)
float dihedralAngleSin(MeshTopology topology, VertCoords points, UndirectedEdgeId e)
VertId getClosestVertex(MeshTopology topology, VertCoords points, PointOnFace p)
None getTriPoints(MeshTopology topology, VertCoords points, FaceId f, Vector3f v0, Vector3f v1, Vector3f v2)
Plane3d getPlane3d(MeshTopology topology, VertCoords points, FaceId f)
Vector3d holeDirArea(MeshTopology topology, VertCoords points, EdgeId e)
float circumcircleDiameterSq(MeshTopology topology, VertCoords points, FaceId f)
Vector3f edgeCenter(MeshTopology topology, VertCoords points, UndirectedEdgeId e)
float sumAngles(MeshTopology topology, VertCoords points, VertId v, bool_output outBoundaryVert=None)
float dihedralAngle(MeshTopology topology, VertCoords points, UndirectedEdgeId e)
Vector3f findCenterFromBBox(MeshTopology topology, VertCoords points)
float dblArea(MeshTopology topology, VertCoords points, FaceId f)
Vector3f normal(MeshTopology topology, VertCoords points, MeshTriPoint p)
float edgeLengthSq(MeshTopology topology, VertCoords points, UndirectedEdgeId e)