MeshLib
 
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 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
 
const auto & edges () const
 allows to copy edges data when necessary
 
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)
 
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
 
void getTriVerts (FaceId f, VertId(&v)[3]) const
 
void getTriVerts (FaceId f, ThreeVertIds &v) const
 
ThreeVertIds getTriVerts (FaceId f) const
 
MRMESH_API std::vector< ThreeVertIdsgetAllTriVerts () 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
 
void getLeftTriVerts (EdgeId a, VertId(&v)[3]) const
 
void getLeftTriVerts (EdgeId a, ThreeVertIds &v) const
 
ThreeVertIds getLeftTriVerts (EdgeId a) const
 
template<typename T >
void forEachVertex (const MeshTriPoint &p, T &&callback) const
 
MRMESH_API void getTriEdges (FaceId f, EdgeId &e0, EdgeId &e1, EdgeId &e2) const
 
void getTriEdges (FaceId f, EdgeId(&e)[3]) const
 
MRMESH_API bool isLeftQuad (EdgeId a) const
 returns true if the cell to the left of a is quadrangular
 
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 VertBitSetgetValidVerts () 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 VertBitSetgetVertIds (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)
 deletes the face, also deletes its edges and vertices if they were not shared with other faces
 
MRMESH_API void deleteFaces (const FaceBitSet &fs)
 deletes multiple given faces
 
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 FaceBitSetgetValidFaces () 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 FaceBitSetgetFaceIds (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 isBdVertexInLeft (EdgeId e, const FaceBitSet *region=nullptr) const
 returns true if edge's left is on (region) boundary
 
EdgeId bdEdgeWithLeft (FaceId f, const FaceBitSet *region=nullptr) const
 
bool isBdFace (FaceId f, const FaceBitSet *region=nullptr) const
 returns true if given face is on (region) boundary
 
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)
 
bool isBdEdge (EdgeId e, const FaceBitSet *region=nullptr) const
 return true if given edge is boundary for given region (or for whole mesh if region is nullptr)
 
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 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
 returns true if the mesh does not have any holes
 
MRMESH_API bool isClosed (const FaceBitSet *region) const
 returns true if the mesh region does not have any neighboring holes
 
MRMESH_API std::vector< EdgeIdfindHoleRepresentiveEdges () const
 returns one edge with no valid left face for every boundary in the mesh
 
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< EdgeLoopgetLeftRings (const std::vector< EdgeId > &es) const
 
MRMESH_API EdgeBitSet findBoundaryEdges () const
 returns all boundary edges, where each edge does not have valid left face
 
MRMESH_API FaceBitSet findBoundaryFaces () const
 returns all boundary faces, having at least one boundary edge
 
MRMESH_API VertBitSet findBoundaryVerts () const
 returns all boundary vertices, incident to at least one boundary edge
 
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, 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,
 
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={})
 
MRMESH_API void addPartByFaceMap (const MeshTopology &from, const FaceMap &fromFaces, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={})
 fromFaces contains mapping from this-topology (considering it is empty) to from-topology
 
template<typename I >
MRMESH_API void addPartBy (const MeshTopology &from, I fbegin, I fend, size_t fcount, bool flipOrientation=false, const std::vector< EdgePath > &thisContours={}, const std::vector< EdgePath > &fromContours={}, const PartMapping &map={})
 both addPartByMask and addPartByFaceMap call this general implementation
 
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 VoidOrErrStr 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={})
 
MRMESH_API bool checkValidity (ProgressCallback cb={}) const
 verifies that all internal data structures are valid
 

Friends

class MeshDiff
 

Detailed Description

Mesh Topology

Member Function Documentation

◆ addFaceId()

FaceId MR::MeshTopology::addFaceId ( )
inline

creates new face-id not associated with any edge yet

◆ addPackedPart()

MRMESH_API void MR::MeshTopology::addPackedPart ( const MeshTopology & from,
EdgeId toEdgeId,
const FaceMap & fmap,
const VertMap & vmap )

