RayZaler 0.1
The free opto-mechanical simulation framework
Sampler.h
1//
2// Copyright (c) 2024 Gonzalo José Carracedo Carballal
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as
6// published by the Free Software Foundation, either version 3 of the
7// License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this program. If not, see
16// <http://www.gnu.org/licenses/>
17//
18
19#ifndef _SAMPLERS_SAMPLER_H
20#define _SAMPLERS_SAMPLER_H
21
22#include <Vector.h>
23#include <Matrix.h>
24#include <vector>
25
26namespace RZ {
27 class Sampler {
28 bool m_random = false;
29 std::vector<Vec3> m_samples;
30 unsigned int m_ptr = 0;
31
32 bool ensureSamples(unsigned int N);
33
34 protected:
35 virtual bool sampleRandom(std::vector<Vec3> &) = 0;
36 virtual bool sampleUniform(std::vector<Vec3> &) = 0;
37
38 public:
39 virtual void setRadius(Real) = 0;
40 void setRandom(bool);
41 void reset();
42
43 bool sample(std::vector<Vec3> &dest);
44 bool sample(std::vector<Vec3> &dest, Matrix3 const &sys, Vec3 const &center);
45
46 bool sample(unsigned int N);
47 bool get(Vec3 &dest);
48 bool get(Vec3 &dest, Matrix3 const &sys, Vec3 const &center);
49 Vec3 &get();
50 };
51}
52
53#endif // _SAMPLERS_SAMPLER_H
Definition: Sampler.h:27
Definition: Matrix.h:48
Definition: Vector.h:66