MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::MeshTopology Class Reference

#include <MRMeshTopology.h>

Public Member Functions

MRMESH_API EdgeId makeEdge ()
 creates an edge not associated with any vertex or face
 
MRMESH_API bool isLoneEdge (EdgeId a) const
 checks whether the edge is disconnected from all other edges and disassociated from all vertices and faces (as if after makeEdge)
 
MRMESH_API UndirectedEdgeId lastNotLoneUndirectedEdge () const
 returns last not lone undirected edge id, or invalid id if no such edge exists
 
EdgeId lastNotLoneEdge () const
 returns last not lone edge id, or invalid id if no such edge exists
 
MRMESH_API void excludeLoneEdges (UndirectedEdgeBitSet &edges) const
 remove all lone edges from given set
 
size_t edgeSize () const
 returns the number of half-edge records including lone ones
 
size_t edgeCapacity () const
 returns the number of allocated edge records
 
size_t undirectedEdgeSize () const
 returns the number of undirected edges (pairs of half-edges) including lone ones
 
size_t undirectedEdgeCapacity () const
 returns the number of allocated undirected edges (pairs of half-edges)
 
MRMESH_API size_t computeNotLoneUndirectedEdges () const
 computes the number of not-lone (valid) undirected edges
 
MRMESH_API UndirectedEdgeBitSet findNotLoneUndirectedEdges () const
 finds and returns all not-lone (valid) undirected edges
 
void edgeReserve (size_t newCapacity)
 sets the capacity of half-edges vector
 
bool hasEdge (EdgeId e) const
 returns true if given edge is within valid range and not-lone
 
MRMESH_API size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 
MRMESH_API void shrinkToFit ()
 requests the removal of unused capacity
 
MRMESH_API void splice (EdgeId a, EdgeId b)
 
MRMESH_API EdgeId collapseEdge (EdgeId e, const std::function< void(EdgeId del, EdgeId rem)> &onEdgeDel)
 
EdgeId next (EdgeId he) const
 next (counter clock wise) half-edge in the origin ring
 
EdgeId prev (EdgeId he) const
 previous (clock wise) half-edge in the origin ring
 
VertId org (EdgeId he) const
 returns origin vertex of half-edge
 
VertId dest (EdgeId he) const
 returns destination vertex of half-edge
 
FaceId left (EdgeId he) const
 returns left face of half-edge
 
FaceId right (EdgeId he) const
 returns right face of half-edge
 
MRMESH_API void setOrg (EdgeId a, VertId v)
 
MRMESH_API void setLeft (EdgeId a, FaceId f)
 
MRMESH_API bool fromSameOriginRing (EdgeId a, EdgeId b) const
 returns true if a and b are both from the same origin ring
 
MRMESH_API bool fromSameLeftRing (EdgeId a, EdgeId b) const
 returns true if a and b are both from the same left face ring
 
MRMESH_API int getOrgDegree (EdgeId a) const
 returns the number of edges around the origin vertex, returns 1 for lone edges
 
int getVertDegree (VertId v) const
 returns the number of edges around the given vertex
 
MRMESH_API int getLeftDegree (EdgeId a) const
 returns the number of edges around the left face: 3 for triangular faces, ...
 
int getFaceDegree (FaceId f) const
 returns the number of edges around the given face: 3 for triangular faces, ...
 
MRMESH_API bool isLeftTri (EdgeId a) const
 returns true if the cell to the left of a is triangular
 
void getTriVerts (FaceId f, VertId &v0, VertId &v1, VertId &v2) const
 
MR_BIND_IGNORE void getTriVerts (FaceId f, VertId(&v)[3]) const
 
void getTriVerts (FaceId f, ThreeVertIds &v) const
 This one is not in the bindings because of the reference-to-array parameter.
 
ThreeVertIds getTriVerts (FaceId f) const
 
bool isTriVert (FaceId f, VertId v) const
 return true if triangular face (f) has (v) as one of its vertices
 
MRMESH_API std::vector< ThreeVertIds > getAllTriVerts () const
 returns three vertex ids for valid triangles, invalid triangles are skipped
 
MRMESH_API Triangulation getTriangulation () const
 
MRMESH_API void getLeftTriVerts (EdgeId a, VertId &v0, VertId &v1, VertId &v2) const
 
MR_BIND_IGNORE void getLeftTriVerts (EdgeId a, VertId(&v)[3]) const
 
