PolyFEM
Loading...
Searching...
No Matches
Navigation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <geogram/mesh/mesh.h>
4#include <geogram/basic/attributes.h>
5
6namespace polyfem
7{
8 namespace mesh
9 {
10 namespace Navigation
11 {
12
13 struct Index
14 {
15 int vertex;
16 int edge;
17 int face;
19 };
20
21 // Computes connectivity information on a surface mesh
22 // Marks both boundary edges and vertices
23 void prepare_mesh(GEO::Mesh &M);
24
25 // Retrieves the index (v,e,f) of one vertex incident to the given face
26 Index get_index_from_face(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, int f, int lv);
27
28 // Navigation in a surface mesh
29 Index switch_vertex(const GEO::Mesh &M, Index idx);
30 Index switch_edge(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, Index idx);
31 Index switch_face(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, Index idx);
32
33 // Iterate in a mesh
34 inline Index next_around_face(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, Index idx) { return switch_edge(M, c2e, switch_vertex(M, idx)); }
35 inline Index next_around_edge(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, Index idx) { return switch_vertex(M, switch_face(M, c2e, idx)); }
36 inline Index next_around_vertex(const GEO::Mesh &M, const GEO::Attribute<GEO::index_t> &c2e, Index idx) { return switch_face(M, c2e, switch_edge(M, c2e, idx)); }
37
38 } // namespace Navigation
39 } // namespace mesh
40} // namespace polyfem
Index get_index_from_face(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, int f, int lv)
Index next_around_vertex(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, Index idx)
Index switch_face(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, Index idx)
Index switch_edge(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, Index idx)
void prepare_mesh(GEO::Mesh &M)
Index next_around_face(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, Index idx)
Index next_around_edge(const GEO::Mesh &M, const GEO::Attribute< GEO::index_t > &c2e, Index idx)
Index switch_vertex(const GEO::Mesh &M, Index idx)