18 #ifndef PIC_POINT_SAMPLERS_SAMPLER_DART_THROWING_HPP 19 #define PIC_POINT_SAMPLERS_SAMPLER_DART_THROWING_HPP 23 #include "../util/vec.hpp" 24 #include "../util/math.hpp" 37 template<
unsigned int N>
39 std::vector<float> &samples)
47 for(
unsigned int j = 0; j < N; j++) {
48 val[j] = (
getRandom((*m)()) * 2.0f - 1.0f);
53 for(
unsigned int i = 0; i < samples.size(); i += N) {
56 for(
unsigned int j = 0; j < N; j++) {
57 delta = val[j] - samples[i + j];
58 dist2 += delta * delta;
61 bFlag = dist2 >= radius2;
70 for(
unsigned int j = 0; j < N; j++) {
71 samples.push_back(val[j]);
const int CONST_DARTTHROWING
Definition: sampler_dart_throwing.hpp:28
void getDartThrowingSamples(std::mt19937 *m, float radius2, int nSamples, std::vector< float > &samples)
getDartThrowingSamples
Definition: sampler_dart_throwing.hpp:38
Definition: bilateral_separation.hpp:25
PIC_INLINE float getRandom(unsigned int n)
Random returns a number in [0, 2^32 - 1] to a float in [0, 1].
Definition: math.hpp:138
T lengthSq()
lengthSq
Definition: vec.hpp:335
The Vec class.
Definition: vec.hpp:35