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

Definition of the Cloud class for manipulating sets of 2D points. More...

Go to the source code of this file.

Classes

class  hmap::Cloud
 Represents a collection of unordered points in 2D space. More...

Namespaces

namespace  hmap

Enumerations

enum class  hmap::ArraySampling : int { hmap::AS_POINT , hmap::AS_MIN , hmap::AS_MAX , hmap::AS_MEAN }
 Strategy used to extract a point value from an array. More...

Functions

Array hmap::cloud_sdf_to_array (const Cloud &cloud, glm::ivec2 shape, const BBox2D &bbox_array=BBox2D::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
 Compute a distance field from a point cloud.
bool hmap::has_duplicates (const Cloud &cloud, float eps=1e-9f, bool xy_only=true)
 Checks whether the point cloud contains duplicate points.
std::vector< float > hmap::interpolate_values_from_array (const Cloud &cloud, const Array &array, const BBox2D &bbox)
 Interpolate values from an array at the points' (x, y) locations.
Cloud hmap::merge_cloud (const Cloud &cloud1, const Cloud &cloud2)
 Merges two point clouds into one.
Cloud hmap::merge_clouds (const std::vector< Cloud > &clouds)
 Merges multiple point clouds into a single cloud.
Cloud hmap::random_cloud (size_t count, std::uint32_t seed, const PointSamplingMethod &method=PointSamplingMethod::RND_LHS, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points within a bounding box.
Cloud hmap::random_cloud_density (size_t count, const Array &density, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points based on a spatial density map.
Cloud hmap::random_cloud_inverse_sampling (size_t count, const Array &density, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points using inverse transform sampling on a 2D density array.
Cloud hmap::random_cloud_distance (float min_dist, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points separated by at least a given minimum distance.
Cloud hmap::random_cloud_distance (float min_dist, float max_dist, const Array &density, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points separated by a distance range, influenced by a density map.
Cloud hmap::random_cloud_distance_power_law (float dist_min, float dist_max, float alpha, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points with distances drawn from a power-law distribution.
Cloud hmap::random_cloud_distance_weibull (float dist_min, float lambda, float k, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a random cloud of points with distances drawn from a Weibull distribution.
Cloud hmap::random_cloud_jittered (size_t count, const glm::vec2 &jitter_amount, const glm::vec2 &stagger_ratio, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Generates a jittered grid cloud of points.
void hmap::rejection_filter_density (Cloud &cloud, const Array &density_mask, std::uint32_t seed, const BBox2D &bbox=BBox2D{})
 Filter a point cloud using rejection sampling based on a density mask.
Cloud hmap::scale (const Cloud &cloud, glm::vec2 scale, glm::vec2 center={0.5f, 0.5f})
 Scales the point coordinates in a cloud relative to a center point.
Cloud hmap::scale (const Cloud &cloud, float scale, glm::vec2 center={0.5f, 0.5f})

Detailed Description

Definition of the Cloud class for manipulating sets of 2D points.

This file contains the definition of the Cloud class, which is used to manage and manipulate unordered sets of points in a 2D space. The Cloud class provides functionalities for creating clouds of points, including random generation, value assignment, and data export. It also supports operations such as computing bounding boxes, distances, and interpolating values from arrays.

The class includes methods for adding and removing points, randomizing positions and values, remapping values, and exporting data to CSV files. Additional functionalities include calculating Signed Distance Functions (SDF) and projecting point clouds onto arrays.