libVFRendering  0.14.0

A vector field rendering library
Geometry.hxx
1 #ifndef VFRENDERING_GEOMETRY_HXX
2 #define VFRENDERING_GEOMETRY_HXX
3 
4 #include <vector>
5 #include <array>
6 
7 #include <glm/glm.hpp>
8 
9 namespace VFRendering {
10 class Geometry {
11 public:
22  typedef unsigned int index_type;
23 
24  Geometry();
25  Geometry(const std::vector<glm::vec3>& positions, const std::vector<std::array<index_type, 3>>& surface_indices={}, const std::vector<std::array<index_type, 4>>& volume_indices={}, const bool& is_2d=false);
26 
27  const std::vector<glm::vec3>& positions() const;
28  const std::vector<std::array<index_type, 3>>& surfaceIndices() const;
29  const std::vector<std::array<index_type, 4>>& volumeIndices() const;
30  const glm::vec3& min() const;
31  const glm::vec3& max() const;
32  const bool& is2d() const;
33 
34  static Geometry cartesianGeometry(glm::ivec3 n, glm::vec3 bounds_min, glm::vec3 bounds_max);
35  static Geometry rectilinearGeometry(const std::vector<float>& xs, const std::vector<float>& ys, const std::vector<float>& zs);
36 
37 private:
38  std::vector<glm::vec3> m_positions;
39  mutable std::vector<std::array<index_type, 3>> m_surface_indices;
40  mutable std::vector<std::array<index_type, 4>> m_volume_indices;
41  bool m_is_2d;
42  mutable bool m_bounds_min_set;
43  mutable glm::vec3 m_bounds_min;
44  mutable bool m_bounds_max_set;
45  mutable glm::vec3 m_bounds_max;
46 };
47 }
48 
49 #endif
VFRendering::Geometry
Definition: Geometry.hxx:10
VFRendering::Geometry::index_type
unsigned int index_type
Type for use as indices into positions and vectors.
Definition: Geometry.hxx:22