23#ifndef VCL_ALGORITHMS_MESH_UPDATE_SELECTION_H
24#define VCL_ALGORITHMS_MESH_UPDATE_SELECTION_H
26#include <vclib/algorithms/mesh/clean.h>
27#include <vclib/algorithms/mesh/stat.h>
29#include <vclib/mesh.h>
33template<u
int ELEM_ID, MeshConcept MeshType>
34void clearElementSelection(MeshType& mesh)
36 for (
auto&& e : mesh.template elements<ELEM_ID>()) {
41template<MeshConcept MeshType>
42void clearVertexSelection(MeshType& m)
44 clearElementSelection<ElemId::VERTEX>(m);
47template<FaceMeshConcept MeshType>
48void clearFaceSelection(MeshType& m)
50 clearElementSelection<ElemId::FACE>(m);
53template<FaceMeshConcept MeshType>
54void clearFaceEdgesSelection(MeshType& m)
56 for (
auto& f : m.
faces()) {
57 for (uint i = 0; i < f.vertexNumber(); ++i) {
58 f.edgeSelected(i) =
false;
63template<EdgeMeshConcept MeshType>
64void clearEdgeSelection(MeshType& m)
66 clearElementSelection<ElemId::EDGE>(m);
69template<FaceMeshConcept MeshType>
70void selectNonManifoldVertices(MeshType& m,
bool clearSelectionFirst =
true)
72 std::vector<bool> nonManifoldVertices =
73 detail::nonManifoldVerticesVectorBool(m);
75 using VertexType = MeshType::VertexType;
78 if (nonManifoldVertices[m.index(v)]) {
81 else if (clearSelectionFirst) {
87template<FaceMeshConcept MeshType>
88void selectCreaseFaceEdges(
92 bool alsoBorderEdges =
false)
94 clearFaceEdgesSelection(m);
96 std::vector<std::pair<uint, uint>> creaseEdges =
97 creaseFaceEdges(m, angleRadNeg, angleRadPos, alsoBorderEdges);
99 for (
const auto& [fi, ei] : creaseEdges) {
100 m.face(fi).edgeSelected(ei) =
true;
constexpr detail::FacesView faces
A view that allows to iterate overt the Face elements of an object.
Definition face.h:84
constexpr detail::VerticesView vertices
A view that allows to iterate over the Vertex elements of an object.
Definition vertex.h:92