void getLeftTriVerts (EdgeId a, ThreeVertIds &v) const
 This one is not in the bindings because of the reference-to-array parameter.
 
ThreeVertIds getLeftTriVerts (EdgeId a) const
 
template<typename T >
void forEachVertex (const MeshTriPoint &p, T &&callback) const
 
MRMESH_API void getLeftTriEdges (EdgeId e0, EdgeId &e1, EdgeId &e2) const
 
void getTriEdges (FaceId f, EdgeId &e0, EdgeId &e1, EdgeId &e2) const
 
MR_BIND_IGNORE void getTriEdges (FaceId f, EdgeId(&e)[3]) const
 
MRMESH_API bool isLeftQuad (EdgeId a) const
 This one is not in the bindings because of the reference-to-array parameter.
 
const Vector< EdgeId, VertId > & edgePerVertex () const
 for all valid vertices this vector contains an edge with the origin there
 
EdgeId edgeWithOrg (VertId a) const
 returns valid edge if given vertex is present in the mesh
 
bool hasVert (VertId a) const
 returns true if given vertex is present in the mesh
 
int numValidVerts () const
 returns the number of valid vertices
 
MRMESH_API VertId lastValidVert () const
 returns last valid vertex id, or invalid id if no single valid vertex exists
 
VertId addVertId ()
 creates new vert-id not associated with any edge yet
 
MRMESH_API void vertResize (size_t newSize)
 explicitly increases the size of vertices vector
 
MRMESH_API void vertResizeWithReserve (size_t newSize)
 explicitly increases the size of vertices vector, doubling the current capacity if it was not enough
 
void vertReserve (size_t newCapacity)
 sets the capacity of vertices vector
 
size_t vertSize () const
 returns the number of vertex records including invalid ones
 
size_t vertCapacity () const
 returns the number of allocated vert records
 
const VertBitSet & getValidVerts () const
 returns cached set of all valid vertices
 
void flip (VertBitSet &vs) const
 sets in (vs) all valid vertices that were not selected before the call, and resets other bits
 
const VertBitSet & getVertIds (const VertBitSet *region) const
 if region pointer is not null then converts it in reference, otherwise returns all valid vertices in the mesh
 
const Vector< EdgeId, FaceId > & edgePerFace () const
 for all valid faces this vector contains an edge with that face at left
 
EdgeId edgeWithLeft (FaceId a) const
 returns valid edge if given vertex is present in the mesh
 
bool hasFace (FaceId a) const
 returns true if given face is present in the mesh
 
MRMESH_API EdgeId sharedEdge (FaceId l, FaceId r) const
 if two valid faces share the same edge then it is found and returned
 
MRMESH_API EdgeId sharedVertInOrg (EdgeId a, EdgeId b) const
 if two valid edges share the same vertex then it is found and returned as Edge with this vertex in origin
 
MRMESH_API EdgeId sharedVertInOrg (FaceId l, FaceId r) const
 if two valid faces share the same vertex then it is found and returned as Edge with this vertex in origin
 
MRMESH_API FaceId sharedFace (EdgeId a, EdgeId b) const
 if two valid edges belong to same valid face then it is found and returned
 
int numValidFaces () const
 returns the number of valid faces
 
MRMESH_API FaceId lastValidFace () const
 returns last valid face id, or invalid id if no single valid face exists
 
FaceId addFaceId ()
 creates new face-id not associated with any edge yet
 
MRMESH_API void deleteFace (FaceId f, const UndirectedEdgeBitSet *keepEdges=nullptr)
 deletes the face, also deletes its edges and vertices if they were not shared by other faces and not in
 
MRMESH_API void deleteFaces (const FaceBitSet &fs, const UndirectedEdgeBitSet *keepEdges=nullptr)
 deletes multiple given faces by calling deleteFace for each
 
MRMESH_API void faceResize (size_t newSize)
 explicitly increases the size of faces vector
 
MRMESH_API void faceResizeWithReserve (size_t newSize)
 explicitly increases the size of faces vector, doubling the current capacity if it was not enough
 
void faceReserve (size_t newCapacity)
 sets the capacity of faces vector
 
size_t faceSize () const
 returns the number of face records including invalid ones
 
size_t faceCapacity () const
 returns the number of allocated face records
 
const FaceBitSet & getValidFaces () const
 returns cached set of all valid faces
 