copies topology (from) into this;

Parameters
fromedges must be tightly packes without any lone edges, and they are mapped [0, from.edges.size()) -> [toEdgeId, toEdgeId + from.edges.size());
fmap,vmapmapping of vertices and faces if it is given ( from.id -> this.id )

◆ addPart()

MRMESH_API void MR::MeshTopology::addPart ( const MeshTopology & from,
FaceMap * outFmap = nullptr,
VertMap * outVmap = nullptr,
WholeEdgeMap * outEmap = nullptr,
bool rearrangeTriangles = false )

appends mesh topology (from) in addition to the current topology: creates new edges, faces, verts;

Parameters
rearrangeTrianglesif true then the order of triangles is selected according to the order of their vertices, please call rotateTriangles() first
outFmap,outVmap,outEmap(optionally) returns mappings: from.id -> this.id

◆ addPartBy()

template<typename I >
MRMESH_API void MR::MeshTopology::addPartBy ( const MeshTopology & from,
I fbegin,
I fend,
size_t fcount,
bool flipOrientation = false,
const std::vector< EdgePath > & thisContours = {},
const std::vector< EdgePath > & fromContours = {},
const PartMapping & map = {} )

both addPartByMask and addPartByFaceMap call this general implementation

◆ addPartByFaceMap()

MRMESH_API void MR::MeshTopology::addPartByFaceMap ( const MeshTopology & from,
const FaceMap & fromFaces,
bool flipOrientation = false,
const std::vector< EdgePath > & thisContours = {},
const std::vector< EdgePath > & fromContours = {},
const PartMapping & map = {} )

fromFaces contains mapping from this-topology (considering it is empty) to from-topology

◆ addPartByMask() [1/2]

MRMESH_API void MR::MeshTopology::addPartByMask ( const MeshTopology & from,
const FaceBitSet & fromFaces,
bool flipOrientation = false,
const std::vector< EdgePath > & thisContours = {},
const std::vector< EdgePath > & fromContours = {},
const PartMapping & map = {} )

this version has more parameters

Parameters
flipOrientationif true then every from triangle is inverted before adding
thisContourscontours on this mesh (no left face) that have to be stitched with
fromContourscontours on from mesh during addition (no left face if flipOrientation otherwise no right face)

◆ addPartByMask() [2/2]

MRMESH_API void MR::MeshTopology::addPartByMask ( const MeshTopology & from,
const FaceBitSet & fromFaces,
const PartMapping & map )

the same but copies only portion of (from) specified by fromFaces,

◆ addVertId()

VertId MR::MeshTopology::addVertId ( )
inline

creates new vert-id not associated with any edge yet

◆ bdEdgeSameLeft()

MRMESH_API EdgeId MR::MeshTopology::bdEdgeSameLeft ( EdgeId e,
const FaceBitSet * region = nullptr ) const

returns the first boundary edge (for given region or for whole mesh if region is nullptr) in counter-clockwise order starting from given edge with the same left; returns invalid edge if no boundary edge is found

◆ bdEdgeSameOrigin()

MRMESH_API EdgeId MR::MeshTopology::bdEdgeSameOrigin ( EdgeId e,
const FaceBitSet * region = nullptr ) const

returns the first boundary edge (for given region or for whole mesh if region is nullptr) in counter-clockwise order starting from given edge with the same origin; returns invalid edge if no boundary edge is found

◆ bdEdgeWithLeft()

EdgeId MR::MeshTopology::bdEdgeWithLeft ( FaceId f,
const FaceBitSet * region = nullptr ) const
inline

returns a boundary edge with given left face considering boundary of given region (or for whole mesh if region is nullptr); returns invalid edge if no boundary edge is found

◆ bdEdgeWithOrigin()

EdgeId MR::MeshTopology::bdEdgeWithOrigin ( VertId v,
const FaceBitSet * region = nullptr ) const
inline

