MeshLib Python Docs
Loading...
Searching...
No Matches
meshlib.mrmeshpy.Mesh Class Reference

Public Member Functions

bool __eq__ (self, Mesh b)
 
None __init__ (self)
 
None __init__ (self, Mesh arg0)
 
None addPart (self, Mesh from_, FaceMap outFmap=None, VertMap outVmap=None, WholeEdgeMap outEmap=None, bool rearrangeTriangles=False)
 
None addPartByFaceMap (self, Mesh from_, FaceMap fromFaces, bool flipOrientation=False, std_vector_std_vector_Id_EdgeTag thisContours='std::vector< MR::EdgePath >{}', std_vector_std_vector_Id_EdgeTag fromContours='std::vector< MR::EdgePath >{}', PartMapping map='MR::PartMapping{}')
 
None addPartByMask (self, Mesh from_, FaceBitSet fromFaces, PartMapping map)
 
None addPartByMask (self, Mesh from_, FaceBitSet fromFaces, bool flipOrientation=False, std_vector_std_vector_Id_EdgeTag thisContours='std::vector< MR::EdgePath >{}', std_vector_std_vector_Id_EdgeTag fromContours='std::vector< MR::EdgePath >{}', PartMapping map='MR::PartMapping{}')
 
VertId addPoint (self, Vector3f pos)
 
Id_EdgeTag addSeparateContours (self, std_vector_std_vector_Vector3_float contours, AffineXf3f xf=None)
 
Id_EdgeTag addSeparateEdgeLoop (self, std_vector_Vector3_float contourPoints)
 
float area (self, FaceId f)
 
float area (self, FaceBitSet fs)
 
float area (self, FaceBitSet fs=None)
 
None attachEdgeLoopPart (self, Id_EdgeTag first, Id_EdgeTag last, std_vector_Vector3_float contourPoints)
 
float averageEdgeLength (self)
 
float calcFastWindingNumber (self, Vector3f pt, float beta=2)
 
float circumcircleDiameter (self, FaceId f)
 
float circumcircleDiameterSq (self, FaceId f)
 
Mesh cloneRegion (self, FaceBitSet region, bool flipOrientation=False, PartMapping map='MR::PartMapping{}')
 
Box3f computeBoundingBox (self, AffineXf3f toWorld=None)
 
Box3f computeBoundingBox (self, FaceBitSet region, AffineXf3f toWorld=None)
 
float cotan (self, UndirectedEdgeId ue)
 
float dblArea (self, FaceId f)
 
float dblArea (self, VertId v)
 
None deleteFaces (self, FaceBitSet fs, UndirectedEdgeBitSet keepEdges=None)
 
Vector3f destPnt (self, Id_EdgeTag e)
 
float dihedralAngle (self, UndirectedEdgeId e)
 
float dihedralAngleCos (self, UndirectedEdgeId e)
 
float dihedralAngleSin (self, UndirectedEdgeId e)
 
Vector3d dirArea (self, FaceBitSet fs)
 
Vector3d dirArea (self, FaceBitSet fs=None)
 
Vector3f dirDblArea (self, FaceId f)
 
Vector3f dirDblArea (self, VertId v)
 
float discreteGaussianCurvature (self, VertId v, bool_output outBoundaryVert=None)
 
float discreteMeanCurvature (self, VertId v)
 
float discreteMeanCurvature (self, UndirectedEdgeId e)
 
Vector3f edgeCenter (self, UndirectedEdgeId e)
 
float edgeLength (self, UndirectedEdgeId e)
 
float edgeLengthSq (self, UndirectedEdgeId e)
 
Vector3f edgePoint (self, Id_EdgeTag e, float f)
 
Vector3f edgePoint (self, EdgePoint ep)
 
LineSegm3f edgeSegment (self, Id_EdgeTag e)
 
Vector3f edgeVector (self, Id_EdgeTag e)
 
Vector3f findCenterFromBBox (self)
 
Vector3f findCenterFromFaces (self)
 
Vector3f findCenterFromPoints (self)
 
bool findClosestPoint (self, Vector3f point, MeshProjectionResult res, float maxDistSq=3.4028234663852886e+38, FaceBitSet region=None, AffineXf3f xf=None)
 
MeshProjectionResult findClosestPoint (self, Vector3f point, float maxDistSq=3.4028234663852886e+38, FaceBitSet region=None, AffineXf3f xf=None)
 
UndirectedEdgeBitSet findCreaseEdges (self, float angleFromPlanar)
 
VertBitSet findSpikeVertices (self, float minSumAngle, VertBitSet region=None, func_bool_from_float cb='MR::ProgressCallback{}')
 
AABBTree getAABBTree (self)
 
AABBTree getAABBTreeNotCreate (self)
 
AABBTreePoints getAABBTreePoints (self)
 
AABBTreePoints getAABBTreePointsNotCreate (self)
 
Box3f getBoundingBox (self)
 
UndirectedEdgeId getClosestEdge (self, PointOnFace p)
 
UndirectedEdgeId getClosestEdge (self, MeshTriPoint p)
 
VertId getClosestVertex (self, PointOnFace p)
 
VertId getClosestVertex (self, MeshTriPoint p)
 
Dipoles getDipoles (self)
 
Dipoles getDipolesNotCreate (self)
 
None getLeftTriPoints (self, Id_EdgeTag e, Vector3f v0, Vector3f v1, Vector3f v2)
 
