9#ifndef SE_MESH_FACE_HPP
10#define SE_MESH_FACE_HPP
12#include <Eigen/StdVector>
26template<
size_t NumVertexes, Colour ColB>
29template<
size_t NumVertexes>
37template<
size_t NumVertexes, Id IdB>
40template<
size_t NumVertexes>
47template<
size_t NumVertexes, Colour ColB = Colour::Off, Id IdB = Id::Off>
49 std::array<Eigen::Vector3f, NumVertexes>
vertexes;
58 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69template<
typename FaceT>
70using Mesh = std::vector<FaceT>;
72template<Colour ColB = Colour::Off, Id IdB = Id::Off>
75template<Colour ColB = Colour::Off, Id IdB = Id::Off>
78template<Colour ColB = Colour::Off, Id IdB = Id::Off>
81template<Colour ColB = Colour::Off, Id IdB = Id::Off>
87template<Colour ColB, Id IdB>
95 Eigen::Vector3f
centroid = Eigen::Vector3f::Zero();
98 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
104template<
typename FaceT,
typename = std::enable_if_t<FaceT::
id_ == Id::On>>
108template<
typename FaceT,
typename = std::enable_if_t<FaceT::
id_ == Id::On>>
117template<
typename FaceT,
typename ExtractIdF,
typename = std::enable_if_t<FaceT::
id_ == Id::On>>
121template<
typename FaceT,
typename = std::enable_if_t<FaceT::
id_ == Id::On>>
124 const Eigen::Vector3f&
light_dir_W = Eigen::Vector3f(-1, 0, -1),
142 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
145template<
size_t NumFaceVertices = 3>
148 std::vector<Vertex, Eigen::aligned_allocator<Vertex>>
vertices;
157 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
163#include "impl/mesh_impl.hpp"
void merge(const VertexIndexMesh &other)
std::vector< size_t > indices
Definition mesh.hpp:149
std::vector< Vertex, Eigen::aligned_allocator< Vertex > > vertices
Definition mesh.hpp:148
static constexpr size_t num_face_vertices
Definition mesh.hpp:151
void colour_mesh_by_id(Mesh< FaceT > &mesh, const bool enable_shading=true, const Eigen::Vector3f &light_dir_W=Eigen::Vector3f(-1, 0, -1), const RGB ambient=RGB{0x40, 0x40, 0x40})
Colour the faces of mesh by their ID.
std::map< id_t, IdInfo > mesh_id_info(const Mesh< FaceT > &mesh)
Return information about all identifiers in mesh.
std::map< id_t, Mesh< FaceT > > extract_id_meshes(const Mesh< FaceT > &mesh)
Extract per-identifier meshes for all identifiers in mesh.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
TriangleMesh< ColB, IdB > quad_to_triangle_mesh(const QuadMesh< ColB, IdB > &quad_mesh)
Return a triangle mesh containig two triangles for each face of quad_mesh.
uint16_t id_t
The type used to represent identifiers.
Definition type_util.hpp:60
std::vector< FaceT > Mesh
Meshes are represented as lists of faces.
Definition mesh.hpp:70
Id
Definition setup_util.hpp:20
Mesh< Triangle< ColB, IdB > > TriangleMesh
Definition mesh.hpp:76
Colour
Definition setup_util.hpp:19
RGB face
Definition mesh.hpp:32
std::array< RGB, NumVertexes > vertexes
Definition mesh.hpp:31
std::int8_t scale
Definition mesh.hpp:52
MeshFaceIdData< NumVertexes, IdB > id
Definition mesh.hpp:51
MeshFaceColourData< NumVertexes, ColB > colour
Definition mesh.hpp:50
static constexpr Colour col_
Definition mesh.hpp:55
static constexpr size_t num_vertexes
Definition mesh.hpp:54
std::array< Eigen::Vector3f, NumVertexes > vertexes
Definition mesh.hpp:49
static constexpr Id id_
Definition mesh.hpp:56
A colour represented as a Red-Green-Blue tuple with 8-bits per channel.
Definition rgb.hpp:18
Eigen::AlignedBox3f aabb
Definition mesh.hpp:96
Eigen::Vector3f centroid
Definition mesh.hpp:95
size_t num_vertices
Definition mesh.hpp:97
Eigen::Vector3f position
Definition mesh.hpp:138
std::optional< RGB > color
Definition mesh.hpp:140
Vertex(const Eigen::Vector3f &position)
Definition mesh.hpp:134
std::optional< Eigen::Vector3f > normal
Definition mesh.hpp:139