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 Vec4< float > &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, Vec4< float > 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 neighboring bounding boxes.
 
void hmap::expand_points_at_domain_boundaries (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, Vec4< float > 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.
 
void hmap::expand_points_domain_corners (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, Vec4< float > 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.
 
std::function< float(const ps::Point< float, 2 > &)> hmap::make_pointwise_function_from_array (const Array &array, const Vec4< float > &bbox)
 Create a continuous 2D function from a sampled array.
 
std::array< std::vector< float >, 2 > hmap::random_points (size_t count, uint seed, const PointSamplingMethod &method=PointSamplingMethod::RND_RANDOM, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 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, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 Generates random 2D points within a bounding box based on a density map.
 
std::array< std::vector< float >, 2 > hmap::random_points_distance (float min_dist, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 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, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 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, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 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, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 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 hmap::Vec2< float > &jitter_amount, const hmap::Vec2< float > &stagger_ratio, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
 Generates jittered grid-based 2D points.
 
void hmap::remove_points_outside_bbox (std::vector< float > &x, std::vector< float > &y, std::vector< float > &value, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
 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, Vec4< float > bbox)
 Rescale coordinate (x, y) so that they fit in a unit-square box based on a given initial bounding box.
 

Detailed Description

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)

This software is distributed under the terms of the GNU General Public License. The full license is in the file LICENSE, distributed with this software.