52 std::uint32_t seed = 0,
73 glm::vec2
sample(
float u,
float u2);
81 std::array<std::vector<float>, 2>
sample(
size_t count);
106 glm::vec2
sample(
const BBox2D &restricted_bbox,
float u,
float u2);
121 const glm::ivec2 &range_i,
122 const glm::ivec2 &range_j);
134 const std::function<
float(
int i,
int j,
float current)> &updater,
135 const glm::ivec2 &range_i,
136 const glm::ivec2 &range_j);
146 std::uint32_t seed = 0,
180 BBox2D bbox_ = BBox2D{};
181 std::vector<float> row_sums_;
182 std::vector<float> r_cdf_;
183 std::mt19937 rng_{0};
184 std::uniform_real_distribution<float> dist_{0.f, 1.f};
187 void update_row_cdf_from(
int jmin);
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Axis-aligned 2D bounding box in world coordinates.
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:31
void set_seed(std::uint32_t seed)
Sets the RNG seed.
Definition inverse_sampler_2d.cpp:341
void set_bbox(const BBox2D &bbox)
Sets the bounding box.
Definition inverse_sampler_2d.cpp:336
InverseSampler2D()=default
const BBox2D & get_bbox() const
Gets the bounding box.
Definition inverse_sampler_2d.cpp:30
glm::vec2 sample()
Samples a single point sequentially using the internal RNG.
Definition inverse_sampler_2d.cpp:83
const Array & get_density() const
Gets the current density array.
Definition inverse_sampler_2d.cpp:35
float get_total_weight() const
Gets the total integrated weight.
Definition inverse_sampler_2d.cpp:40
void reset(const Array &density, std::uint32_t seed=0, const BBox2D &bbox=BBox2D{})
Reinitializes the sampler with a new density array.
Definition inverse_sampler_2d.cpp:73
void update_region(const Array &updated_array, const glm::ivec2 &range_i, const glm::ivec2 &range_j)
Updates the density in the sub-region [imin, imax] x [jmin, jmax] from another array.
Definition inverse_sampler_2d.cpp:346
Axis-aligned 2D bounding box in world coordinates.
Definition bbox2d.hpp:25