Visual Computing Library  devel
Loading...
Searching...
No Matches
tri_mesh.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_MESHES_TRI_MESH_H
24#define VCL_MESHES_TRI_MESH_H
25
26#include <vclib/mesh.h>
27
28namespace vcl {
29
30template<typename ScalarType, bool INDEXED>
31class TriMeshT;
32
33} // namespace vcl
34
35namespace vcl::trimesh {
36
37template<typename Scalar, bool INDEXED>
38class Vertex;
39
40template<typename Scalar, bool INDEXED>
41class Face;
42
66template<typename Scalar, bool I>
67class Vertex :
68 public vcl::Vertex<
69 TriMeshT<Scalar, I>,
70 vert::BitFlags,
71 vert::Position3<Scalar>,
72 vert::Normal3<Scalar>,
73 vert::OptionalColor<Vertex<Scalar, I>>,
74 vert::OptionalQuality<Scalar, Vertex<Scalar, I>>,
75 vert::OptionalAdjacentFaces<I, Face<Scalar, I>, Vertex<Scalar, I>>,
76 vert::OptionalAdjacentVertices<I, Vertex<Scalar, I>>,
77 vert::OptionalPrincipalCurvature<Scalar, Vertex<Scalar, I>>,
78 vert::OptionalTexCoord<Scalar, Vertex<Scalar, I>>,
79 vert::OptionalMaterialIndex<Vertex<Scalar, I>>,
80 vert::OptionalTangent3<Scalar, Vertex<Scalar, I>>,
81 vert::OptionalMark<Vertex<Scalar, I>>,
82 vert::CustomComponents<Vertex<Scalar, I>>>
83{
84public:
85 friend void swap(Vertex& a, Vertex& b) { a.swap(b); }
86};
87
108template<typename Scalar, bool I>
109class Face :
110 public vcl::Face<
111 TriMeshT<Scalar, I>,
112 face::TriangleBitFlags,
113 face::TriangleVertexRefs<I, Vertex<Scalar, I>, Face<Scalar, I>>,
114 face::Normal3<Scalar>,
115 face::OptionalColor<Face<Scalar, I>>,
116 face::OptionalQuality<Scalar, Face<Scalar, I>>,
117 face::OptionalAdjacentTriangles<I, Face<Scalar, I>>,
118 face::OptionalTriangleWedgeTexCoords<Scalar, Face<Scalar, I>>,
119 face::OptionalMaterialIndex<Face<Scalar, I>>,
120 face::OptionalMark<Face<Scalar, I>>,
121 face::CustomComponents<Face<Scalar, I>>>
122{
123public:
124 friend void swap(Face& a, Face& b) { a.swap(b); }
125};
126
127} // namespace vcl::trimesh
128
129namespace vcl {
130
156template<typename Scalar, bool INDEXED>
157class TriMeshT :
158 public Mesh<
159 mesh::VertexContainer<trimesh::Vertex<Scalar, INDEXED>>,
160 mesh::FaceContainer<trimesh::Face<Scalar, INDEXED>>,
161 mesh::BoundingBox3<Scalar>,
162 mesh::Color,
163 mesh::Mark,
164 mesh::Materials,
165 mesh::Name,
166 mesh::TransformMatrix<Scalar>,
167 mesh::CustomComponents>
168{
169public:
171 using ScalarType = Scalar;
172};
173
180
187
195
203
204} // namespace vcl
205
206#endif // VCL_MESHES_TRI_MESH_H
A class representing a box in N-dimensional space.
Definition box.h:46
The Face class represents an Face element of the vcl::Mesh class.
Definition face.h:48
The Mesh class represents a generic 3D mesh. A mesh is composed of a generic number of containers of ...
Definition mesh.h:68
The TriMeshT class is a mesh class that represents a triangle mesh.
Definition tri_mesh.h:168
Scalar ScalarType
The scalar used to store all the data of the Mesh.
Definition tri_mesh.h:171
The Vertex class represents an Vertex element of the vcl::Mesh class.
Definition vertex.h:46
The Face type used by the TriMeshT class.
Definition tri_mesh.h:122
The Vertex type used by the TriMeshT class.
Definition tri_mesh.h:83