returns a boundary edge with given vertex in origin considering boundary of given region (or for whole mesh if region is nullptr); returns invalid edge if no boundary edge is found

◆ buildGridMesh()

MRMESH_API bool MR::MeshTopology::buildGridMesh ( const GridSettings & settings,
ProgressCallback cb = {} )

◆ checkValidity()

MRMESH_API bool MR::MeshTopology::checkValidity ( ProgressCallback cb = {}) const

verifies that all internal data structures are valid

◆ computeNotLoneUndirectedEdges()

MRMESH_API size_t MR::MeshTopology::computeNotLoneUndirectedEdges ( ) const

computes the number of not-lone (valid) undirected edges

◆ computeValidsFromEdges()

MRMESH_API bool MR::MeshTopology::computeValidsFromEdges ( ProgressCallback cb = {})

compute 1) numValidVerts_ and validVerts_ from edgePerVertex_ 2) numValidFaces_ and validFaces_ from edgePerFace_ and activates their auto-update

◆ deleteFace()

MRMESH_API void MR::MeshTopology::deleteFace ( FaceId f)

deletes the face, also deletes its edges and vertices if they were not shared with other faces

◆ deleteFaces()

MRMESH_API void MR::MeshTopology::deleteFaces ( const FaceBitSet & fs)

deletes multiple given faces

◆ dest()

VertId MR::MeshTopology::dest ( EdgeId he) const
inline

returns destination vertex of half-edge

◆ edgeCapacity()

size_t MR::MeshTopology::edgeCapacity ( ) const
inline

returns the number of allocated edge records

◆ edgePerFace()

const Vector< EdgeId, FaceId > & MR::MeshTopology::edgePerFace ( ) const
inline

for all valid faces this vector contains an edge with that face at left

◆ edgePerVertex()

const Vector< EdgeId, VertId > & MR::MeshTopology::edgePerVertex ( ) const
inline

for all valid vertices this vector contains an edge with the origin there

◆ edgeReserve()

void MR::MeshTopology::edgeReserve ( size_t newCapacity)
inline

sets the capacity of half-edges vector

◆ edges()

const auto & MR::MeshTopology::edges ( ) const
inline

allows to copy edges data when necessary

◆ edgeSize()

size_t MR::MeshTopology::edgeSize ( ) const
inline

returns the number of half-edge records including lone ones

◆ edgeWithLeft()

EdgeId MR::MeshTopology::edgeWithLeft ( FaceId a) const
inline

returns valid edge if given vertex is present in the mesh

◆ edgeWithOrg()

EdgeId MR::MeshTopology::edgeWithOrg ( VertId a) const
inline

returns valid edge if given vertex is present in the mesh

◆ excludeLoneEdges()

MRMESH_API void MR::MeshTopology::excludeLoneEdges ( UndirectedEdgeBitSet & edges) const

remove all lone edges from given set

◆ faceCapacity()

size_t MR::MeshTopology::faceCapacity ( ) const
inline

returns the number of allocated face records

◆ faceReserve()

void MR::MeshTopology::faceReserve ( size_t newCapacity)
inline

sets the capacity of faces vector

◆ faceResize()

MRMESH_API void MR::MeshTopology::faceResize ( size_t newSize)

explicitly increases the size of faces vector

◆ faceResizeWithReserve()

MRMESH_API void MR::MeshTopology::faceResizeWithReserve ( size_t newSize)

explicitly increases the size of faces vector, doubling the current capacity if it was not enough

◆ faceSize()

size_t MR::MeshTopology::faceSize ( ) const
inline

returns the number of face records including invalid ones

◆ findBoundaryEdges()

MRMESH_API EdgeBitSet MR::MeshTopology::findBoundaryEdges ( ) const

returns all boundary edges, where each edge does not have valid left face

◆ findBoundaryFaces()

MRMESH_API FaceBitSet MR::MeshTopology::findBoundaryFaces ( ) const

returns all boundary faces, having at least one boundary edge

