#include <MRPolyline.h>
Public Member Functions | |
Polyline ()=default | |
MRMESH_API | Polyline (const Contours2f &contours) |
creates polyline from 2D contours, 3D polyline will get zero z-component | |
MRMESH_API | Polyline (const Contours3f &contours) |
creates polyline from 3D contours, 2D polyline will lose z-component | |
MRMESH_API | Polyline (const std::vector< VertId > &comp2firstVert, Vector< V, VertId > ps) |
MRMESH_API EdgeId | addFromPoints (const V *vs, size_t num, bool closed) |
MRMESH_API EdgeId | addFromPoints (const V *vs, size_t num) |
MRMESH_API void | addPart (const Polyline< V > &from, VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr) |
MRMESH_API void | addPartByMask (const Polyline< V > &from, const UndirectedEdgeBitSet &mask, VertMap *outVmap=nullptr, EdgeMap *outEmap=nullptr) |
appends polyline (from) in addition to this polyline: creates new edges, verts and points | |
MRMESH_API void | pack (VertMap *outVmap=nullptr, WholeEdgeMap *outEmap=nullptr) |
V | orgPnt (EdgeId e) const |
returns coordinates of the edge origin | |
V | destPnt (EdgeId e) const |
returns coordinates of the edge destination | |
V | edgePoint (EdgeId e, float f) const |
returns a point on the edge: origin point for f=0 and destination point for f=1 | |
V | edgePoint (const EdgePoint &ep) const |
computes coordinates of point given as edge and relative position on it | |
V | edgeCenter (EdgeId e) const |
returns edge's centroid | |
V | edgeVector (EdgeId e) const |
returns vector equal to edge destination point minus edge origin point | |
LineSegm< V > | edgeSegment (EdgeId e) const |
returns line segment of given edge | |
EdgePoint | toEdgePoint (VertId v) const |
converts vertex into edge-point representation | |
MRMESH_API EdgePoint | toEdgePoint (EdgeId e, const V &p) const |
converts edge and point's coordinates into edge-point representation | |
float | edgeLength (EdgeId e) const |
returns Euclidean length of the edge | |
float | edgeLengthSq (EdgeId e) const |
returns squared Euclidean length of the edge (faster to compute than length) | |
MRMESH_API Vector3f | loopDirArea (EdgeId e) const |
MRMESH_API float | totalLength () const |
returns total length of the polyline | |
MRMESH_API const AABBTreePolyline< V > & | getAABBTree () const |
returns cached aabb-tree for this polyline, creating it if it did not exist in a thread-safe manner | |
const AABBTreePolyline< V > * | getAABBTreeNotCreate () const |
returns cached aabb-tree for this polyline, but does not create it if it did not exist | |
MRMESH_API Box< V > | getBoundingBox () const |
returns the minimal bounding box containing all valid vertices (implemented via getAABBTree()) | |
MRMESH_API Box< V > | computeBoundingBox (const AffineXf< V > *toWorld=nullptr) const |
MRMESH_API V | findCenterFromPoints () const |
MRMESH_API void | transform (const AffineXf< V > &xf) |
applies given transformation to all valid polyline vertices | |
MRMESH_API EdgeId | splitEdge (EdgeId e, const V &newVertPos) |
EdgeId | splitEdge (EdgeId e) |
void | invalidateCaches () |
Invalidates caches (e.g. aabb-tree) after a change in polyline. | |
MRMESH_API Contours< V > | contours (std::vector< std::vector< VertId > > *vertMap=nullptr) const |
MRMESH_API Contours2f | contours2 (std::vector< std::vector< VertId > > *vertMap=nullptr) const |
template<typename U > | |
Polyline< U > | toPolyline () const |
convert Polyline3 to Polyline2 or vice versa | |
MRMESH_API EdgeId | addFromEdgePath (const Mesh &mesh, const EdgePath &path) |
EdgeId | addFromSurfacePath (const Mesh &mesh, const SurfacePath &path) |
MRMESH_API EdgeId | addFromGeneralSurfacePath (const Mesh &mesh, const MeshTriPoint &start, const SurfacePath &path, const MeshTriPoint &end) |
MRMESH_API size_t | heapBytes () const |
returns the amount of memory this object occupies on heap | |
template<class Q = V> | |
std::enable_if_t< std::is_same_v< Q, Vector3f > > | mirror (const Plane3f &plane) |
reflects the polyline from a given plane. Enabled only for Polyline3f | |
Public Attributes | |
PolylineTopology | topology |
Vector< V, VertId > | points |
polyline that stores points of type V
|
default |
MRMESH_API MR::Polyline< V >::Polyline | ( | const Contours2f & | contours | ) |
creates polyline from 2D contours, 3D polyline will get zero z-component
MRMESH_API MR::Polyline< V >::Polyline | ( | const Contours3f & | contours | ) |
creates polyline from 3D contours, 2D polyline will lose z-component
MRMESH_API MR::Polyline< V >::Polyline | ( | const std::vector< VertId > & | comp2firstVert, |
Vector< V, VertId > | ps ) |
creates comp2firstVert.size()-1 not-closed polylines each pair (a,b) of indices in
comp2firstVert | defines vertex range of a polyline [a,b) |
ps | point coordinates |
MRMESH_API EdgeId MR::Polyline< V >::addFromEdgePath | ( | const Mesh & | mesh, |
const EdgePath & | path ) |
adds path to this polyline
MRMESH_API EdgeId MR::Polyline< V >::addFromGeneralSurfacePath | ( | const Mesh & | mesh, |
const MeshTriPoint & | start, | ||
const SurfacePath & | path, | ||
const MeshTriPoint & | end ) |
adds general path = start-path-end (where both start and end are optional) to this polyline
MRMESH_API EdgeId MR::Polyline< V >::addFromPoints | ( | const V * | vs, |
size_t | num ) |
adds connected line in this, passing progressively via points *[vs, vs+num)
if vs[0] == vs[num-1] then a closed line is created
MRMESH_API EdgeId MR::Polyline< V >::addFromPoints | ( | const V * | vs, |
size_t | num, | ||
bool | closed ) |
adds connected line in this, passing progressively via points *[vs, vs+num)
if closed argument is true then the last and the first points will be additionally connected
|
inline |
adds path to this polyline
MRMESH_API void MR::Polyline< V >::addPart | ( | const Polyline< V > & | from, |
VertMap * | outVmap = nullptr, | ||
WholeEdgeMap * | outEmap = nullptr ) |
appends polyline (from) in addition to this polyline: creates new edges, verts and points;
outVmap,outEmap | (optionally) returns mappings: from.id -> this.id |
MRMESH_API void MR::Polyline< V >::addPartByMask | ( | const Polyline< V > & | from, |
const UndirectedEdgeBitSet & | mask, | ||
VertMap * | outVmap = nullptr, | ||
EdgeMap * | outEmap = nullptr ) |
appends polyline (from) in addition to this polyline: creates new edges, verts and points
|
nodiscard |
passes through all valid points and finds the minimal bounding box containing all of them
if toWorld transformation is given then returns minimal bounding box in world space
|
nodiscard |
convert Polyline to simple contour structures with vector of points inside
if all even edges are consistently oriented, then the output contours will be oriented the same
vertMap | optional output map for for each contour point to corresponding VertId |
|
nodiscard |
convert Polyline to simple 2D contour structures with vector of points inside
if all even edges are consistently oriented, then the output contours will be oriented the same
vertMap | optional output map for for each contour point to corresponding VertId |
|
inlinenodiscard |
returns coordinates of the edge destination
|
inlinenodiscard |
returns edge's centroid
|
inlinenodiscard |
returns Euclidean length of the edge
|
inlinenodiscard |
returns squared Euclidean length of the edge (faster to compute than length)
|
inlinenodiscard |
computes coordinates of point given as edge and relative position on it
|
inlinenodiscard |
returns a point on the edge: origin point for f=0 and destination point for f=1
|
inlinenodiscard |
returns line segment of given edge
|
inlinenodiscard |
returns vector equal to edge destination point minus edge origin point
|
nodiscard |
MRMESH_API const AABBTreePolyline< V > & MR::Polyline< V >::getAABBTree | ( | ) | const |
returns cached aabb-tree for this polyline, creating it if it did not exist in a thread-safe manner
|
inlinenodiscard |
returns cached aabb-tree for this polyline, but does not create it if it did not exist
|
nodiscard |
returns the minimal bounding box containing all valid vertices (implemented via getAABBTree())
|
nodiscard |
returns the amount of memory this object occupies on heap
|
inline |
Invalidates caches (e.g. aabb-tree) after a change in polyline.
|
nodiscard |
calculates directed loop area if iterating in e
direction .z = FLT_MAX if e
does not represent a loop
|
inlinenodiscard |
reflects the polyline from a given plane. Enabled only for Polyline3f
|
inlinenodiscard |
returns coordinates of the edge origin
MRMESH_API void MR::Polyline< V >::pack | ( | VertMap * | outVmap = nullptr, |
WholeEdgeMap * | outEmap = nullptr ) |
tightly packs all arrays eliminating lone edges and invalid verts and points, optionally returns mappings: old.id -> new.id
|
inline |
MRMESH_API EdgeId MR::Polyline< V >::splitEdge | ( | EdgeId | e, |
const V & | newVertPos ) |
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)
|
nodiscard |
converts edge and point's coordinates into edge-point representation
|
inlinenodiscard |
converts vertex into edge-point representation
|
nodiscard |
convert Polyline3 to Polyline2 or vice versa
|
nodiscard |
returns total length of the polyline
MRMESH_API void MR::Polyline< V >::transform | ( | const AffineXf< V > & | xf | ) |
applies given transformation to all valid polyline vertices
Vector<V, VertId> MR::Polyline< V >::points |
PolylineTopology MR::Polyline< V >::topology |