37 std::vector<PointT> mSamples;
40 using PointType = PointT;
41 using ScalarType = PointT::ScalarType;
42 using ConstIterator = std::vector<PointT>::const_iterator;
46 const std::vector<PointT>& samples()
const {
return mSamples; }
48 const PointT& sample(
uint i)
const {
return mSamples[
i]; }
50 std::size_t size()
const {
return mSamples.size(); }
52 void clear() { mSamples.clear(); }
54 void reserve(
uint n) { mSamples.reserve(
n); }
56 void resize(
uint n) { mSamples.resize(
n); }
58 void add(
const PointT&
p) { mSamples.push_back(
p); }
60 void set(
uint i,
const PointT&
p) { mSamples[
i] =
p; }
62 template<VertexConcept VertexType>
63 void add(
const VertexType& v)
65 mSamples.push_back(v.coord());
68 template<VertexConcept VertexType>
69 void set(
uint i,
const VertexType& v)
71 mSamples[
i] = v.coord();
74 template<EdgeConcept EdgeType>
75 void add(
const EdgeType& e,
double u = 0.5)
78 (e.vertex(0).coord() * (1 - u)) + (e.vertex(1).coord() * u));
81 template<EdgeConcept EdgeType>
82 void set(
uint i,
const EdgeType& e,
double u = 0.5)
85 (e.vertex(0).coord() * (1 - u)) + (e.vertex(1).coord() * u);
88 template<FaceConcept FaceType>
89 void add(
const FaceType& f)
94 template<FaceConcept FaceType>
95 void set(
uint i,
const FaceType& f)
100 template<FaceConcept FaceType>
101 void add(
const FaceType& f,
const std::vector<ScalarType>&
barCoords)
106 for (
uint i = 0;
i < f.vertexNumber();
i++)
109 mSamples.push_back(
p);
112 template<FaceConcept FaceType>
116 const std::vector<ScalarType>&
barCoords)
121 for (
uint i = 0;
i < f.vertexNumber();
i++)
127 template<FaceConcept FaceType>
128 void add(
const FaceType& f,
const PointT&
barCoords)
130 static_assert(FaceType::NV == 3 || FaceType::NV == -1);
131 if constexpr (FaceType::NV == -1) {
132 assert(f.vertexNumber() == 3);
137 mSamples.push_back(
p);
140 template<FaceConcept FaceType>
143 static_assert(FaceType::NV == 3 || FaceType::NV == -1);
144 if constexpr (FaceType::NV == -1) {
145 assert(f.vertexNumber() == 3);
153 ConstIterator begin()
const {
return mSamples.begin(); }
155 ConstIterator end()
const {
return mSamples.end(); }
FaceType::VertexType::CoordType faceBarycenter(const FaceType &f)
Computes the barycenter of a face. Works both for triangle and polygonal faces, and it is optimized i...
Definition geometry.h:77