◆ findBoundaryVerts()

MRMESH_API VertBitSet MR::MeshTopology::findBoundaryVerts ( ) const

returns all boundary vertices, incident to at least one boundary edge

◆ findEdge()

MRMESH_API EdgeId MR::MeshTopology::findEdge ( VertId o,
VertId d ) const

finds and returns edge from o to d in the mesh; returns invalid edge otherwise

◆ findHoleRepresentiveEdges()

MRMESH_API std::vector< EdgeId > MR::MeshTopology::findHoleRepresentiveEdges ( ) const

returns one edge with no valid left face for every boundary in the mesh

◆ findNotLoneUndirectedEdges()

MRMESH_API UndirectedEdgeBitSet MR::MeshTopology::findNotLoneUndirectedEdges ( ) const

finds and returns all not-lone (valid) undirected edges

◆ findNumHoles()

MRMESH_API int MR::MeshTopology::findNumHoles ( EdgeBitSet * holeRepresentativeEdges = nullptr) const

returns the number of hole loops in the mesh;

Parameters
holeRepresentativeEdgesoptional output of the smallest edge id with no valid left face in every hole

◆ flip() [1/2]

void MR::MeshTopology::flip ( FaceBitSet & fs) const
inline

sets in (fs) all valid faces that were not selected before the call, and resets other bits

◆ flip() [2/2]

void MR::MeshTopology::flip ( VertBitSet & vs) const
inline

sets in (vs) all valid vertices that were not selected before the call, and resets other bits

◆ flipEdge()

MRMESH_API void MR::MeshTopology::flipEdge ( EdgeId e)

given the edge with left and right triangular faces, which form together a quadrangle, rotates the edge counter-clockwise inside the quadrangle

◆ flipEdgesIn() [1/2]

template<typename T >
void MR::MeshTopology::flipEdgesIn ( EdgeId e0,
T && flipNeeded )

tests all edges e having valid left and right faces and org(e0) == dest(next(e)); if the test has passed, then flips the edge so increasing the degree of org(e0)

◆ flipEdgesIn() [2/2]

template<typename T >
void MR::MeshTopology::flipEdgesIn ( VertId v,
T && flipNeeded )
inline

tests all edges e having valid left and right faces and v == dest(next(e)); if the test has passed, then flips the edge so increasing the degree of vertex v

◆ flipEdgesOut() [1/2]

template<typename T >
void MR::MeshTopology::flipEdgesOut ( EdgeId e0,
T && flipNeeded )

tests all edges e having valid left and right faces and org(e0) == org(e); if the test has passed, then flips the edge so decreasing the degree of org(e0)

◆ flipEdgesOut() [2/2]

template<typename T >
void MR::MeshTopology::flipEdgesOut ( VertId v,
T && flipNeeded )
inline

tests all edges e having valid left and right faces and v == org(e); if the test has passed, then flips the edge so decreasing the degree of vertex v

◆ flipOrientation()

MRMESH_API void MR::MeshTopology::flipOrientation ( const UndirectedEdgeBitSet * fullComponents = nullptr)

flip orientation (normals) of

  • all mesh elements if
    Parameters
    fullComponentsis nullptr, or
  • given mesh components in
    Parameters
    fullComponents.The behavior is undefined if fullComponents is given but there are connected components with some edges included and not-included there.

◆ forEachVertex()

template<typename T >
void MR::MeshTopology::forEachVertex ( const MeshTriPoint & p,
T && callback ) const

if given point is 1) in vertex, then invokes callback once with it; 2) on edge, then invokes callback twice with every vertex of the edge; 3) inside triangle, then invokes callback trice with every vertex of the triangle

◆ fromSameLeftRing()

MRMESH_API bool MR::MeshTopology::fromSameLeftRing ( EdgeId a,
EdgeId b ) const

returns true if a and b are both from the same left face ring

◆ fromSameOriginRing()

