RayZaler 0.1
The free opto-mechanical simulation framework
Map.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_MAP_H
20#define _SAMPLERS_MAP_H
21
22#include <Samplers/Sampler.h>
23#include <random>
24
25namespace RZ {
26 class MapSampler : public Sampler {
27 std::default_random_engine m_generator;
28 Real m_width = 1.;
29 Real m_pxToUnit = 1.;
30
31 unsigned m_stride = 1;
32
33 std::vector<Real> m_lambda;
34 unsigned int m_cols = 1, m_rows = 1;
35
36 void normalize();
37
38 protected:
39 virtual bool sampleRandom(std::vector<Vec3> &);
40 virtual bool sampleUniform(std::vector<Vec3> &);
41
42 public:
43 MapSampler();
44 MapSampler(std::string const &);
45
46 virtual void setRadius(Real R) override;
47 void setMap(
48 std::vector<Real> const &map,
49 unsigned int width,
50 unsigned int stride = 0);
51 void setFromPNG(std::string const &);
52 };
53}
54
55#endif // _SAMPLERS_PNG_H
Definition: Map.h:26
Definition: Sampler.h:27