std_array_Vector3_float_3 getLeftTriPoints (self, Id_EdgeTag e)
 
None getTriPoints (self, FaceId f, Vector3f v0, Vector3f v1, Vector3f v2)
 
std_array_Vector3_float_3 getTriPoints (self, FaceId f)
 
int heapBytes (self)
 
Vector3d holeDirArea (self, Id_EdgeTag e)
 
float holePerimiter (self, Id_EdgeTag e)
 
None invalidateCaches (self, bool pointsChanged=True)
 
bool isOutside (self, Vector3f pt, float windingNumberThreshold=0.5, float beta=2)
 
bool isOutsideByProjNorm (self, Vector3f pt, MeshProjectionResult proj, FaceBitSet region=None)
 
float leftCotan (self, Id_EdgeTag e)
 
Vector3f leftDirDblArea (self, Id_EdgeTag e)
 
Vector3f leftNormal (self, Id_EdgeTag e)
 
None mirror (self, Plane3f plane)
 
Vector3f normal (self, FaceId f)
 
Vector3f normal (self, VertId v)
 
Vector3f normal (self, MeshTriPoint p)
 
Vector3f orgPnt (self, Id_EdgeTag e)
 
None pack (self, FaceMap outFmap=None, VertMap outVmap=None, WholeEdgeMap outEmap=None, bool rearrangeTriangles=False)
 
PackMapping packOptimally (self, bool preserveAABBTree=True)
 
PackMapping packOptimally (self, bool preserveAABBTree, func_bool_from_float cb)
 
float projArea (self, Vector3f dir, FaceBitSet fs)
 
float projArea (self, Vector3f dir, FaceBitSet fs=None)
 
bool projectPoint (self, Vector3f point, PointOnFace res, float maxDistSq=3.4028234663852886e+38, FaceBitSet region=None, AffineXf3f xf=None)
 
bool projectPoint (self, Vector3f point, MeshProjectionResult res, float maxDistSq=3.4028234663852886e+38, FaceBitSet region=None, AffineXf3f xf=None)
 
MeshProjectionResult projectPoint (self, Vector3f point, float maxDistSq=3.4028234663852886e+38, FaceBitSet region=None, AffineXf3f xf=None)
 
Vector3f pseudonormal (self, VertId v, FaceBitSet region=None)
 
Vector3f pseudonormal (self, UndirectedEdgeId e, FaceBitSet region=None)
 
Vector3f pseudonormal (self, MeshTriPoint p, FaceBitSet region=None)
 
QuadraticForm3f quadraticForm (self, VertId v, FaceBitSet region=None, UndirectedEdgeBitSet creases=None)
 
None shrinkToFit (self)
 
float signedDistance (self, Vector3f pt, MeshProjectionResult proj, FaceBitSet region=None)
 
float signedDistance (self, Vector3f pt, MeshTriPoint proj, FaceBitSet region=None)
 
float signedDistance (self, Vector3f pt)
 
float signedDistance (self, Vector3f pt, float maxDistSq, FaceBitSet region=None)
 
Id_EdgeTag splitEdge (self, Id_EdgeTag e, Vector3f newVertPos, FaceBitSet region=None, phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old=None)
 
Id_EdgeTag splitEdge (self, Id_EdgeTag e, FaceBitSet region=None, phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old=None)
 
VertId splitFace (self, FaceId f, Vector3f newVertPos, FaceBitSet region=None, phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old=None)
 
VertId splitFace (self, FaceId f, FaceBitSet region=None, phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old=None)
 
float sumAngles (self, VertId v, bool_output outBoundaryVert=None)
 
EdgePoint toEdgePoint (self, VertId v)
 
EdgePoint toEdgePoint (self, Id_EdgeTag e, Vector3f p)
 
MeshTriPoint toTriPoint (self, VertId v)
 
MeshTriPoint toTriPoint (self, FaceId f, Vector3f p)
 
MeshTriPoint toTriPoint (self, PointOnFace p)
 
None transform (self, AffineXf3f xf, VertBitSet region=None)
 
Vector3f triCenter (self, FaceId f)
 
Vector3f triPoint (self, MeshTriPoint p)
 
float triangleAspectRatio (self, FaceId f)
 
None updateCaches (self, VertBitSet changedVerts)
 
float volume (self, FaceBitSet region=None)
 
None zeroUnusedPoints (self)
 

Static Public Member Functions

Mesh fromFaceSoup (VertCoords vertexCoordinates, std_vector_Id_VertTag verts, Vector_MeshBuilder_VertSpan_FaceId faces, MeshBuilder.BuildSettings settings='MR::MeshBuilder::BuildSettings{}', func_bool_from_float cb='MR::ProgressCallback{}')
 
Mesh fromPointTriples (std_vector_std_array_Vector3_float_3ul posTriples, bool duplicateNonManifoldVertices)
 
Mesh fromTriMesh (TriMesh triMesh, MeshBuilder.BuildSettings settings='MR::MeshBuilder::BuildSettings{}', func_bool_from_float cb='MR::ProgressCallback{}')
 
Mesh fromTriangles (VertCoords vertexCoordinates, Triangulation t, MeshBuilder.BuildSettings settings='MR::MeshBuilder::BuildSettings{}', func_bool_from_float cb='MR::ProgressCallback{}')
 