MRMESH_API bool MR::MeshTopology::fromSameOriginRing ( EdgeId a,
EdgeId b ) const

returns true if a and b are both from the same origin ring

◆ getAllTriVerts()

MRMESH_API std::vector< ThreeVertIds > MR::MeshTopology::getAllTriVerts ( ) const

returns three vertex ids for valid triangles, invalid triangles are skipped

◆ getFaceDegree()

int MR::MeshTopology::getFaceDegree ( FaceId f) const
inline

returns the number of edges around the given face: 3 for triangular faces, ...

◆ getFaceIds()

const FaceBitSet & MR::MeshTopology::getFaceIds ( const FaceBitSet * region) const
inline

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

◆ getLeftDegree()

MRMESH_API int MR::MeshTopology::getLeftDegree ( EdgeId a) const

returns the number of edges around the left face: 3 for triangular faces, ...

◆ getLeftRing()

MRMESH_API EdgeLoop MR::MeshTopology::getLeftRing ( EdgeId e) const

returns full edge-loop of left face from (e) starting from (e) itself

◆ getLeftRings()

MRMESH_API std::vector< EdgeLoop > MR::MeshTopology::getLeftRings ( const std::vector< EdgeId > & es) const

returns full edge-loops of left faces from every edge in (es); each edge-loop will be returned only once even if some faces are represented by more than one edge in (es)

◆ getLeftTriVerts() [1/4]

ThreeVertIds MR::MeshTopology::getLeftTriVerts ( EdgeId a) const
inline

◆ getLeftTriVerts() [2/4]

void MR::MeshTopology::getLeftTriVerts ( EdgeId a,
ThreeVertIds & v ) const
inline

◆ getLeftTriVerts() [3/4]

MRMESH_API void MR::MeshTopology::getLeftTriVerts ( EdgeId a,
VertId & v0,
VertId & v1,
VertId & v2 ) const

gets 3 vertices of the left face ( face-id may not exist, but the shape must be triangular) the vertices are returned in counter-clockwise order if look from mesh outside

◆ getLeftTriVerts() [4/4]

void MR::MeshTopology::getLeftTriVerts ( EdgeId a,
VertId(&) v[3] ) const
inline

◆ getOrgDegree()

MRMESH_API int MR::MeshTopology::getOrgDegree ( EdgeId a) const

returns the number of edges around the origin vertex, returns 1 for lone edges

◆ getPathLeftFaces()

MRMESH_API FaceBitSet MR::MeshTopology::getPathLeftFaces ( const EdgePath & path) const

returns all valid left faces of path edges

◆ getPathRightFaces()

MRMESH_API FaceBitSet MR::MeshTopology::getPathRightFaces ( const EdgePath & path) const

returns all valid right faces of path edges

◆ getPathVertices()

MRMESH_API VertBitSet MR::MeshTopology::getPathVertices ( const EdgePath & path) const

returns all vertices incident to path edges

◆ getTriangulation()

MRMESH_API Triangulation MR::MeshTopology::getTriangulation ( ) const

returns three vertex ids for valid triangles (which can be accessed by FaceId), vertex ids for invalid triangles are undefined, and shall not be read

◆ getTriEdges() [1/2]

MRMESH_API void MR::MeshTopology::getTriEdges ( FaceId f,
EdgeId & e0,
EdgeId & e1,
EdgeId & e2 ) const

gets 3 edges of given triangular face, oriented to have it on the left; the edges are returned in counter-clockwise order if look from mesh outside

◆ getTriEdges() [2/2]

void MR::MeshTopology::getTriEdges ( FaceId f,
EdgeId(&) e[3] ) const
inline

◆ getTriVerts() [1/4]

ThreeVertIds MR::MeshTopology::getTriVerts ( FaceId f) const
inline

◆ getTriVerts() [2/4]

void MR::MeshTopology::getTriVerts ( FaceId f,
ThreeVertIds & v ) const
inline

◆ getTriVerts() [3/4]

