![]() |
VCG Library
|
Classes | |
| struct | LaplacianFunctor |
| LaplacianFunctor basic Laplacian smoothing functor. More... | |
| class | Param |
| Parameter class controlling the behavior of CoM algorithms. More... | |
| struct | QualityDistanceFieldFunctor |
| QualityDistanceFieldFunctor quality field based smoothing functor. More... | |
Public Types | |
| enum | ControlPoints { AllVertices , EndsAndNodes , Selected } |
| Which polyline vertices SetControlPoints() makes control points. More... | |
| 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::EdgeType | EdgeType |
| typedef MeshType::FaceType | FaceType |
| typedef MeshType::FacePointer | FacePointer |
| typedef MeshType::FaceIterator | FaceIterator |
| typedef Segment3< ScalarType > | Segment3Type |
| typedef vcg::GridStaticPtr< FaceType, ScalarType > | MeshGrid |
| typedef std::vector< std::pair< FaceType *, CoordType > > | Location |
Public Member Functions | |
| CoM (MeshType &_m) | |
| FaceType * | GetClosestFace (const CoordType &p) |
| Get the closest face to a query point. | |
| FaceType * | GetClosestFaceIP (const CoordType &p, CoordType &ip) |
| Get the closest face and its barycentric coordinates. | |
| FaceType * | GetClosestFaceIP (const CoordType &p, CoordType &ip, CoordType &in) |
| Get the closest face, barycentric coordinates, and normal. | |
| FaceType * | GetClosestFacePoint (const CoordType &p, CoordType &closestP) |
| Get the closest face and the closest point on it. | |
| bool | IsSnappedEdge (CoordType &ip, int &ei) |
| Check if a barycentric coordinate is snapped to an edge. | |
| bool | IsSnappedVertex (CoordType &ip, int &vi) |
| Check if a barycentric coordinate is snapped to a vertex. | |
| VertexPointer | FindVertexSnap (FacePointer fp, CoordType &ip) |
| Find the vertex pointer for a vertex-snapped barycentric coordinate. | |
| bool | SnapPolyline (MeshType &poly) |
| SnapPolyline snaps the vertexes of a polyline onto the base mesh. | |
| void | SetControlPoints (MeshType &poly, ControlPoints mode=EndsAndNodes) |
| Choose the control points of a polyline (stored as its vertex selection). | |
| int | ConnectCrossings (MeshType &poly) |
| Make the points where strands meet into junctions (opt-in). | |
| void | SelectUniformlyDistributed (MeshType &poly, int k) |
| void | DecomposeNonManifoldPolyline (MeshType &poly, bool singSplitFlag=true) |
| void | Init () |
| Initialize the CoM data structures for processing. | |
| void | SimplifyNullEdges (MeshType &poly) |
| Remove duplicate/zero-length edges from a polyline. | |
| int | CollapseNullEdges (MeshType &poly) |
| Merge the two ends of every zero-length polyline edge. | |
| void | Simplify (MeshType &poly) |
| void | EvaluateHausdorffDistance (MeshType &poly, Distribution< ScalarType > &dist) |
| bool | BarycentricSnap (CoordType &ip, const FaceType &f) |
| Snap the barycentric coordinates of a point of face f onto a vertex or an edge. | |
| ScalarType | MaxSegDist (VertexType *v0, VertexType *v1, CoordType &farthestPointOnSurf, CoordType &farthestN, Distribution< ScalarType > *distanceDistribution=0) |
| void | RefineCurveByDistance (MeshType &poly) |
| RefineCurve. | |
| void | RefineCurveByBaseMesh (MeshType &poly) |
| Make every polyline segment lie inside one face or along one edge of the base mesh, by inserting the exact points where it crosses the mesh edges. | |
| bool | RoundingSnap (CoordType &ip, const FaceType &f) const |
| Location | Locate (const CoordType &p) |
| Location | LocationFrom (FaceType *f, const CoordType &ip) const |
| bool | OnCutSeam (const Location &loc) const |
| void | TraceSegment (const CoordType &p, const CoordType &q, std::vector< CoordType > &crossings) |
| template<typename PositionFunctor > | |
| void | MoveAndProject (MeshType &poly, int iterNum, ScalarType moveWeight, ScalarType projectWeight, PositionFunctor &desiredPos) |
| MoveAndProject. | |
| void | SmoothProject (MeshType &poly, int iterNum, ScalarType smoothWeight, ScalarType projectWeight) |
Static Public Member Functions | |
| static bool | BarycentricSnap (CoordType &ip, const FaceType &f, ScalarType barThr, ScalarType distThr) |
| BarycentricSnap() with explicit thresholds, e.g. rounding-level ones. | |
| static void | ThrowCutSeam (const CoordType &p) |
Public Attributes | |
| MeshType & | base |
| Reference to the base triangulated surface mesh. | |
| MeshGrid | uniformGrid |
| Spatial acceleration structure for closest point queries. | |
| Param | par |
| Parameters controlling algorithm behavior. | |
Friends | |
| template<class > | |
| class | CoMEmbed |
| typedef std::vector<std::pair<FaceType *, CoordType> > vcg::tri::CoM< MeshType >::Location |
Where a point is on the mesh: every face it belongs to, with its barycentric coordinates there. One face for a point inside a face, the two faces of an edge, or the faces around a vertex.
| enum vcg::tri::CoM::ControlPoints |
Which polyline vertices SetControlPoints() makes control points.
|
inline |
|
inline |
Snap the barycentric coordinates of a point of face f onto a vertex or an edge.
| ip | Input/Output: barycentric coordinates in f (summing to 1) |
| f | The face they refer to |
A coordinate is set to 0 only if it is within Param::barycentricSnapThr of 0 and the snap moves the point by at most Param::maxSnapThr. The barycentric bound alone is only meaningful on well-shaped, uniformly sized triangles: on a large or skinny one it can move a point far, which the distance bound prevents; on tiny triangles the barycentric bound keeps a point from being snapped across them. Two coordinates at 0 put the point on a vertex. The remaining coordinates are renormalized so they sum to exactly 1. Setting either threshold to 0 disables snapping.
|
inline |
Merge the two ends of every zero-length polyline edge.
Vertices are merged only along the polyline, never because they happen to coincide: two strands passing through the same point stay two strands, and are not joined into a junction that smoothing would then treat as one. (Clean::RemoveDuplicateVertex, used here before, merged them.) Compacts poly and updates its VE adjacency.
|
inline |
Make the points where strands meet into junctions (opt-in).
After CoMEmbed::SplitMeshWithPolyline() two strands that cross or touch each have a vertex at the same position. By default they stay separate strands; this merges every set of coinciding vertices into one and merges the edges two strands share, so the meeting points become part of the curve's topology; where the merged curve branches the vertex is a junction, and a control point.
|
inline |
Find the vertex pointer for a vertex-snapped barycentric coordinate.
| fp | The face containing the point |
| ip | The barycentric coordinate (should be snapped to a vertex) |
|
inline |
Get the closest face to a query point.
| p | The query point |
| vcg::MissingPreconditionException | if no face is within Param::gridBailout, as all the closest-face queries below |
|
inline |
Get the closest face and its barycentric coordinates.
| p | The query point |
| ip | Output: barycentric coordinates of the closest point on the returned face |
|
inline |
Get the closest face, barycentric coordinates, and normal.
| p | The query point |
| ip | Output: barycentric coordinates of the closest point on the returned face |
| in | Output: normal at the closest point |
|
inline |
Get the closest face and the closest point on it.
| p | The query point |
| closestP | Output: the 3D coordinates of the closest point on the surface |
|
inline |
Initialize the CoM data structures for processing.
This must be called after construction and whenever the base mesh is modified. It performs:
|
inline |
Check if a barycentric coordinate is snapped to an edge.
| ip | The barycentric coordinate (must be snapped) |
| ei | Output: index (0,1,2) of the edge opposite to the zero coordinate |
Edge snapping means the point lies on one of the three edges of the triangle. Edge i is the edge from vertex i to vertex (i+1)%3, opposite to vertex (i+2)%3.
|
inline |
Check if a barycentric coordinate is snapped to a vertex.
| ip | The barycentric coordinate (must be snapped) |
| vi | Output: index (0,1,2) of the vertex with coordinate == 1.0 |
|
inline |
MoveAndProject.
| poly | |
| iterNum | |
| moveWeight | [0..1] blend toward the desired position returned by the functor |
| projectWeight | [0..1] blend toward the closest point on the surface |
| desiredPos | functor: std::vector<CoordType>(const MeshType&) |
Generic version of SmoothProject: the per-vertex desired position is supplied by a functor instead of being hard-coded as a Laplacian average.
|
inline |
Whether a border the point at loc lies on has a coincident twin border edge: the two sides of a cut, or of a seam where a file split its vertices. The surface is disconnected there but has no gap, and since CoM locates curve points by position it cannot tell the two sides apart; the trace stops as at a real border, and this only lets the error say which of the two it met (ThrowCutSeam). A linear scan: it runs once, on failure.
|
inline |
Make every polyline segment lie inside one face or along one edge of the base mesh, by inserting the exact points where it crosses the mesh edges.
| poly | The polyline; its own vertices are snapped first (SnapPolyline), then kept |
Each segment is traced across the mesh along its section by one plane (TraceSegment): in the current face the edge where it leaves is the first barycentric coordinate to reach zero, and the crossing point is made with that coordinate exactly zero, so it lies exactly on the edge. The trace then continues in the faces on the other side, through a vertex if it leaves through one, until it reaches a face that also holds the far end. Two strands traced through the same faces therefore keep their order along every edge they cross: close parallel curves stay parallel, which approximate crossing points (the bisection used here before) did not guarantee.
| vcg::MissingPreconditionException | if a segment cannot be traced, e.g. one that leaves the surface across a border |
|
inline |
RefineCurve.
| poly | the curve to be refined |
| uniformFlag |
Make one pass of refinement for all the edges of the curve that are distant from the basemesh uses two parameters:
|
inline |
Snap at rounding level only: a point this close to a vertex or an edge is on it. Shared by the trace and by CoMEmbed, so both agree on where a curve point is.
By distance alone, with no barycentric bound: at rounding level a point within the distance of an edge is on it however small the triangle, and that distance is the same seen from either face of the edge, so a point found on an edge in one face is found on it again in the other. A barycentric bound depends on the face's shape: on a tiny triangle next to a vertex, one face put a point on an edge where its neighbour put it on another, and the curve embedding then found a segment in no face.
|
inline |
Choose the control points of a polyline (stored as its vertex selection).
Call it once on the input curve, before smoothing or refining it. With EndsAndNodes the curve keeps its topology and its ends, and every strand between them is free to become a geodesic; a helix on a cylinder with fixed ends stays a helix, since the strand cannot unwind around the cylinder.
|
inline |
Remove duplicate/zero-length edges from a polyline.
| poly | The polyline to simplify |
Removes vertices that have collapsed to the same position.
|
inline |
SnapPolyline snaps the vertexes of a polyline onto the base mesh.
| poly | |
| newVertVec | the vector of the indexes of the snapped vertices |
Polyline vertices can be snapped either on vertexes or on edges. Usually the only points that we should allow to not be snapped are the endpoints and non manifold points. Vertexes are colored according to their snapping state
|
inline |
The points where the segment from p to q crosses mesh edges, in order.
The segment is traced as the section of the surface by one plane: through p and q, containing the mean surface normal at the two ends. Every face then agrees on where the trace goes, since the plane is the same for all of them. (Projecting q onto each face plane in turn does not: on a curved surface two neighbouring faces can each say q lies across the other, and the trace bounces between them.)