![]() |
VCG Library
|
A class for managing curves on a 2-manifold (Curve on Manifold - CoM). More...
#include <curve_on_manifold.h>
Public Types | |
| typedef CoM< MeshType > | CoMType |
| typedef MeshType::ScalarType | ScalarType |
| typedef MeshType::CoordType | CoordType |
| typedef MeshType::VertexType | VertexType |
| typedef MeshType::VertexPointer | VertexPointer |
| typedef MeshType::VertexIterator | VertexIterator |
| typedef MeshType::EdgeIterator | EdgeIterator |
| typedef MeshType::FaceType | FaceType |
| typedef MeshType::FacePointer | FacePointer |
| typedef MeshType::FaceIterator | FaceIterator |
Static Public Member Functions | |
| static bool | TagFaceEdgeSelWithPolyLine (CoMType &com, MeshType &poly, bool markFlag=true) |
| Tag face edges of the base mesh that coincide with polyline edges. | |
| static void | SplitMeshWithPolyline (CoMType &com, MeshType &poly) |
| Make the base mesh conform to the polyline: afterwards every polyline edge is an edge of the base mesh, with its face-edge selection bit set on both sides. | |
A class for managing curves on a 2-manifold (Curve on Manifold - CoM).
Embed a curve in the surface it lies on: the operations on a CoM that change the surface.
This class is used to project, simplify, smooth, and snap polylines (represented as edge meshes) over a triangulated surface (the "base mesh").
base)poly in parameters)CoM<MeshType> com(baseMesh);Init() to build the spatial acceleration structurespar member for fine controlCoM is a query structure over a fixed surface; what only reads the surface, or changes the curve, lives there. These two change the base mesh itself, its connectivity and its face-edge selection, so they are kept apart. Both take the CoM already built over the surface, typically the one just used to smooth and refine the curve, so its spatial grid is not built twice. SplitMeshWithPolyline() re-initializes it on the split surface, so it stays valid afterwards.
See the sample trimesh_topological_cut.cpp.
|
inlinestatic |
Make the base mesh conform to the polyline: afterwards every polyline edge is an edge of the base mesh, with its face-edge selection bit set on both sides.
| com | The CoM built over the base mesh, typically the one just used to refine the polyline; it is re-initialized on the split mesh, so it stays valid |
| poly | The polyline; its vertices are moved onto the vertices created for them |
Precondition: RefineCurveByBaseMesh() has been called, so every polyline segment lies inside one face or along one edge of the base mesh.
Curves may cross and touch. The mesh realizes the union of the curves: it gets a vertex at every crossing, and curve points or segments that coincide within rounding distance share mesh vertices and edges. The polyline keeps its own topology: a segment cut at a crossing or a touching point gets a vertex of its own there, so two strands stay two strands, each passing through the shared mesh vertex. CoM::ConnectCrossings() turns those meeting points into junctions, when the caller wants them.
Any number of segments may cross the same triangle, from different curves or from the same one passing several times, as a spiral on a cylinder does. Each crossed triangle is rebuilt on its own, in its barycentric frame: the polyline points on its edges are inserted by splitting the sub-triangle that owns that piece of the edge, points inside it by splitting the sub-triangle that contains them, and every segment is then recovered as an edge by flipping the edges that cross it, after which the other edges are flipped to the constrained Delaunay triangulation (S. W. Sloan, "A fast algorithm for generating constrained Delaunay triangulations", Computers & Structures 47(3), 1993). The Delaunay step is not cosmetic: a curve point kept inside a triangle (a control point) between the two points where its straight strand crosses the triangle's edges otherwise leaves a sliver of near-zero area, which turns over once its vertices are stored in floating point. Sub-triangles keep the attributes of their triangle, and their wedge texture coordinates are the triangle's at each vertex; new vertices interpolate the attributes of the surface where they are (VertexInterpolator).
| vcg::MissingPreconditionException | if a segment does not lie in one face or along one edge, or if a segment cannot be recovered |
|
inlinestatic |
Tag face edges of the base mesh that coincide with polyline edges.
| com | The CoM built over the base mesh |
| poly | The polyline (as edge mesh) to use for tagging |
| markFlag | If true, clears all FaceEdgeS flags before tagging (default: true) |
This function marks edges in the base mesh (using FaceEdgeS flag) where they coincide with edges from the polyline. The polyline edges must be snapped to mesh vertices at both endpoints for this to work. This function requires VertexFace and FaceFace adjacency.