void flip (FaceBitSet &fs) const
 sets in (fs) all valid faces that were not selected before the call, and resets other bits
 
const FaceBitSet & getFaceIds (const FaceBitSet *region) const
 if region pointer is not null then converts it in reference, otherwise returns all valid faces in the mesh
 
MRMESH_API EdgeId bdEdgeSameLeft (EdgeId e, const FaceBitSet *region=nullptr) const
 
bool isLeftBdFace (EdgeId e, const FaceBitSet *region=nullptr) const
 
EdgeId bdEdgeWithLeft (FaceId f, const FaceBitSet *region=nullptr) const
 
bool isBdFace (FaceId f, const FaceBitSet *region=nullptr) const
 returns true if given face belongs to the region and it has a boundary edge (isBdEdge(e,region) == true)
 
MRMESH_API FaceBitSet findBdFaces (const FaceBitSet *region=nullptr) const
 returns all faces for which isBdFace(f, region) is true
 
bool isLeftInRegion (EdgeId e, const FaceBitSet *region=nullptr) const
 return true if left face of given edge belongs to region (or just have valid id if region is nullptr)
 
bool isInnerEdge (EdgeId e, const FaceBitSet *region=nullptr) const
 return true if given edge is inner for given region (or for whole mesh if region is nullptr)
 
MRMESH_API bool isBdEdge (EdgeId e, const FaceBitSet *region=nullptr) const
 
MRMESH_API EdgeBitSet findLeftBdEdges (const FaceBitSet *region=nullptr, const EdgeBitSet *test=nullptr) const
 returns all (test) edges for which left(e) does not belong to the region and isBdEdge(e, region) is true
 
MRMESH_API EdgeId bdEdgeSameOrigin (EdgeId e, const FaceBitSet *region=nullptr) const
 
bool isBdVertexInOrg (EdgeId e, const FaceBitSet *region=nullptr) const
 returns true if edge's origin is on (region) boundary
 
EdgeId bdEdgeWithOrigin (VertId v, const FaceBitSet *region=nullptr) const
 
bool isBdVertex (VertId v, const FaceBitSet *region=nullptr) const
 returns true if given vertex is on (region) boundary
 
MRMESH_API VertBitSet findBdVerts (const FaceBitSet *region=nullptr, const VertBitSet *test=nullptr) const
 returns all (test) vertices for which isBdVertex(v, region) is true
 
MRMESH_API bool isInnerOrBdVertex (VertId v, const FaceBitSet *region=nullptr) const
 returns true if one of incident faces of given vertex pertain to given region (or any such face exists if region is nullptr)
 
bool isLeftBdEdge (EdgeId e, const FaceBitSet *region=nullptr) const
 returns true if left face of given edge belongs to given region (if provided) and right face either does not exist or does not belong
 
bool isInnerOrBdEdge (EdgeId e, const FaceBitSet *region=nullptr) const
 return true if given edge is inner or boundary for given region (or for whole mesh if region is nullptr), returns false for lone edges
 
MRMESH_API EdgeId nextLeftBd (EdgeId e, const FaceBitSet *region=nullptr) const
 given a (region) boundary edge with no right face in given region, returns next boundary edge for the same region: dest(e)==org(res)
 
MRMESH_API EdgeId prevLeftBd (EdgeId e, const FaceBitSet *region=nullptr) const
 given a (region) boundary edge with no right face in given region, returns previous boundary edge for the same region; dest(res)==org(e)
 
MRMESH_API EdgeId findEdge (VertId o, VertId d) const
 finds and returns edge from o to d in the mesh; returns invalid edge otherwise
 
MRMESH_API bool isClosed (const FaceBitSet *region=nullptr) const
 returns true if the mesh (region) does not have any neighboring holes
 
MRMESH_API std::vector< EdgeId > findHoleRepresentiveEdges (const FaceBitSet *region=nullptr) const
 
MRMESH_API int findNumHoles (EdgeBitSet *holeRepresentativeEdges=nullptr) const
 
MRMESH_API EdgeLoop getLeftRing (EdgeId e) const
 returns full edge-loop of left face from (e) starting from (e) itself
 
MRMESH_API std::vector< EdgeLoop > getLeftRings (const std::vector< EdgeId > &es) const
 
