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

#include <MRMesh/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)
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
EdgeId makeEdge ()
 creates an edge not associated with any vertex
EdgeId makeEdge (VertId a, VertId b, EdgeId e={})
int makeEdges (const Edges &edges)
bool isLoneEdge (EdgeId a) const
 checks whether the edge is disconnected from all other edges and disassociated from all vertices (as if after makeEdge)
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)
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
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
void deleteEdges (const UndirectedEdgeBitSet &es)
 calls deleteEdge for every set bit
size_t heapBytes () const
 returns the amount of memory this object occupies on heap
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
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
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
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
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
void vertResize (size_t newSize)
 explicitly increases the size of vertices vector
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
EdgeId findEdge (VertId o, VertId d) const
 finds and returns edge from o to d in the mesh; returns invalid edge otherwise
VertBitSet getPathVertices (const EdgePath &path) const
 returns all vertices incident to path edges
EdgeId splitEdge (EdgeId e)
EdgeId makePolyline (const VertId *vs, size_t num)
void addPart (const PolylineTopology &from, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr)
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;
void pack (VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr)
void write (std::ostream &s) const
 saves this in binary stream
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
bool isConsistentlyOriented () const
 returns true if for each edge e: e == e.next() || e.odd() == next( e ).sym().odd()
void flip ()
 changes the orientation of all edges: every edge e is replaced with e.sym()
bool checkValidity () const
 verifies that all internal data structures are valid
void computeValidsFromEdges ()
 computes numValidVerts_ and validVerts_ from edgePerVertex_
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: