SPH
Mesh.h
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
7 struct Mesh {
9 
10  class Face {
11  private:
13 
14  public:
15  Face() = default;
16 
17  Face(const Face& other)
18  : idxs{ other[0], other[1], other[2] } {}
19 
20  Face(const Size a, const Size b, const Size c)
21  : idxs{ a, b, c } {}
22 
23  Face& operator=(const Face& other) {
24  idxs[0] = other[0];
25  idxs[1] = other[1];
26  idxs[2] = other[2];
27  return *this;
28  }
29 
30  Size& operator[](const int i) {
31  return idxs[i];
32  }
33 
34  Size operator[](const int i) const {
35  return idxs[i];
36  }
37 
38  bool operator==(const Face& other) const {
39  return idxs == other.idxs;
40  }
41 
42  bool operator!=(const Face& other) const {
43  return idxs != other.idxs;
44  }
45  };
46 
48 };
49 
51 bool isMeshClosed(const Mesh& mesh);
52 
54 void refineMesh(Mesh& mesh);
55 
57 void subdivideMesh(Mesh& mesh);
58 
65 
68 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
void refineMesh(Mesh &mesh)
Improves mesh quality using edge flips (valence equalization) and tangential relaxation.
Definition: Mesh.cpp:29
bool isMeshClosed(const Mesh &mesh)
Checks if the mesh represents a single closed surface.
Definition: Mesh.cpp:12
void subdivideMesh(Mesh &mesh)
Subdivides all triangles of the mesh using 1-4 scheme.
Definition: Mesh.cpp:56
Mesh getMeshFromTriangles(ArrayView< const Triangle > triangles, const Float eps)
Converts array of triangles into a mesh.
Definition: Mesh.cpp:83
Array< Triangle > getTrianglesFromMesh(const Mesh &mesh)
Expands the mesh into an array of triangles.
Definition: Mesh.cpp:169
#define NAMESPACE_SPH_END
Definition: Object.h:12
Object providing safe access to continuous memory of data.
Definition: ArrayView.h:17
Generic dynamically allocated resizable storage.
Definition: Array.h:43
Face()=default
Face(const Face &other)
Definition: Mesh.h:17
Size & operator[](const int i)
Definition: Mesh.h:30
bool operator==(const Face &other) const
Definition: Mesh.h:38
bool operator!=(const Face &other) const
Definition: Mesh.h:42
Face & operator=(const Face &other)
Definition: Mesh.h:23
Size operator[](const int i) const
Definition: Mesh.h:34
Face(const Size a, const Size b, const Size c)
Definition: Mesh.h:20
Definition: Mesh.h:7
Array< Vector > vertices
Definition: Mesh.h:8
Array< Face > faces
Definition: Mesh.h:47