![]() |
VCG Library
|
Class of static functions to clean//restore meshs. More...
#include <clean.h>
Classes | |
| struct | CompareAreaFP |
| class | RemoveDuplicateVert_Compare |
| class | SortedPair |
| class | SortedTriple |
Public Types | |
| typedef CleanMeshType | MeshType |
| typedef MeshType::VertexType | VertexType |
| typedef MeshType::VertexPointer | VertexPointer |
| typedef MeshType::ConstVertexPointer | ConstVertexPointer |
| typedef MeshType::VertexIterator | VertexIterator |
| typedef MeshType::ConstVertexIterator | ConstVertexIterator |
| typedef MeshType::EdgeIterator | EdgeIterator |
| typedef MeshType::EdgePointer | EdgePointer |
| typedef MeshType::CoordType | CoordType |
| typedef MeshType::ScalarType | ScalarType |
| typedef MeshType::FaceType | FaceType |
| typedef MeshType::FacePointer | FacePointer |
| typedef MeshType::FaceIterator | FaceIterator |
| typedef MeshType::ConstFaceIterator | ConstFaceIterator |
| typedef MeshType::FaceContainer | FaceContainer |
| typedef MeshType::TetraType | TetraType |
| typedef MeshType::TetraPointer | TetraPointer |
| typedef MeshType::TetraIterator | TetraIterator |
| typedef MeshType::ConstTetraIterator | ConstTetraIterator |
| typedef vcg::Box3< ScalarType > | Box3Type |
| typedef GridStaticPtr< FaceType, ScalarType > | TriMeshGrid |
Static Public Member Functions | |
| static int | RemoveDuplicateVertex (MeshType &m, bool RemoveDegenerateFlag=true) |
| static int | RemoveDuplicateFace (MeshType &m) |
| static int | RemoveDuplicateEdge (MeshType &m) |
| static int | CountUnreferencedVertex (MeshType &m) |
| static int | RemoveUnreferencedVertex (MeshType &m, bool DeleteVertexFlag=true) |
| static int | RemoveDegenerateVertex (MeshType &m, bool DeleteVertexFlag=true) |
| static int | RemoveDegenerateFace (MeshType &m, bool DeleteFacesFlag=true) |
| static int | RemoveDegenerateEdge (MeshType &m, bool DeleteEdgesFlag=true) |
| static int | RemoveNonManifoldVertex (MeshType &m) |
| static int | SplitSelectedVertexOnEdgeMesh (MeshType &m) |
| static void | SelectNonManifoldVertexOnEdgeMesh (MeshType &m) |
| static void | SelectCreaseVertexOnEdgeMeshEE (MeshType &m, ScalarType AngleRadThr) |
| Given an edge mesh it selects the vertexes where the edge make an angle greater than AngleRadThr. it uses the EE Adjacency. | |
| static void | SelectCreaseVertexOnEdgeMeshVE (MeshType &m, ScalarType AngleRadThr) |
| Given an edge mesh it selects the vertexes where the edge make an angle greater than AngleRadThr. it uses the VE Adjacency. | |
| static int | SplitNonManifoldVertex (MeshType &m, ScalarType moveThreshold) |
| Removal of faces that were incident on a non manifold edge. | |
| static size_t | SplitManifoldComponents (MeshType &m, const ScalarType moveThreshold=0) |
| This function expand current selection to cover the whole connected component. | |
| static int | RemoveNonManifoldFace (MeshType &m, bool DeleteFacesFlag=true) |
| Removal of faces that were incident on a non manifold edge. | |
| static int | RemoveFaceOutOfRangeArea (MeshType &m, ScalarType MinAreaThr=0, ScalarType MaxAreaThr=(std::numeric_limits< ScalarType >::max)(), bool OnlyOnSelected=false, bool DeleteFacesFlag=true) |
| static int | RemoveZeroAreaFace (MeshType &m, bool DeleteFacesFlag=true) |
| static bool | IsBitQuadOnly (const MeshType &m) |
| static bool | IsFaceFauxConsistent (MeshType &m) |
| static bool | IsBitTriOnly (const MeshType &m) |
| static bool | IsBitPolygonal (const MeshType &m) |
| static bool | IsBitTriQuadOnly (const MeshType &m) |
| static int | CountBitQuads (const MeshType &m) |
| static int | CountBitTris (const MeshType &m) |
| static int | CountBitPolygons (const MeshType &m) |
| static int | CountBitLargePolygons (const MeshType &m) |
| static bool | HasConsistentPerFaceFauxFlag (const MeshType &m) |
| static int | CountNonManifoldEdgeEE (MeshType &m, bool SelectFlag=false) |
| static int | CountNonManifoldEdgeFF (MeshType &m, bool SelectFlag=false) |
| static int | CountNonManifoldVertexFF (MeshType &m, bool selectVert=true, bool clearSelection=true) |
| static bool | IsWaterTight (MeshType &m) |
| static void | CountEdgeNum (MeshType &m, int &total_e, int &boundary_e, int &non_manif_e) |
| static int | CountHoles (MeshType &m) |
| static int | CountConnectedComponents (MeshType &m) |
| static int | ConnectedComponents (MeshType &m, std::vector< std::pair< int, FacePointer > > &CCV) |
| static int | edgeMeshConnectedComponents (MeshType &poly, std::vector< std::pair< int, typename MeshType::EdgePointer > > &eCC) |
| static void | ComputeValence (MeshType &m, typename MeshType::PerVertexIntHandle &h) |
| static int | MeshGenus (int nvert, int nedges, int nfaces, int numholes, int numcomponents) |
| static int | MeshGenus (MeshType &m) |
| static void | IsRegularMesh (MeshType &m, bool &Regular, bool &Semiregular) |
| static bool | IsCoherentlyOrientedMesh (MeshType &m) |
| static void | OrientCoherentlyMesh (MeshType &m, bool &_IsOriented, bool &_IsOrientable) |
| static void | FlipMesh (MeshType &m, bool selected=false) |
| Flip the orientation of the whole mesh flipping all the faces (by swapping the first two vertices) | |
| static bool | FlipNormalOutside (MeshType &m) |
| static int | RemoveFaceFoldByFlip (MeshType &m, float normalThresholdDeg=175, bool repeat=true, bool updateTopology=true) |
| static int | RemoveTVertexByFlip (MeshType &m, float threshold=40, bool repeat=true) |
| static int | RemoveTVertexByCollapse (MeshType &m, float threshold=40, bool repeat=true) |
| static bool | SelfIntersections (MeshType &m, std::vector< FaceType * > &ret) |
| static bool | IsSizeConsistent (MeshType &m) |
| static bool | IsFFAdjacencyConsistent (MeshType &m) |
| static bool | HasConsistentPerWedgeTexCoord (MeshType &m) |
| static bool | HasZeroTexCoordFace (MeshType &m) |
| static bool | TestFaceFaceIntersection (FaceType *f0, FaceType *f1) |
| static int | MergeCloseVertex (MeshType &m, const ScalarType radius) |
| static int | ClusterVertex (MeshType &m, const ScalarType radius) |
| static std::pair< int, int > | RemoveSmallConnectedComponentsSize (MeshType &m, int maxCCSize) |
| static std::pair< int, int > | RemoveSmallConnectedComponentsDiameter (MeshType &m, ScalarType maxDiameter) |
| Remove the connected components smaller than a given diameter. | |
| static std::pair< int, int > | RemoveHugeConnectedComponentsDiameter (MeshType &m, ScalarType minDiameter) |
| Remove the connected components greater than a given diameter. | |
| static void | SelectFoldedFaceFromOneRingFaces (MeshType &m, ScalarType cosThreshold) |
| static int | SelectIntersectingFaces (MeshType &m1, MeshType &m2) |
Class of static functions to clean//restore meshs.
|
inlinestatic |
The number of polygonal faces is FN - EN_f (each faux edge hides exactly one triangular face or in other words a polygon of n edges has n-3 faux edges.) In the general case where a The number of polygonal faces is FN - EN_f + VN_f where: EN_f is the number of faux edges. VN_f is the number of faux vertices (e.g vertices completely surrounded by faux edges) as a intuitive proof think to a internal vertex that is collapsed onto a border of a polygon: it deletes 2 faces, 1 faux edges and 1 vertex so to keep the balance you have to add back the removed vertex.
|
inlinestatic |
How many polygons of any kind? (including triangles) it assumes that there are no faux vertexes (e.g vertices completely surrounded by faux edges)
|
inlinestatic |
How many quadrilaterals? It assumes that the bits are consistent. In that case we count the tris with a single faux edge and divide by two.
|
inlinestatic |
How many triangles? (non polygonal faces)
|
inlinestatic |
Count the number of non manifold edges in a polylinemesh, e.g. the edges where there are more than 2 incident faces.
|
inlinestatic |
Count the number of non manifold edges in a mesh, e.g. the edges where there are more than 2 incident faces.
Note that this test is not enough to say that a mesh is two manifold, you have to count also the non manifold vertexes.
|
inlinestatic |
Count (and eventually select) non 2-Manifold vertexes of a mesh e.g. the vertices with a non 2-manif. neighbourhood but that do not belong to not 2-manif edges. typical situation two cones connected by one vertex.
|
inlinestatic |
Flip a mesh so that its normals are orented outside. Just for safety it uses a voting scheme. It assumes that mesh has already has coherent normals. mesh is watertight and signle component.
|
inlinestatic |
Checks that the mesh has consistent per-face faux edges (the ones that merges triangles into larger polygons). A border edge should never be faux, and faux edges should always be reciprocated by another faux edges. It requires FF adjacency.
|
inlinestatic |
This function simply test that a mesh has some reasonable tex coord.
|
inlinestatic |
Simple check that there are no face with all collapsed tex coords.
|
inlinestatic |
Is the mesh only composed by quadrilaterals?
|
inlinestatic |
Is the mesh only composed by triangles? (non polygonal faces)
|
inlinestatic |
Is the mesh only composed by quadrilaterals and triangles? (no pentas, etc) It assumes that the bits are consistent. In that case there can be only a single faux edge.
|
inlinestatic |
This function simply test that all the faces have a consistent face-face topology relation. useful for checking that a topology modifying algorithm does not mess something.
|
inlinestatic |
Check if the given mesh is regular, semi-regular or irregular.
Each vertex of a regular mesh has valence 6 except for border vertices which have valence 4.
A semi-regular mesh is derived from an irregular one applying 1-to-4 subdivision recursively. (not checked for now)
All other meshes are irregular.
|
inlinestatic |
This function simply test that the vn and fn counters be consistent with the size of the containers and the number of deleted simplexes.
|
inlinestatic |
Very simple test of water tightness. No boundary and no non manifold edges. Assume that it is orientable. It could be debated if a closed non orientable surface is watertight or not.
The rationale of not testing orientability here is that it requires FFAdj while this test do not require any adjacency.
|
inlinestatic |
This function merge all the vertices that are closer than the given radius
|
inlinestatic |
GENUS. A topologically invariant property of a surface defined as the largest number of non-intersecting simple closed curves that can be drawn on the surface without separating it.
Roughly speaking, it is the number of holes in a surface. The genus g of a closed surface, also called the geometric genus, is related to the Euler characteristic by the relation $chi$ by $chi==2-2g$.
The genus of a connected, orientable surface is an integer representing the maximum number of cuttings along closed simple curves without rendering the resultant manifold disconnected. It is equal to the number of handles on it.
For general polyhedra the Euler Formula is:
V - E + F = 2 - 2G - B
where V is the number of vertices, F is the number of faces, E is the number of edges, G is the genus and B is the number of boundary polygons.
The above formula is valid for a mesh with one single connected component. By considering multiple connected components the formula becomes:
V - E + F = 2C - 2Gs - B -> 2Gs = - ( V-E+F +B -2C)
where C is the number of connected components and Gs is the sum of the genus of all connected components.
Note that in the case of a mesh with boundaries the intuitive meaning of Genus is less intuitive that it could seem. A closed sphere, a sphere with one hole (e.g. a disk) and a sphere with two holes (e.g. a tube) all of them have Genus == 0
|
inlinestatic |
Degenerate faces are faces that are Topologically degenerate, i.e. have two or more vertex reference that link the same vertex (and not only two vertexes with the same coordinates). All Degenerate faces are zero area faces BUT not all zero area faces are degenerate. We do not take care of topology because when we have degenerate faces the topology calculation functions crash.
|
inlinestatic |
Degenerate vertices are vertices that have coords with invalid floating point values, All the faces incident on deleted vertices are also deleted
|
inlinestatic |
This function removes all duplicate faces of the mesh by looking only at their vertex reference. So it should be called after unification of vertices. Note that it does not update any topology relation that could be affected by this like the VT or TT relation. the reason this function is usually performed BEFORE building any topology information.
|
inlinestatic |
This function removes all duplicate faces of the mesh by looking only at their vertex reference. So it should be called after unification of vertices. Note that it does not update any topology relation that could be affected by this like the VT or TT relation. the reason this function is usually performed BEFORE building any topology information.
|
inlinestatic |
This function removes all duplicate vertices of the mesh by looking only at their spatial positions. Note that it does not update any topology relation that could be affected by this like the VT or TT relation. the reason this function is usually performed BEFORE building any topology information.
|
inlinestatic |
Repair isolated triangular folds by flipping their supporting edge.
A face is considered an isolated fold when its normal forms an angle larger than normalThresholdDeg with the normal of each of its three edge-neighbours. For each edge, flipping its diagonal would replace the face and that neighbour with two new triangles. The flip is accepted only if the new triangles are not folded against each other or against any triangles across the four outer edges of the pair. It therefore removes at least the three original relations without creating new ones, which prevents oscillation.
Face selection/visited bits are deliberately not used as scratch storage. Polygonal meshes and meshes with enabled per-wedge texture coordinates are rejected because a flip cannot preserve polygon boundaries or UV seams.
The caller must provide a compact, consistently oriented, 2-manifold triangle mesh with per-face normals. FF adjacency is rebuilt by default; callers which have just computed it can pass updateTopology=false. With repeat=false each face is examined once; repeat=true also revisits every affected neighbourhood.
|
inlinestatic |
This function removes vertices that are not referenced by any face or by any edge.
| m | The mesh |
| DeleteVertexFlag | if false prevent the vertex deletion and just count it. |
|
inlinestatic |
Select the folded faces using an angle threshold on the face normal. The face is selected if the dot product between the face normal and the normal of the plane fitted using the vertices of the one ring faces is below the cosThreshold. The cosThreshold requires a negative cosine value (a positive value is clamp to zero).
|
inlinestatic |
Select the faces on the first mesh that intersect the second mesh. It uses a grid for querying so a face::mark should be added.
|
inlinestatic |
This function test if two triangular faces of a mesh intersect. It assumes that the faces (as storage) are different (e.g different address) If the two faces are different but coincident (same set of vertexes) return true. if the faces share an edge no test is done. if the faces share only a vertex, the opposite edge is tested against the face