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

#include <MRPolylineTopology.h>

Public Member Functions

template<typename T , typename F1 , typename F2 >
void buildFromContours (const std::vector< std::vector< T > > &contours, F1 &&reservePoints, F2 &&addPoint)
 
MRMESH_API void buildOpenLines (const std::vector< VertId > &comp2firstVert)
 
template<typename T , typename F >
std::vector< std::vector< T > > convertToContours (F &&getPoint, std::vector< std::vector< VertId > > *vertMap=nullptr) const
 converts this topology into contours of given type using the functor returning point by its Id
 
MRMESH_API EdgeId makeEdge ()
 creates an edge not associated with any vertex
 
MRMESH_API EdgeId makeEdge (VertId a, VertId b, EdgeId e={})
 
MRMESH_API int makeEdges (const Edges &edges)
 
MRMESH_API bool isLoneEdge (EdgeId a) const
 checks whether the edge is disconnected from all other edges and disassociated from all vertices (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
 
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
 
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 void deleteEdge (UndirectedEdgeId ue)
 given edge becomes lone after the call, so it is un-spliced from connected edges, and if it was not connected at origin or destination, then that vertex is deleted as well
 
MRMESH_API void deleteEdges (const UndirectedEdgeBitSet &es)
 calls deleteEdge for every set bit
 
MRMESH_API size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 
MRMESH_API void splice (EdgeId a, EdgeId b)
 
EdgeId next (EdgeId he) const
 next (counter 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
 
MRMESH_API void setOrg (EdgeId a, VertId v)
 
const Vector< EdgeId, VertId > & edgePerVertex () const
 for all valid vertices this vector contains an edge with the origin there
 
MRMESH_API Vector< VertId, EdgeId > getOrgs () const
 for all edges this vector contains its origin
 
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
 
MRMESH_API int getVertDegree (VertId a) const
 returns 0 if given vertex does not exist, 1 if it has one incident edge, and 2 if it has two incident edges
 
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
 
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
 
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 VertBitSet getPathVertices (const EdgePath &path) const
 returns all vertices incident to path edges
 
MRMESH_API EdgeId splitEdge (EdgeId e)
 
MRMESH_API EdgeId makePolyline (const VertId *vs, size_t num)
 
MRMESH_API void addPart (const PolylineTopology &from, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr)
 
MRMESH_API void addPartByMask (const PolylineTopology &from, const UndirectedEdgeBitSet &mask, VertMap *outVmap=nullptr, EdgeMap *outEmap=nullptr)
 appends polyline topology (from) in addition to the current topology: creates new edges, verts;
 
MRMESH_API void pack (VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr)
 
MRMESH_API void write (std::ostream &s) const
 saves this in binary stream
 
MRMESH_API bool read (std::istream &s)
 loads this from binary stream
 
bool operator== (const PolylineTopology &b) const
 comparison via edges (all other members are considered as not important caches)
 
bool operator!= (const PolylineTopology &b) const
 
MRMESH_API bool isConsistentlyOriented () const
 returns true if for each edge e: e == e.next() || e.odd() == next( e ).sym().odd()
 
MRMESH_API void flip ()
 changes the orientation of all edges: every edge e is replaced with e.sym()
 
MRMESH_API bool checkValidity () const
 verifies that all internal data structures are valid
 
MRMESH_API void computeValidsFromEdges ()
 computes numValidVerts_ and validVerts_ from edgePerVertex_
 
MRMESH_API bool isClosed () const
 returns true if the polyline does not have any holes
 

Detailed Description

topology of one or several polylines (how line segments are connected in lines) common for 2D and 3D polylines


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