23#ifndef VCL_ALGORITHMS_MESH_UPDATE_TOPOLOGY_H
24#define VCL_ALGORITHMS_MESH_UPDATE_TOPOLOGY_H
26#include <vclib/algorithms/mesh/sort.h>
27#include <vclib/mesh/requirements.h>
44template<MeshConcept MeshType>
45void clearPerVertexAdjacentFaces(MeshType& m)
47 requirePerVertexAdjacentFaces(m);
49 using VertexType = MeshType::VertexType;
67template<FaceMeshConcept MeshType>
68void updatePerVertexAdjacentFaces(MeshType& m)
70 clearPerVertexAdjacentFaces(m);
72 using VertexType = MeshType::VertexType;
73 using FaceType = MeshType::FaceType;
79 for (FaceType& f : m.
faces()) {
99template<MeshConcept MeshType>
100void clearPerVertexAdjacentVertices(MeshType& m)
102 requirePerVertexAdjacentVertices(m);
104 using VertexType = MeshType::VertexType;
106 for (VertexType& v : m.
vertices()) {
107 v.clearAdjVertices();
122template<FaceMeshConcept MeshType>
123void updatePerVertexAdjacentVertices(MeshType& m)
125 clearPerVertexAdjacentVertices(m);
127 using VertexType = MeshType::VertexType;
133 std::vector<MeshEdgeUtil<MeshType>> vec = fillAndSortMeshEdgeUtilVector(m);
136 VertexType* v1 =
nullptr;
137 VertexType* v2 =
nullptr;
138 for (uint i = 0; i < vec.size(); ++i) {
140 if (vec[i].v[0] != v1 || vec[i].v[1] != v2) {
144 v1->pushAdjVertex(v2);
145 v2->pushAdjVertex(v1);
164template<FaceMeshConcept MeshType>
165void clearPerFaceAdjacentFaces(MeshType& m)
169 using FaceType = MeshType::FaceType;
171 for (FaceType& f : m.
faces()) {
172 for (uint i = 0; i < f.adjFacesNumber(); ++i) {
173 f.setAdjFace(i,
nullptr);
222template<FaceMeshConcept MeshType>
223void updatePerFaceAdjacentFaces(MeshType& m)
231 std::vector<MeshEdgeUtil<MeshType>> vec = fillAndSortMeshEdgeUtilVector(m);
233 if (vec.size() > 0) {
237 for (
auto base = vec.begin(); base != vec.end();) {
245 if (j != vec.end()) {
248 i->f->setAdjFace(i->e,
nullptr);
251 while (j != vec.end() && *i == *j) {
252 i->f->setAdjFace(i->e, j->f);
257 i->f->setAdjFace(i->e, first->f);
void requirePerFaceAdjacentFaces(const MeshType &m)
This function asserts that a Mesh has a FaceContainer, the Face has a AdjacentFaces Component,...
Definition face_requirements.h:698
constexpr detail::FacesView faces
A view that allows to iterate overt the Face elements of an object.
Definition face.h:52
constexpr detail::VerticesView vertices
A view that allows to iterate over the Vertex elements of an object.
Definition vertex.h:60