void MR::MeshTopology::getTriVerts ( FaceId f,
VertId & v0,
VertId & v1,
VertId & v2 ) const
inline

gets 3 vertices of given triangular face; the vertices are returned in counter-clockwise order if look from mesh outside

◆ getTriVerts() [4/4]

void MR::MeshTopology::getTriVerts ( FaceId f,
VertId(&) v[3] ) const
inline

◆ getValidFaces()

const FaceBitSet & MR::MeshTopology::getValidFaces ( ) const
inline

returns cached set of all valid faces

◆ getValidVerts()

const VertBitSet & MR::MeshTopology::getValidVerts ( ) const
inline

returns cached set of all valid vertices

◆ getVertDegree()

int MR::MeshTopology::getVertDegree ( VertId v) const
inline

returns the number of edges around the given vertex

◆ getVertIds()

const VertBitSet & MR::MeshTopology::getVertIds ( const VertBitSet * region) const
inline

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

◆ hasEdge()

bool MR::MeshTopology::hasEdge ( EdgeId e) const
inline

returns true if given edge is within valid range and not-lone

◆ hasFace()

bool MR::MeshTopology::hasFace ( FaceId a) const
inline

returns true if given face is present in the mesh

◆ hasVert()

bool MR::MeshTopology::hasVert ( VertId a) const
inline

returns true if given vertex is present in the mesh

◆ heapBytes()

MRMESH_API size_t MR::MeshTopology::heapBytes ( ) const

returns the amount of memory this object occupies on heap

◆ isBdEdge()

bool MR::MeshTopology::isBdEdge ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

return true if given edge is boundary for given region (or for whole mesh if region is nullptr)

◆ isBdFace()

bool MR::MeshTopology::isBdFace ( FaceId f,
const FaceBitSet * region = nullptr ) const
inline

returns true if given face is on (region) boundary

◆ isBdVertex()

bool MR::MeshTopology::isBdVertex ( VertId v,
const FaceBitSet * region = nullptr ) const
inline

returns true if given vertex is on (region) boundary

◆ isBdVertexInLeft()

bool MR::MeshTopology::isBdVertexInLeft ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

returns true if edge's left is on (region) boundary

◆ isBdVertexInOrg()

bool MR::MeshTopology::isBdVertexInOrg ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

returns true if edge's origin is on (region) boundary

◆ isClosed() [1/2]

MRMESH_API bool MR::MeshTopology::isClosed ( ) const

returns true if the mesh does not have any holes

◆ isClosed() [2/2]

MRMESH_API bool MR::MeshTopology::isClosed ( const FaceBitSet * region) const

returns true if the mesh region does not have any neighboring holes

◆ isInnerEdge()

bool MR::MeshTopology::isInnerEdge ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

return true if given edge is inner for given region (or for whole mesh if region is nullptr)

◆ isInnerOrBdEdge()

bool MR::MeshTopology::isInnerOrBdEdge ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

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

◆ isInnerOrBdVertex()

MRMESH_API bool MR::MeshTopology::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)

◆ isLeftBdEdge()

bool MR::MeshTopology::isLeftBdEdge ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

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

◆ isLeftInRegion()

bool MR::MeshTopology::isLeftInRegion ( EdgeId e,
const FaceBitSet * region = nullptr ) const
inline

return true if left face of given edge belongs to region (or just have valid id if region is nullptr)

◆ isLeftQuad()

MRMESH_API bool MR::MeshTopology::isLeftQuad ( EdgeId a) const

returns true if the cell to the left of a is quadrangular

◆ isLeftTri()

MRMESH_API bool MR::MeshTopology::isLeftTri ( EdgeId a) const

returns true if the cell to the left of a is triangular

◆ isLoneEdge()

MRMESH_API bool MR::MeshTopology::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)

◆ lastNotLoneEdge()

MRMESH_API EdgeId MR::MeshTopology::lastNotLoneEdge ( ) const

returns last not lone edge id, or invalid id if no such edge exists