Mesh fromTrianglesDuplicatingNonManifoldVertices (VertCoords vertexCoordinates, Triangulation t, std_vector_MeshBuilder_VertDuplication dups=None, MeshBuilder.BuildSettings settings='MR::MeshBuilder::BuildSettings{}')
 

Detailed Description

Generated from:  MR::Mesh

This class represents a mesh, including topology (connectivity) information and point coordinates,
as well as some caches to accelerate search algorithms
\\ingroup MeshGroup

Constructor & Destructor Documentation

◆ __init__() [1/2]

None meshlib.mrmeshpy.Mesh.__init__ ( self)
Implicit default constructor.

◆ __init__() [2/2]

None meshlib.mrmeshpy.Mesh.__init__ ( self,
Mesh arg0 )
Implicit copy constructor.

Member Function Documentation

◆ __eq__()

bool meshlib.mrmeshpy.Mesh.__eq__ ( self,
Mesh b )
compare that two meshes are exactly the same

◆ addPart()

None meshlib.mrmeshpy.Mesh.addPart ( self,
Mesh from_,
FaceMap outFmap = None,
VertMap outVmap = None,
WholeEdgeMap outEmap = None,
bool rearrangeTriangles = False )
appends mesh (from) in addition to this mesh: creates new edges, faces, verts and points

◆ addPartByFaceMap()

None meshlib.mrmeshpy.Mesh.addPartByFaceMap ( self,
Mesh from_,
FaceMap fromFaces,
bool flipOrientation = False,
std_vector_std_vector_Id_EdgeTag thisContours = 'std::vector<MR::EdgePath>{}',
std_vector_std_vector_Id_EdgeTag fromContours = 'std::vector<MR::EdgePath>{}',
PartMapping map = 'MR::PartMapping{}' )
fromFaces contains mapping from this-mesh (considering it is empty) to from-mesh

◆ addPartByMask() [1/2]

None meshlib.mrmeshpy.Mesh.addPartByMask ( self,
Mesh from_,
FaceBitSet fromFaces,
bool flipOrientation = False,
std_vector_std_vector_Id_EdgeTag thisContours = 'std::vector<MR::EdgePath>{}',
std_vector_std_vector_Id_EdgeTag fromContours = 'std::vector<MR::EdgePath>{}',
PartMapping map = 'MR::PartMapping{}' )
this version has more parameters:
  if flipOrientation then every from triangle is inverted before adding

◆ addPartByMask() [2/2]

None meshlib.mrmeshpy.Mesh.addPartByMask ( self,
Mesh from_,
FaceBitSet fromFaces,
PartMapping map )
the same but copies only portion of (from) specified by fromFaces

◆ addPoint()

VertId meshlib.mrmeshpy.Mesh.addPoint ( self,
Vector3f pos )
creates new point and assigns given position to it

◆ addSeparateContours()

Id_EdgeTag meshlib.mrmeshpy.Mesh.addSeparateContours ( self,
std_vector_std_vector_Vector3_float contours,
AffineXf3f xf = None )
append points to mesh and connect them
returns first EdgeId of new edges

◆ addSeparateEdgeLoop()

Id_EdgeTag meshlib.mrmeshpy.Mesh.addSeparateEdgeLoop ( self,
std_vector_Vector3_float contourPoints )
append points to mesh and connect them as closed edge loop
returns first EdgeId of new edges

◆ area() [1/3]

float meshlib.mrmeshpy.Mesh.area ( self,
FaceBitSet fs )
computes the area of given face-region

◆ area() [2/3]

float meshlib.mrmeshpy.Mesh.area ( self,
FaceBitSet fs = None )
computes the area of given face-region (or whole mesh)

◆ area() [3/3]

float meshlib.mrmeshpy.Mesh.area ( self,
FaceId f )
returns the area of given face

◆ attachEdgeLoopPart()

None meshlib.mrmeshpy.Mesh.attachEdgeLoopPart ( self,
Id_EdgeTag first,
Id_EdgeTag last,
std_vector_Vector3_float contourPoints )
append points to mesh and connect them to given edges making edge loop
first point connects with first edge dest
last point connects with last edge org
note that first and last edge should have no left face

◆ averageEdgeLength()

float meshlib.mrmeshpy.Mesh.averageEdgeLength ( self)
computes average length of an edge in this mesh

◆ calcFastWindingNumber()

float meshlib.mrmeshpy.Mesh.calcFastWindingNumber ( self,
Vector3f pt,
float beta = 2 )
computes generalized winding number in a point (pt), which is
* for closed mesh with normals outside: 1 inside, 0 outside;
* for planar mesh: 0.5 inside, -0.5 outside;
and in general is equal to (portion of solid angle where inside part of mesh is observable) minus (portion of solid angle where outside part of mesh is observable)
\\param beta determines the precision of fast approximation: the more the better, recommended value 2 or more

◆ circumcircleDiameter()

float meshlib.mrmeshpy.Mesh.circumcircleDiameter ( self,
FaceId f )
returns circumcircle diameter of given mesh triangle

◆ circumcircleDiameterSq()

float meshlib.mrmeshpy.Mesh.circumcircleDiameterSq ( self,
FaceId f )
returns squared circumcircle diameter of given mesh triangle

◆ cloneRegion()

Mesh meshlib.mrmeshpy.Mesh.cloneRegion ( self,
FaceBitSet region,
bool flipOrientation = False,
PartMapping map = 'MR::PartMapping{}' )
creates new mesh from given triangles of this mesh

