supereight
Loading...
Searching...
No Matches
mesh.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
3 * SPDX-FileCopyrightText: 2019-2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
4 * SPDX-FileCopyrightText: 2021 Nils Funk
5 * SPDX-FileCopyrightText: 2021 Sotiris Papatheodorou
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef SE_MESH_FACE_HPP
10#define SE_MESH_FACE_HPP
11
12#include <Eigen/StdVector>
13#include <array>
14#include <optional>
15#include <se/common/rgb.hpp>
17#include <vector>
18
19namespace se {
20
21template<size_t NumVertexes, Colour ColB>
23};
24
25template<size_t NumVertexes>
27 std::array<RGB, NumVertexes> vertexes;
28};
29
30
31
32template<size_t NumVertexes, Semantics SemB>
35
36
37
38template<size_t NumVertexes, Colour ColB = Colour::Off, Semantics SemB = Semantics::Off>
39struct MeshFace {
40 std::array<Eigen::Vector3f, NumVertexes> vertexes;
43 std::int8_t scale = 0;
44
45 static constexpr size_t num_vertexes = NumVertexes;
46 static constexpr Colour col = ColB;
47 static constexpr Semantics sem = SemB;
48
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
50};
51
52
53
60template<typename FaceT>
61using Mesh = std::vector<FaceT>;
62
63template<Colour ColB = Colour::Off, Semantics SemB = Semantics::Off>
65
66template<Colour ColB = Colour::Off, Semantics SemB = Semantics::Off>
68
69template<Colour ColB = Colour::Off, Semantics SemB = Semantics::Off>
71
72template<Colour ColB = Colour::Off, Semantics SemB = Semantics::Off>
74
75
76
78template<Colour ColB, Semantics SemB>
80
81namespace meshing {
82
83struct Vertex {
84 Vertex(const Eigen::Vector3f& position) : position(position)
85 {
86 }
87
88 Eigen::Vector3f position;
89 std::optional<Eigen::Vector3f> normal;
90 std::optional<RGB> color;
91
92 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
93};
94
95template<size_t NumFaceVertices = 3>
97 public:
98 std::vector<Vertex, Eigen::aligned_allocator<Vertex>> vertices;
99 std::vector<size_t> indices; // faces
100
101 static constexpr size_t num_face_vertices = NumFaceVertices;
102
103 void merge(const VertexIndexMesh& other);
104
106
107 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
108};
109
110} // namespace meshing
111} // namespace se
112
113#include "impl/mesh_impl.hpp"
114
115#endif // SE_MESH_FACE_HPP
Definition image.hpp:19
Definition mesh.hpp:96
void merge(const VertexIndexMesh &other)
std::vector< size_t > indices
Definition mesh.hpp:99
std::vector< Vertex, Eigen::aligned_allocator< Vertex > > vertices
Definition mesh.hpp:98
static constexpr size_t num_face_vertices
Definition mesh.hpp:101
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
Mesh< Triangle< ColB, SemB > > TriangleMesh
Definition mesh.hpp:67
TriangleMesh< ColB, SemB > quad_to_triangle_mesh(const QuadMesh< ColB, SemB > &quad_mesh)
Return a triangle mesh containig two triangles for each face of quad_mesh.
std::vector< FaceT > Mesh
Meshes are represented as lists of faces.
Definition mesh.hpp:61
Semantics
Definition setup_util.hpp:20
Colour
Definition setup_util.hpp:19
std::array< RGB, NumVertexes > vertexes
Definition mesh.hpp:27
Definition mesh.hpp:22
Definition mesh.hpp:33
Definition mesh.hpp:39
MeshFaceColourData< NumVertexes, ColB > colour
Definition mesh.hpp:41
static constexpr Semantics sem
Definition mesh.hpp:47
std::int8_t scale
Definition mesh.hpp:43
std::array< Eigen::Vector3f, NumVertexes > vertexes
Definition mesh.hpp:40
static constexpr size_t num_vertexes
Definition mesh.hpp:45
static constexpr Colour col
Definition mesh.hpp:46
MeshFaceSemanticData< NumVertexes, SemB > semantic
Definition mesh.hpp:42
Definition mesh.hpp:83
Eigen::Vector3f position
Definition mesh.hpp:88
std::optional< RGB > color
Definition mesh.hpp:90
Vertex(const Eigen::Vector3f &position)
Definition mesh.hpp:84
std::optional< Eigen::Vector3f > normal
Definition mesh.hpp:89