◆ lastValidFace()

MRMESH_API FaceId MR::MeshTopology::lastValidFace ( ) const

returns last valid face id, or invalid id if no single valid face exists

◆ lastValidVert()

MRMESH_API VertId MR::MeshTopology::lastValidVert ( ) const

returns last valid vertex id, or invalid id if no single valid vertex exists

◆ left()

FaceId MR::MeshTopology::left ( EdgeId he) const
inline

returns left face of half-edge

◆ makeEdge()

MRMESH_API EdgeId MR::MeshTopology::makeEdge ( )

creates an edge not associated with any vertex or face

◆ next()

EdgeId MR::MeshTopology::next ( EdgeId he) const
inline

next (counter clock wise) half-edge in the origin ring

◆ nextLeftBd()

MRMESH_API EdgeId MR::MeshTopology::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)

◆ numValidFaces()

int MR::MeshTopology::numValidFaces ( ) const
inline

returns the number of valid faces

◆ numValidVerts()

int MR::MeshTopology::numValidVerts ( ) const
inline

returns the number of valid vertices

◆ operator==()

MRMESH_API bool MR::MeshTopology::operator== ( const MeshTopology & b) const

compare that two topologies are exactly the same

◆ org()

VertId MR::MeshTopology::org ( EdgeId he) const
inline

returns origin vertex of half-edge

◆ pack() [1/2]

MRMESH_API void MR::MeshTopology::pack ( const PackMapping & map)

tightly packs all arrays eliminating lone edges and invalid faces and vertices; reorder all faces, vertices and edges according to given maps, each containing old id -> new id mapping

◆ pack() [2/2]

MRMESH_API void MR::MeshTopology::pack ( FaceMap * outFmap = nullptr,
VertMap * outVmap = nullptr,
WholeEdgeMap * outEmap = nullptr,
bool rearrangeTriangles = false )

tightly packs all arrays eliminating lone edges and invalid faces and vertices

Parameters
outFmap,outVmap,outEmapif given returns mappings: old.id -> new.id;
rearrangeTrianglesif true then calls rotateTriangles() and selects the order of triangles according to the order of their vertices

◆ packMinMem()

MRMESH_API void MR::MeshTopology::packMinMem ( const PackMapping & map)

tightly packs all arrays eliminating lone edges and invalid faces and vertices; reorder all faces, vertices and edges according to given maps, each containing old id -> new id mapping; unlike pack method, this method allocates minimal amount of memory for its operation but works much slower

◆ preferEdges()

MRMESH_API void MR::MeshTopology::preferEdges ( const UndirectedEdgeBitSet & stableEdges)

for incident vertices and faces of given edges, remember one of them as edgeWithOrg and edgeWithLeft; this is important in parallel algorithms where other edges may change but stable ones will survive

◆ prev()

EdgeId MR::MeshTopology::prev ( EdgeId he) const
inline

previous (clock wise) half-edge in the origin ring

◆ prevLeftBd()

MRMESH_API EdgeId MR::MeshTopology::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)

◆ read()

MRMESH_API VoidOrErrStr MR::MeshTopology::read ( std::istream & s,
ProgressCallback callback = {} )

loads from binary stream

Returns
text of error if any

◆ resizeBeforeParallelAdd()

MRMESH_API void MR::MeshTopology::resizeBeforeParallelAdd ( size_t edgeSize,
size_t vertSize,
size_t faceSize )

These function are for parallel mesh creation from different threads. If you are not sure, do not use them.

resizes all internal vectors and sets the numbers of valid elements in preparation for addPackedPart; edges are resized without initialization (so the user must initialize them using addPackedPart)

◆ right()

FaceId MR::MeshTopology::right ( EdgeId he) const
inline

returns right face of half-edge

◆ rotateTriangles()

MRMESH_API void MR::MeshTopology::rotateTriangles ( )

for each triangle selects edgeWithLeft with minimal origin vertex

◆ setLeft()

