23#ifndef VCL_ALGORITHMS_MESH_SHUFFLE_H
24#define VCL_ALGORITHMS_MESH_SHUFFLE_H
26#include <vclib/mesh/requirements.h>
27#include <vclib/misc/shuffle.h>
39template<
typename M,
typename V>
40std::vector<V*> genericFASVPV(M m,
bool deterministic)
43 vec.reserve(m.vertexNumber());
60template<
typename M,
typename F>
61std::vector<F*> genericFASFPV(M m,
bool deterministic)
64 vec.reserve(m.faceNumber());
66 for (F& f : m.
faces()) {
77template<MeshConcept MeshType>
78std::vector<typename MeshType::VertexType*> fillAndShuffleVertexPointerVector(
80 bool deterministic =
false)
82 using VertexType = MeshType::VertexType;
84 return detail::genericFASVPV<MeshType&, VertexType>(m, deterministic);
87template<MeshConcept MeshType>
88std::vector<const typename MeshType::VertexType*>
89fillAndShuffleVertexPointerVector(
const MeshType& m,
bool deterministic =
false)
91 using VertexType = MeshType::VertexType;
92 return detail::genericFASVPV<const MeshType&, const VertexType>(
96template<MeshConcept MeshType>
97std::vector<uint> fillAndShuffleVertexIndexVector(
99 bool deterministic =
false)
101 using VertexType = MeshType::VertexType;
103 std::vector<uint> vec;
104 vec.reserve(m.vertexNumber());
106 for (
const VertexType& v : m.
vertices()) {
107 vec.push_back(m.index(v));
115template<FaceMeshConcept MeshType>
116std::vector<typename MeshType::FaceType*> fillAndShuffleFacePointerVector(
118 bool deterministic =
false)
120 using FaceType = MeshType::FaceType;
122 return detail::genericFASFPV<MeshType&, FaceType>(m, deterministic);
125template<FaceMeshConcept MeshType>
126std::vector<const typename MeshType::FaceType*> fillAndShuffleFacePointerVector(
128 bool deterministic =
false)
130 using FaceType = MeshType::FaceType;
132 return detail::genericFASFPV<const MeshType&, const FaceType>(
136template<FaceMeshConcept MeshType>
137std::vector<uint> fillAndShuffleFaceIndexVector(
139 bool deterministic =
false)
141 using FaceType = MeshType::FaceType;
143 std::vector<uint> vec;
144 vec.reserve(m.faceNumber());
146 for (
const FaceType& f : m.
faces()) {
147 vec.push_back(m.index(f));
void shuffle(R &&range, bool deterministic=false)
Shuffle the elements of a range.
Definition shuffle.h:43
constexpr detail::FacesView faces
A view that allows to iterate overt the Face elements of an object.
Definition face.h:52
constexpr detail::VerticesView vertices
A view that allows to iterate over the Vertex elements of an object.
Definition vertex.h:60