23#ifndef VCL_MESH_ELEMENTS_FACE_H
24#define VCL_MESH_ELEMENTS_FACE_H
26#include "base/element.h"
27#include "face_components.h"
29#include <vclib/base.h>
46template<
typename MeshType, comp::ComponentConcept... Comps>
49 using Base =
Element<ElemId::FACE, MeshType, Comps...>;
52 using VRefs =
typename Face::VertexReferences;
54 static const int NV = VRefs::VERTEX_NUMBER;
57 using VertexType =
typename VRefs::VertexType;
87 VRefs::setVertices(
r);
90 if constexpr (NV < 0) {
109 template<
typename... V>
111 (std::convertible_to<V, VertexType*> || std::convertible_to<V, uint>) &&
134 VRefs::resizeVertices(
n);
140 void pushVertex(VertexType* v)
requires (NV < 0)
142 VRefs::pushVertex(v);
148 void pushVertex(uint vi)
requires (NV < 0)
150 VRefs::pushVertex(vi);
153 (pushBackTTVNComponent<Comps>(), ...);
156 void insertVertex(uint i, VertexType* v)
requires (NV < 0)
158 VRefs::insertVertex(i, v);
161 (insertTTVNComponent<Comps>(i), ...);
164 void insertVertex(uint i, uint vi)
requires (NV < 0)
166 VRefs::insertVertex(i, vi);
169 (insertTTVNComponent<Comps>(i), ...);
172 void eraseVertex(uint i)
requires (NV < 0)
174 VRefs::eraseVertex(i);
177 (eraseTTVNComponent<Comps>(i), ...);
180 void clearVertices()
requires (NV < 0)
182 VRefs::clearVertices();
185 (clearTTVNComponent<Comps>(), ...);
188 template<
typename ElType>
189 void importFrom(
const ElType& v,
bool importRefs =
true)
191 if constexpr (comp::HasVertexReferences<ElType> && NV < 0) {
192 VRefs::resizeVertices(v.vertexNumber());
194 (resizeTTVNComponent<Comps>(v.vertexNumber()), ...);
197 Base::importFrom(v, importRefs);
205 template<
typename Comp>
209 if (Comp::isAvailable())
218 template<
typename Comp>
222 if (Comp::isAvailable())
231 template<
typename Comp>
235 if (Comp::isAvailable())
244 template<
typename Comp>
248 if (Comp::isAvailable())
257 template<
typename Comp>
261 if (Comp::isAvailable())
267template<
typename MeshType, comp::ComponentConcept... Comps>
296 IsDerivedFromSpecializationOfV<T, Face> &&
299 (RemoveRef<T>::VERTEX_NUMBER < 0 || RemoveRef<T>::VERTEX_NUMBER >= 3) &&
A class representing a box in N-dimensional space.
Definition box.h:46
The Element class.
Definition element.h:75
The Face class represents an Face element of the vcl::Mesh class.
Definition face.h:48
void eraseTTVNComponent(uint i)
Definition face.h:245
void resizeVertices(uint n)
Resize the number of Vertex Pointers of the Face, taking care of updating also the other components o...
Definition face.h:132
void setVertices(Rng &&r)
Sets all the Vertices to the face.
Definition face.h:84
Face()=default
Empty constructor.
void clearTTVNComponent()
Definition face.h:258
void pushBackTTVNComponent()
Definition face.h:219
void insertTTVNComponent(uint i)
Definition face.h:232
void setVertices(V... args)
Sets a list of Vertices to the face.
Definition face.h:110
void resizeTTVNComponent(uint n)
Definition face.h:206
A concept that checks whether a class has (inherits from) an Face class.
Definition face.h:295
A concpet that checks whether a class has (inherits from) a Face class and that the Face is polygonal...
Definition face.h:318
Evaluates to true if the type T is tied to the number of vertices in the face.
Definition component.h:126
SanityCheckAdjacentEdges concept.
Definition adjacent_edges.h:715
SanityCheckAdjacentFaces concept.
Definition adjacent_faces.h:719
SanityCheckWedgeColors concept.
Definition wedge_colors.h:380
SanityCheckWedgeTexCoords concept.
Definition wedge_tex_coords.h:444
Definition face_components.h:76
Definition face_components.h:104
Definition face_components.h:106
A simple structure that wraps a list of variadic templates, without instantiating anything....
Definition type_wrapper.h:39