19#include "point_sampler.hpp"
44static std::map<std::string, int> point_sampling_method_as_string = {
64std::array<std::pair<float, float>, 2>
bbox_to_ranges2d(
const glm::vec4 &bbox);
75 std::vector<float> &y,
76 std::vector<float> &value,
77 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
89 std::vector<float> &y,
90 std::vector<float> &value,
91 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
92 float boundary_value = 0.f);
104 std::vector<float> &y,
105 std::vector<float> &value,
106 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
107 float corner_value = 0.f);
135std::function<float(
const ps::Point<float, 2> &)>
155 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
173 const Array &density,
175 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
193 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
214 const Array &density,
216 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
239 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
262 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
281 const glm::vec2 &jitter_amount,
282 const glm::vec2 &stagger_ratio,
284 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
294 std::vector<float> &y,
295 std::vector<float> &value,
296 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
306 std::vector<float> &y,
unsigned int uint
Definition array.hpp:14
Defines modular function objects for procedural generation, including noise algorithms (Perlin,...
Definition algebra.hpp:22
std::function< float(const ps::Point< float, 2 > &)> make_pointwise_function_from_array(const Array &array, const glm::vec4 &bbox)
Create a continuous 2D function from a sampled array.
Definition point_sampling.cpp:26
void rescale_points_to_unit_square(std::vector< float > &x, std::vector< float > &y, glm::vec4 bbox)
Rescale coordinate (x, y) so that they fit in a unit-square box based on a given initial bounding box...
Definition grid.cpp:139
void expand_points_domain(std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Expand grid by translating and copying the values of the current bounding box to the 8 first neighbor...
Definition grid.cpp:27
void expand_points_domain_corners(std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, float corner_value=0.f)
Expand the grid by adding four points at the corner of the bounding box.
Definition grid.cpp:89
std::array< std::vector< float >, 2 > random_points_distance(float min_dist, uint seed, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates random 2D points with a minimum separation distance.
Definition point_sampling.cpp:103
std::array< std::vector< float >, 2 > random_points_distance_weibull(float dist_min, float lambda, float k, uint seed, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates random 2D points with distances drawn from a Weibull distribution.
Definition point_sampling.cpp:160
void expand_points_at_domain_boundaries(std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, float boundary_value=0.f)
Expand the grid by adding points on the boundaries of the bounding box.
Definition grid.cpp:55
void remove_points_outside_bbox(std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Remove grid points that are outside a given bounding box.
std::array< std::vector< float >, 2 > random_points(size_t count, uint seed, const PointSamplingMethod &method=PointSamplingMethod::RND_RANDOM, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates random 2D points within a bounding box using a sampling method.
Definition point_sampling.cpp:48
PointSamplingMethod
Enumeration of point sampling methods.
Definition point_sampling.hpp:31
@ RND_LHS
Latin Hypercube Sampling.
Definition point_sampling.hpp:35
@ RND_HALTON
Low-discrepancy Halton sequence sampling.
Definition point_sampling.hpp:33
@ RND_RANDOM
Purely random uniform sampling.
Definition point_sampling.hpp:32
@ RND_HAMMERSLEY
Low-discrepancy Hammersley sequence sampling.
Definition point_sampling.hpp:34
std::array< std::vector< float >, 2 > random_points_distance_power_law(float dist_min, float dist_max, float alpha, uint seed, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates random 2D points with distances drawn from a power-law distribution.
Definition point_sampling.cpp:141
std::array< std::vector< float >, 2 > random_points_density(size_t count, const Array &density, uint seed, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates random 2D points within a bounding box based on a density map.
Definition point_sampling.cpp:88
std::array< std::pair< float, float >, 2 > bbox_to_ranges2d(const glm::vec4 &bbox)
Converts a 2D bounding box into coordinate ranges.
Definition point_sampling.cpp:17
std::array< std::vector< float >, 2 > random_points_jittered(size_t count, const glm::vec2 &jitter_amount, const glm::vec2 &stagger_ratio, uint seed, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generates jittered grid-based 2D points.
Definition point_sampling.cpp:179
Defines a class for representing and manipulating 3D points.