◆ computeBoundingBox() [1/2]

Box3f meshlib.mrmeshpy.Mesh.computeBoundingBox ( self,
AffineXf3f toWorld = None )
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

◆ computeBoundingBox() [2/2]

Box3f meshlib.mrmeshpy.Mesh.computeBoundingBox ( self,
FaceBitSet region,
AffineXf3f toWorld = None )
passes through all given faces (or whole mesh 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

◆ cotan()

float meshlib.mrmeshpy.Mesh.cotan ( self,
UndirectedEdgeId ue )
computes sum of cotangents of the angle in the left and right triangles opposite to given edge,
and returns 0 if left face does not exist

◆ dblArea() [1/2]

float meshlib.mrmeshpy.Mesh.dblArea ( self,
FaceId f )
returns twice the area of given face

◆ dblArea() [2/2]

float meshlib.mrmeshpy.Mesh.dblArea ( self,
VertId v )
computes the length of summed directed double areas of all triangles around given vertex

◆ deleteFaces()

None meshlib.mrmeshpy.Mesh.deleteFaces ( self,
FaceBitSet fs,
UndirectedEdgeBitSet keepEdges = None )
deletes multiple given faces, also deletes adjacent edges and vertices if they were not shared by remaining faces ant not in \\param keepFaces

◆ destPnt()

Vector3f meshlib.mrmeshpy.Mesh.destPnt ( self,
Id_EdgeTag e )
returns coordinates of the edge destination

◆ dihedralAngle()

float meshlib.mrmeshpy.Mesh.dihedralAngle ( self,
UndirectedEdgeId e )
given an edge between two triangular faces, computes the dihedral angle between them:
0 if both faces are in the same plane,
positive if the faces form convex surface,
negative if the faces form concave surface;
please consider the usage of faster dihedralAngleSin(e) and dihedralAngleCos(e)

◆ dihedralAngleCos()

float meshlib.mrmeshpy.Mesh.dihedralAngleCos ( self,
UndirectedEdgeId e )
given an edge between two triangular faces, computes cosine of dihedral angle between them:
1 if both faces are in the same plane,
0 if the surface makes right angle turn at the edge,
-1 if the faces overlap one another

◆ dihedralAngleSin()

float meshlib.mrmeshpy.Mesh.dihedralAngleSin ( self,
UndirectedEdgeId e )
given an edge between two triangular faces, computes sine of dihedral angle between them:
0 if both faces are in the same plane,
positive if the faces form convex surface,
negative if the faces form concave surface

◆ dirArea() [1/2]

Vector3d meshlib.mrmeshpy.Mesh.dirArea ( self,
FaceBitSet fs )
computes the sum of directed areas for faces from given region

◆ dirArea() [2/2]

Vector3d meshlib.mrmeshpy.Mesh.dirArea ( self,
FaceBitSet fs = None )
computes the sum of directed areas for faces from given region (or whole mesh)

◆ dirDblArea() [1/2]

Vector3f meshlib.mrmeshpy.Mesh.dirDblArea ( self,
FaceId f )
computes directed double area for a triangular face from its vertices

◆ dirDblArea() [2/2]

Vector3f meshlib.mrmeshpy.Mesh.dirDblArea ( self,
VertId v )
computes sum of directed double areas of all triangles around given vertex

◆ discreteGaussianCurvature()

float meshlib.mrmeshpy.Mesh.discreteGaussianCurvature ( self,
VertId v,
bool_output outBoundaryVert = None )
computes discrete Gaussian curvature (or angle defect) at given vertex,
which 0 in inner vertices on planar mesh parts and reaches 2*pi on needle's tip, see http://math.uchicago.edu/~may/REU2015/REUPapers/Upadhyay.pdf
optionally returns whether the vertex is on boundary

◆ discreteMeanCurvature() [1/2]

float meshlib.mrmeshpy.Mesh.discreteMeanCurvature ( self,
UndirectedEdgeId e )
computes discrete mean curvature in given edge, measures in length^-1;
0 for planar regions, positive for convex surface, negative for concave surface

◆ discreteMeanCurvature() [2/2]

float meshlib.mrmeshpy.Mesh.discreteMeanCurvature ( self,
VertId v )
computes discrete mean curvature in given vertex, measures in length^-1;
0 for planar regions, positive for convex surface, negative for concave surface

◆ edgeCenter()

Vector3f meshlib.mrmeshpy.Mesh.edgeCenter ( self,
UndirectedEdgeId e )
computes the center of given edge

◆ edgeLength()

float meshlib.mrmeshpy.Mesh.edgeLength ( self,
UndirectedEdgeId e )
returns Euclidean length of the edge

◆ edgeLengthSq()

float meshlib.mrmeshpy.Mesh.edgeLengthSq ( self,
UndirectedEdgeId e )
returns squared Euclidean length of the edge (faster to compute than length)

◆ edgePoint() [1/2]

Vector3f meshlib.mrmeshpy.Mesh.edgePoint ( self,
EdgePoint ep )
computes coordinates of point given as edge and relative position on it

◆ edgePoint() [2/2]

Vector3f meshlib.mrmeshpy.Mesh.edgePoint ( self,
Id_EdgeTag e,
float f )
returns a point on the edge: origin point for f=0 and destination point for f=1

◆ edgeSegment()

LineSegm3f meshlib.mrmeshpy.Mesh.edgeSegment ( self,
Id_EdgeTag e )
returns line segment of given edge

◆ edgeVector()

Vector3f meshlib.mrmeshpy.Mesh.edgeVector ( self,
Id_EdgeTag e )
returns vector equal to edge destination point minus edge origin point

◆ findCenterFromBBox()

Vector3f meshlib.mrmeshpy.Mesh.findCenterFromBBox ( self)
computes bounding box and returns its center

◆ findCenterFromFaces()

Vector3f meshlib.mrmeshpy.Mesh.findCenterFromFaces ( self)
computes center of mass considering that density of all triangles is the same

◆ findCenterFromPoints()

Vector3f meshlib.mrmeshpy.Mesh.findCenterFromPoints ( self)
computes average position of all valid mesh vertices

◆ findClosestPoint() [1/2]

MeshProjectionResult meshlib.mrmeshpy.Mesh.findClosestPoint ( self,
Vector3f point,
float maxDistSq = 3.4028234663852886e+38,
FaceBitSet region = None,
AffineXf3f xf = None )

◆ findClosestPoint() [2/2]

bool meshlib.mrmeshpy.Mesh.findClosestPoint ( self,
Vector3f point,
MeshProjectionResult res,
float maxDistSq = 3.4028234663852886e+38,
FaceBitSet region = None,
AffineXf3f xf = None )

◆ findCreaseEdges()

UndirectedEdgeBitSet meshlib.mrmeshpy.Mesh.findCreaseEdges ( self,
float angleFromPlanar )
finds all mesh edges where dihedral angle is distinct from planar PI angle on at least given value

◆ findSpikeVertices()

VertBitSet meshlib.mrmeshpy.Mesh.findSpikeVertices ( self,
float minSumAngle,
VertBitSet region = None,
func_bool_from_float cb = 'MR::ProgressCallback{}' )
returns vertices where the sum of triangle angles is below given threshold

◆ fromFaceSoup()

Mesh meshlib.mrmeshpy.Mesh.fromFaceSoup ( VertCoords vertexCoordinates,
std_vector_Id_VertTag verts,
Vector_MeshBuilder_VertSpan_FaceId faces,
MeshBuilder.BuildSettings settings = 'MR::MeshBuilder::BuildSettings{}',
func_bool_from_float cb = 'MR::ProgressCallback{}' )
static
construct mesh from vertex coordinates and construct mesh topology from face soup,
where each face can have arbitrary degree (not only triangles);
all non-triangular faces will be automatically subdivided on triangles

◆ fromPointTriples()

Mesh meshlib.mrmeshpy.Mesh.fromPointTriples ( std_vector_std_array_Vector3_float_3ul posTriples,
bool duplicateNonManifoldVertices )
static
construct mesh from point triples;
\\param duplicateNonManifoldVertices = false, all coinciding points are given the same VertId in the result;
\\param duplicateNonManifoldVertices = true, it tries to avoid non-manifold vertices by creating duplicate vertices with same coordinates 

◆ fromTriangles()

Mesh meshlib.mrmeshpy.Mesh.fromTriangles ( VertCoords vertexCoordinates,
Triangulation t,
MeshBuilder.BuildSettings settings = 'MR::MeshBuilder::BuildSettings{}',
func_bool_from_float cb = 'MR::ProgressCallback{}' )
static
construct mesh from vertex coordinates and a set of triangles with given ids

◆ fromTrianglesDuplicatingNonManifoldVertices()

Mesh meshlib.mrmeshpy.Mesh.fromTrianglesDuplicatingNonManifoldVertices ( VertCoords vertexCoordinates,
Triangulation t,
std_vector_MeshBuilder_VertDuplication dups = None,
MeshBuilder.BuildSettings settings = 'MR::MeshBuilder::BuildSettings{}' )
static
construct mesh from vertex coordinates and a set of triangles with given ids;
unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices

◆ fromTriMesh()

Mesh meshlib.mrmeshpy.Mesh.fromTriMesh ( TriMesh triMesh,
MeshBuilder.BuildSettings settings = 'MR::MeshBuilder::BuildSettings{}',
func_bool_from_float cb = 'MR::ProgressCallback{}' )
static
construct mesh from TriMesh representation

◆ getAABBTree()

AABBTree meshlib.mrmeshpy.Mesh.getAABBTree ( self)
returns cached aabb-tree for this mesh, creating it if it did not exist in a thread-safe manner

◆ getAABBTreeNotCreate()

AABBTree meshlib.mrmeshpy.Mesh.getAABBTreeNotCreate ( self)
returns cached aabb-tree for this mesh, but does not create it if it did not exist

◆ getAABBTreePoints()

AABBTreePoints meshlib.mrmeshpy.Mesh.getAABBTreePoints ( self)
returns cached aabb-tree for points of this mesh, creating it if it did not exist in a thread-safe manner

◆ getAABBTreePointsNotCreate()

AABBTreePoints meshlib.mrmeshpy.Mesh.getAABBTreePointsNotCreate ( self)
returns cached aabb-tree for points of this mesh, but does not create it if it did not exist

◆ getBoundingBox()

Box3f meshlib.mrmeshpy.Mesh.getBoundingBox ( self)
returns the bounding box containing all valid vertices (implemented via getAABBTree())
this bounding box is insignificantly bigger that minimal box due to AABB algorithms precision

◆ getClosestEdge() [1/2]

UndirectedEdgeId meshlib.mrmeshpy.Mesh.getClosestEdge ( self,
MeshTriPoint p )
returns one of three face edges, closest to given point

◆ getClosestEdge() [2/2]

UndirectedEdgeId meshlib.mrmeshpy.Mesh.getClosestEdge ( self,
PointOnFace p )
returns one of three face edges, closest to given point

◆ getClosestVertex() [1/2]

VertId meshlib.mrmeshpy.Mesh.getClosestVertex ( self,
MeshTriPoint p )
returns one of three face vertices, closest to given point

◆ getClosestVertex() [2/2]

VertId meshlib.mrmeshpy.Mesh.getClosestVertex ( self,
PointOnFace p )
returns one of three face vertices, closest to given point

◆ getDipoles()

Dipoles meshlib.mrmeshpy.Mesh.getDipoles ( self)
returns cached dipoles of aabb-tree nodes for this mesh, creating it if it did not exist in a thread-safe manner

◆ getDipolesNotCreate()

Dipoles meshlib.mrmeshpy.Mesh.getDipolesNotCreate ( self)
returns cached dipoles of aabb-tree nodes for this mesh, but does not create it if it did not exist

◆ getLeftTriPoints() [1/2]

std_array_Vector3_float_3 meshlib.mrmeshpy.Mesh.getLeftTriPoints ( self,
Id_EdgeTag e )
returns three points of left face of e

◆ getLeftTriPoints() [2/2]

None meshlib.mrmeshpy.Mesh.getLeftTriPoints ( self,
Id_EdgeTag e,
Vector3f v0,
Vector3f v1,
Vector3f v2 )
returns three points of left face of e

◆ getTriPoints() [1/2]

std_array_Vector3_float_3 meshlib.mrmeshpy.Mesh.getTriPoints ( self,
FaceId f )
returns three points of given face

◆ getTriPoints() [2/2]

None meshlib.mrmeshpy.Mesh.getTriPoints ( self,
FaceId f,
Vector3f v0,
Vector3f v1,
Vector3f v2 )
returns three points of given face

◆ heapBytes()

int meshlib.mrmeshpy.Mesh.heapBytes ( self)
returns the amount of memory this object occupies on heap

◆ holeDirArea()

Vector3d meshlib.mrmeshpy.Mesh.holeDirArea ( self,
Id_EdgeTag e )
computes directed area of the hole specified by one of its edges with no valid left face (left is hole);
if the hole is planar then returned vector is orthogonal to the plane pointing outside and its magnitude is equal to hole area

◆ holePerimiter()

float meshlib.mrmeshpy.Mesh.holePerimiter ( self,
Id_EdgeTag e )
computes the perimeter of the hole specified by one of its edges with no valid left face (left is hole)

◆ invalidateCaches()

None meshlib.mrmeshpy.Mesh.invalidateCaches ( self,
bool pointsChanged = True )
invalidates caches (aabb-trees) after any change in mesh geometry or topology
\\param pointsChanged specifies whether points have changed (otherwise only topology has changed)

◆ isOutside()

bool meshlib.mrmeshpy.Mesh.isOutside ( self,
Vector3f pt,
float windingNumberThreshold = 0.5,
float beta = 2 )
computes whether a point (pt) is located outside the object surrounded by this mesh using generalized winding number
\\param beta determines the precision of winding number computation: the more the better, recommended value 2 or more

◆ isOutsideByProjNorm()

bool meshlib.mrmeshpy.Mesh.isOutsideByProjNorm ( self,
Vector3f pt,
MeshProjectionResult proj,
FaceBitSet region = None )
computes whether a point (pt) is located outside the object surrounded by this mesh
using pseudonormal at the closest point to in on mesh (proj);
this method works much faster than \\ref isOutside but can return wrong sign if the closest point is located on self-intersecting part of the mesh

◆ leftCotan()

float meshlib.mrmeshpy.Mesh.leftCotan ( self,
Id_EdgeTag e )
computes cotangent of the angle in the left( e ) triangle opposite to e,
and returns 0 if left face does not exist

◆ leftDirDblArea()

Vector3f meshlib.mrmeshpy.Mesh.leftDirDblArea ( self,
Id_EdgeTag e )
computes directed double area of left triangular face of given edge

◆ leftNormal()

Vector3f meshlib.mrmeshpy.Mesh.leftNormal ( self,
Id_EdgeTag e )
computes triangular face normal from its vertices

◆ mirror()

None meshlib.mrmeshpy.Mesh.mirror ( self,
Plane3f plane )
reflects the mesh from a given plane

◆ normal() [1/3]

Vector3f meshlib.mrmeshpy.Mesh.normal ( self,
FaceId f )
computes triangular face normal from its vertices

◆ normal() [2/3]

Vector3f meshlib.mrmeshpy.Mesh.normal ( self,
MeshTriPoint p )
computes normal in three vertices of p's triangle, then interpolates them using barycentric coordinates and normalizes again;
this is the same normal as in rendering with smooth shading

◆ normal() [3/3]

Vector3f meshlib.mrmeshpy.Mesh.normal ( self,
VertId v )
computes normal in a vertex using sum of directed areas of neighboring triangles

◆ orgPnt()

Vector3f meshlib.mrmeshpy.Mesh.orgPnt ( self,
Id_EdgeTag e )
returns coordinates of the edge origin

◆ pack()

None meshlib.mrmeshpy.Mesh.pack ( self,
FaceMap outFmap = None,
VertMap outVmap = None,
WholeEdgeMap outEmap = None,
bool rearrangeTriangles = False )
tightly packs all arrays eliminating lone edges and invalid face, verts and points,
optionally returns mappings: old.id -> new.id

◆ packOptimally() [1/2]

PackMapping meshlib.mrmeshpy.Mesh.packOptimally ( self,
bool preserveAABBTree,
func_bool_from_float cb )

◆ packOptimally() [2/2]

PackMapping meshlib.mrmeshpy.Mesh.packOptimally ( self,
bool preserveAABBTree = True )
packs tightly and rearranges vertices, triangles and edges to put close in space elements in close indices
\\param preserveAABBTree whether to keep valid mesh's AABB tree after return (it will take longer to compute and it will occupy more memory)

◆ projArea() [1/2]

float meshlib.mrmeshpy.Mesh.projArea ( self,
Vector3f dir,
FaceBitSet fs )
computes the sum of absolute projected area of faces from given region as visible if look from given direction

◆ projArea() [2/2]

float meshlib.mrmeshpy.Mesh.projArea ( self,
Vector3f dir,
FaceBitSet fs = None )
computes the sum of absolute projected area of faces from given region (or whole mesh) as visible if look from given direction

◆ projectPoint() [1/3]

MeshProjectionResult meshlib.mrmeshpy.Mesh.projectPoint ( self,
Vector3f point,
float maxDistSq = 3.4028234663852886e+38,
FaceBitSet region = None,
AffineXf3f xf = None )
finds the closest mesh point on this mesh (or its region) to given point;
\\param point source location to look the closest to
\\param maxDistSq search only in the ball with sqrt(maxDistSq) radius around given point, smaller value here increases performance
\\param xf is mesh-to-point transformation, if not specified then identity transformation is assumed and works much faster;
\\return found closest point including Euclidean coordinates, barycentric coordinates, FaceId and squared distance to point
        or std::nullopt if no mesh point is found in the ball with sqrt(maxDistSq) radius around given point

◆ projectPoint() [2/3]

bool meshlib.mrmeshpy.Mesh.projectPoint ( self,
Vector3f point,
MeshProjectionResult res,
float maxDistSq = 3.4028234663852886e+38,
FaceBitSet region = None,
AffineXf3f xf = None )
finds the closest mesh point on this mesh (or its region) to given point;
\\param point source location to look the closest to
\\param res found closest point including Euclidean coordinates, barycentric coordinates, FaceId and squared distance to point
\\param maxDistSq search only in the ball with sqrt(maxDistSq) radius around given point, smaller value here increases performance
\\param xf is mesh-to-point transformation, if not specified then identity transformation is assumed and works much faster;
\\return false if no mesh point is found in the ball with sqrt(maxDistSq) radius around given point

◆ projectPoint() [3/3]

bool meshlib.mrmeshpy.Mesh.projectPoint ( self,
Vector3f point,
PointOnFace res,
float maxDistSq = 3.4028234663852886e+38,
FaceBitSet region = None,
AffineXf3f xf = None )
finds the closest mesh point on this mesh (or its region) to given point;
\\param point source location to look the closest to
\\param res found closest point including Euclidean coordinates and FaceId
\\param maxDistSq search only in the ball with sqrt(maxDistSq) radius around given point, smaller value here increases performance
\\param xf is mesh-to-point transformation, if not specified then identity transformation is assumed and works much faster;
\\return false if no mesh point is found in the ball with sqrt(maxDistSq) radius around given point

◆ pseudonormal() [1/3]

Vector3f meshlib.mrmeshpy.Mesh.pseudonormal ( self,
MeshTriPoint p,
FaceBitSet region = None )
returns pseudonormal in corresponding face/edge/vertex for signed distance calculation;
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.107.9173&rep=rep1&type=pdf
unlike normal( const MeshTriPoint & p ), this is not a smooth function

◆ pseudonormal() [2/3]

Vector3f meshlib.mrmeshpy.Mesh.pseudonormal ( self,
UndirectedEdgeId e,
FaceBitSet region = None )
computes normalized half sum of face normals sharing given edge (only (region) faces will be considered);

◆ pseudonormal() [3/3]

Vector3f meshlib.mrmeshpy.Mesh.pseudonormal ( self,
VertId v,
FaceBitSet region = None )
computes angle-weighted sum of normals of incident faces of given vertex (only (region) faces will be considered);
the sum is normalized before returning

◆ quadraticForm()

QuadraticForm3f meshlib.mrmeshpy.Mesh.quadraticForm ( self,
VertId v,
FaceBitSet region = None,
UndirectedEdgeBitSet creases = None )
computes quadratic form in the vertex as the sum of squared distances from
1) planes of adjacent triangles
2) lines of adjacent boundary and crease edges