MRMESH_API void MR::MeshTopology::setLeft ( EdgeId a,
FaceId f )

sets new left face to the full left ring including this edge; edgePerFace_ table is updated accordingly

◆ setOrg()

MRMESH_API void MR::MeshTopology::setOrg ( EdgeId a,
VertId v )

sets new origin to the full origin ring including this edge; edgePerVertex_ table is updated accordingly

◆ sharedEdge()

MRMESH_API EdgeId MR::MeshTopology::sharedEdge ( FaceId l,
FaceId r ) const

if two valid faces share the same edge then it is found and returned

◆ sharedFace()

MRMESH_API FaceId MR::MeshTopology::sharedFace ( EdgeId a,
EdgeId b ) const

if two valid edges belong to same valid face then it is found and returned

◆ sharedVertInOrg() [1/2]

MRMESH_API EdgeId MR::MeshTopology::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

◆ sharedVertInOrg() [2/2]

MRMESH_API EdgeId MR::MeshTopology::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

◆ shrinkToFit()

MRMESH_API void MR::MeshTopology::shrinkToFit ( )

requests the removal of unused capacity

◆ splice()

MRMESH_API void MR::MeshTopology::splice ( EdgeId a,
EdgeId b )

given two half edges do either of two: 1) if a and b were from distinct rings, puts them in one ring; 2) if a and b were from the same ring, puts them in separate rings; the cut in rings in both cases is made after a and b

◆ splitEdge()

MRMESH_API EdgeId MR::MeshTopology::splitEdge ( EdgeId e,
FaceBitSet * region = nullptr,
FaceHashMap * new2Old = nullptr )

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)

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

Parameters
new2Oldreceive mapping from newly appeared triangle to its original triangle (part to full)

◆ splitFace()

MRMESH_API VertId MR::MeshTopology::splitFace ( FaceId f,
FaceBitSet * region = nullptr,
FaceHashMap * new2Old = nullptr )

split given triangle on three triangles, introducing new vertex (which is returned) inside original triangle and connecting it to its vertices

if region is given, then it must include (f) and new faces will be added there as well

Parameters
new2Oldreceive mapping from newly appeared triangle to its original triangle (part to full)

◆ stopUpdatingValids()

MRMESH_API void MR::MeshTopology::stopUpdatingValids ( )

stops updating validVerts(), validFaces(), numValidVerts(), numValidFaces() for parallel processing of mesh parts

◆ undirectedEdgeCapacity()

size_t MR::MeshTopology::undirectedEdgeCapacity ( ) const
inline

returns the number of allocated undirected edges (pairs of half-edges)

◆ undirectedEdgeSize()

size_t MR::MeshTopology::undirectedEdgeSize ( ) const
inline

returns the number of undirected edges (pairs of half-edges) including lone ones

◆ updatingValids()

bool MR::MeshTopology::updatingValids ( ) const
inline

returns whether the methods validVerts(), validFaces(), numValidVerts(), numValidFaces() can be called

◆ vertCapacity()

size_t MR::MeshTopology::vertCapacity ( ) const
inline

returns the number of allocated vert records

◆ vertReserve()

void MR::MeshTopology::vertReserve ( size_t newCapacity)
inline

sets the capacity of vertices vector

◆ vertResize()

MRMESH_API void MR::MeshTopology::vertResize ( size_t newSize)

explicitly increases the size of vertices vector

◆ vertResizeWithReserve()

MRMESH_API void MR::MeshTopology::vertResizeWithReserve ( size_t newSize)

explicitly increases the size of vertices vector, doubling the current capacity if it was not enough

◆ vertSize()

size_t MR::MeshTopology::vertSize ( ) const
inline

returns the number of vertex records including invalid ones

◆ write()

MRMESH_API void MR::MeshTopology::write ( std::ostream & s) const

saves in binary stream

Friends And Related Symbol Documentation

◆ MeshDiff

friend class MeshDiff
friend

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