HighMap library (C++)
Loading...
Searching...
No Matches
point_sampling.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  hmap

Enumerations

enum  hmap::PointSamplingMethod : int { hmap::RND_RANDOM , hmap::RND_HALTON , hmap::RND_HAMMERSLEY , hmap::RND_LHS }
 Enumeration of point sampling methods. More...

Functions

std::array< std::pair< float, float >, 2 > hmap::bbox_to_ranges2d (const BBox2D &bbox)
 Converts a 2D bounding box into coordinate ranges.
void hmap::expand_points_domain (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, const BBox2D &bbox=BBox2D{})
 Expand grid by translating and copying the values of the current bounding box to the 8 first neighboring bounding boxes.
void hmap::expand_points_at_domain_boundaries (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, const BBox2D &bbox=BBox2D{}, float boundary_value=0.f)
 Expand the grid by adding points on the boundaries of the bounding box.
void hmap::expand_points_domain_corners (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, const BBox2D &bbox=BBox2D{}, float corner_value=0.f)
 Expand the grid by adding four points at the corner of the bounding box.
std::function< float(const ps::Point< float, 2 > &)> hmap::make_pointwise_function_from_array (const Array &array, const BBox2D &bbox)
 Create a continuous 2D function from a sampled array.
std::array< std::vector< float >, 2 > hmap::random_points (size_t count, std::uint32_t seed, const PointSamplingMethod &method=PointSamplingMethod::RND_RANDOM, const BBox2D &bbox=BBox2D{})
 Generates random 2D points within a bounding box using a sampling method.
std::array< std::vector< float >, 2 > hmap::random_points_density (size_t count, const Array &density, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points within a bounding box based on a density map.
std::array< std::vector< float >, 2 > hmap::random_points_inverse_sampling (size_t count, const Array &array, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points within a bounding box using inverse transform sampling on a 2D density array.
std::array< std::vector< float >, 2 > hmap::random_points_distance (float min_dist, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points with a minimum separation distance.
std::array< std::vector< float >, 2 > hmap::random_points_distance (float min_dist, float max_dist, const Array &density, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points with distance constraints and a density map.
std::array< std::vector< float >, 2 > hmap::random_points_distance_power_law (float dist_min, float dist_max, float alpha, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points with distances drawn from a power-law distribution.
std::array< std::vector< float >, 2 > hmap::random_points_distance_weibull (float dist_min, float lambda, float k, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates random 2D points with distances drawn from a Weibull distribution.
std::array< std::vector< float >, 2 > hmap::random_points_jittered (size_t count, const glm::vec2 &jitter_amount, const glm::vec2 &stagger_ratio, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates jittered grid-based 2D points.
void hmap::remove_points_outside_bbox (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, const BBox2D &bbox=BBox2D{})
 Remove grid points that are outside a given bounding box.
void hmap::rescale_points_to_unit_square (std::vector< float > &x, std::vector< float > &y, const BBox2D &bbox)
 Rescale coordinate (x, y) so that they fit in a unit-square box based on a given initial bounding box.

Detailed Description