◆ shrinkToFit()

None meshlib.mrmeshpy.Mesh.shrinkToFit ( self)
requests the removal of unused capacity

◆ signedDistance() [1/4]

float meshlib.mrmeshpy.Mesh.signedDistance ( self,
Vector3f pt )
given a point (pt) in 3D, computes the closest point on mesh, and
\\return signed distance from pt to mesh: positive value - outside mesh, negative - inside mesh;
this method can return wrong sign if the closest point is located on self-intersecting part of the mesh

◆ signedDistance() [2/4]

float meshlib.mrmeshpy.Mesh.signedDistance ( self,
Vector3f pt,
float maxDistSq,
FaceBitSet region = None )
given a point (pt) in 3D, computes the closest point on mesh, and
\\return signed distance from pt to mesh: positive value - outside mesh, negative - inside mesh;
  or std::nullopt if the projection point is not within maxDist;
this method can return wrong sign if the closest point is located on self-intersecting part of the mesh

◆ signedDistance() [3/4]

float meshlib.mrmeshpy.Mesh.signedDistance ( self,
Vector3f pt,
MeshProjectionResult proj,
FaceBitSet region = None )
given a point (pt) in 3D and the closest point to in on mesh (proj),
\\return signed distance from pt to mesh: positive value - outside mesh, negative - inside mesh;
this method can return wrong sign if the closest point is located on self-intersecting part of the mesh