MRMESH_API MR_BIND_IGNORE EdgeBitSet findBoundaryEdges () const
 returns all boundary edges, where each edge does not have valid left face
 
MRMESH_API MR_BIND_IGNORE FaceBitSet findBoundaryFaces (const FaceBitSet *region=nullptr) const
 
MRMESH_API MR_BIND_IGNORE VertBitSet findBoundaryVerts (const VertBitSet *region=nullptr) const
 
MRMESH_API VertBitSet getPathVertices (const EdgePath &path) const
 returns all vertices incident to path edges
 
MRMESH_API FaceBitSet getPathLeftFaces (const EdgePath &path) const
 returns all valid left faces of path edges
 
MRMESH_API FaceBitSet getPathRightFaces (const EdgePath &path) const
 returns all valid right faces of path edges
 
MRMESH_API void flipEdge (EdgeId e)
 
template<typename T >
void flipEdgesIn (EdgeId e0, T &&flipNeeded)
 
template<typename T >
void flipEdgesIn (VertId v, T &&flipNeeded)
 
template<typename T >
void flipEdgesOut (EdgeId e0, T &&flipNeeded)
 
template<typename T >
void flipEdgesOut (VertId v, T &&flipNeeded)
 
MRMESH_API EdgeId splitEdge (EdgeId e, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr)
 
MRMESH_API VertId splitFace (FaceId f, FaceBitSet *region=nullptr, FaceHashMap *new2Old=nullptr)
 
MRMESH_API void flipOrientation (const UndirectedEdgeBitSet *fullComponents=nullptr)
 
MRMESH_API void addPart (const MeshTopology &from, const PartMapping &map={}, bool rearrangeTriangles=false)
 
MRMESH_API void addPart (const MeshTopology &from, FaceMap *outFmap=nullptr, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr, bool rearrangeTriangles=false)
 
MRMESH_API void addPartByMask (const MeshTopology &from, const FaceBitSet *fromFaces, const PartMapping &map={})
 the same but copies only portion of (from) specified by fromFaces,
 
MR_BIND_IGNORE void addPartByMask (const MeshTopology &from, const FaceBitSet &fromFaces, const PartMapping &map={})
 This is skipped in the bindings because it conflicts with the overload taking a pointer in C#. Since that overload is strictly more useful, we're keeping that one.
 
MRMESH_API void addPartByMask (const MeshTopology &from, const FaceBitSet *fromFaces, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={})
 
MR_BIND_IGNORE void addPartByMask (const MeshTopology &from, const FaceBitSet &fromFaces, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={})
 This is skipped in the bindings because it conflicts with the overload taking a pointer in C#. Since that overload is strictly more useful, we're keeping that one.
 
MRMESH_API void rotateTriangles ()
 for each triangle selects edgeWithLeft with minimal origin vertex
 
MRMESH_API void pack (FaceMap *outFmap=nullptr, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr, bool rearrangeTriangles=false)
 
MRMESH_API void pack (const PackMapping &map)
 
MRMESH_API void packMinMem (const PackMapping &map)
 
MRMESH_API void write (std::ostream &s) const
 saves in binary stream
 
MRMESH_API Expected< void > read (std::istream &s, ProgressCallback callback={})
 
MRMESH_API bool operator== (const MeshTopology &b) const
 compare that two topologies are exactly the same
 
MRMESH_API void resizeBeforeParallelAdd (size_t edgeSize, size_t vertSize, size_t faceSize)
 
MRMESH_API void addPackedPart (const MeshTopology &from, EdgeId toEdgeId, const FaceMap &fmap, const VertMap &vmap)
 
MRMESH_API bool computeValidsFromEdges (ProgressCallback cb={})
 
MRMESH_API void stopUpdatingValids ()
 stops updating validVerts(), validFaces(), numValidVerts(), numValidFaces() for parallel processing of mesh parts
 
bool updatingValids () const
 returns whether the methods validVerts(), validFaces(), numValidVerts(), numValidFaces() can be called
 
MRMESH_API void preferEdges (const UndirectedEdgeBitSet &stableEdges)
 
MRMESH_API bool buildGridMesh (const GridSettings &settings, ProgressCallback cb={})
 constructs triangular grid mesh topology in parallel
 
MRMESH_API bool checkValidity (ProgressCallback cb={}, bool allVerts=true) const
 

Friends

class MeshTopologyDiff
 

Detailed Description

Mesh Topology


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