◆ signedDistance() [4/4]

float meshlib.mrmeshpy.Mesh.signedDistance ( self,
Vector3f pt,
MeshTriPoint proj,
FaceBitSet region = None )

◆ splitEdge() [1/2]

Id_EdgeTag meshlib.mrmeshpy.Mesh.splitEdge ( self,
Id_EdgeTag e,
FaceBitSet region = None,
phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old = None )
same, but split given edge on two equal parts

◆ splitEdge() [2/2]

Id_EdgeTag meshlib.mrmeshpy.Mesh.splitEdge ( self,
Id_EdgeTag e,
Vector3f newVertPos,
FaceBitSet region = None,
phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old = None )
split given edge on two parts:
dest(returned-edge) = org(e) - newly created vertex,
org(returned-edge) = org(e-before-split),
dest(e) = dest(e-before-split)
\\details left and right faces of given edge if valid are also subdivided on two parts each;
if left or right faces of the original edge were in the region, then include new parts of these faces in the region
\\param new2Old receive mapping from newly appeared triangle to its original triangle (part to full)

◆ splitFace() [1/2]

VertId meshlib.mrmeshpy.Mesh.splitFace ( self,
FaceId f,
FaceBitSet region = None,
phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old = None )
same, putting new vertex in the centroid of original triangle

◆ splitFace() [2/2]

VertId meshlib.mrmeshpy.Mesh.splitFace ( self,
FaceId f,
Vector3f newVertPos,
FaceBitSet region = None,
phmap_flat_hash_map_Id_FaceTag_Id_FaceTag new2Old = None )
split given triangle on three triangles, introducing new vertex with given coordinates and connecting it to original triangle vertices;
if region is given, then it must include (f) and new faces will be added there as well
\\param new2Old receive mapping from newly appeared triangle to its original triangle (part to full)

◆ sumAngles()

float meshlib.mrmeshpy.Mesh.sumAngles ( self,
VertId v,
bool_output outBoundaryVert = None )
computes the sum of triangle angles at given vertex; optionally returns whether the vertex is on boundary

◆ toEdgePoint() [1/2]

EdgePoint meshlib.mrmeshpy.Mesh.toEdgePoint ( self,
Id_EdgeTag e,
Vector3f p )
converts edge and 3d point into edge-point representation

◆ toEdgePoint() [2/2]

EdgePoint meshlib.mrmeshpy.Mesh.toEdgePoint ( self,
VertId v )
converts vertex into edge-point representation

◆ toTriPoint() [1/3]

MeshTriPoint meshlib.mrmeshpy.Mesh.toTriPoint ( self,
FaceId f,
Vector3f p )
converts face id and 3d point into barycentric representation

◆ toTriPoint() [2/3]

MeshTriPoint meshlib.mrmeshpy.Mesh.toTriPoint ( self,
PointOnFace p )
converts face id and 3d point into barycentric representation

◆ toTriPoint() [3/3]

MeshTriPoint meshlib.mrmeshpy.Mesh.toTriPoint ( self,
VertId v )
converts vertex into barycentric representation

◆ transform()

None meshlib.mrmeshpy.Mesh.transform ( self,
AffineXf3f xf,
VertBitSet region = None )
applies given transformation to specified vertices
if region is nullptr, all valid mesh vertices are used

◆ triangleAspectRatio()

float meshlib.mrmeshpy.Mesh.triangleAspectRatio ( self,
FaceId f )
returns aspect ratio of given mesh triangle equal to the ratio of the circum-radius to twice its in-radius

◆ triCenter()

Vector3f meshlib.mrmeshpy.Mesh.triCenter ( self,
FaceId f )
returns the centroid of given triangle

◆ triPoint()

Vector3f meshlib.mrmeshpy.Mesh.triPoint ( self,
MeshTriPoint p )
computes coordinates of point given as face and barycentric representation

◆ updateCaches()

None meshlib.mrmeshpy.Mesh.updateCaches ( self,
VertBitSet changedVerts )
updates existing caches in case of few vertices were changed insignificantly,
and topology remained unchanged;
it shall be considered as a faster alternative to invalidateCaches() and following rebuild of trees

◆ volume()

float meshlib.mrmeshpy.Mesh.volume ( self,
FaceBitSet region = None )
returns volume of closed mesh region, if region is not closed DBL_MAX is returned
if region is nullptr - whole mesh is region

◆ zeroUnusedPoints()

None meshlib.mrmeshpy.Mesh.zeroUnusedPoints ( self)
for all points not in topology.getValidVerts() sets coordinates to (0,0,0)

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