105 Cloud(
const std::vector<float> &x,
106 const std::vector<float> &y,
107 float default_value = 0.f);
121 Cloud(
const std::vector<float> &x,
122 const std::vector<float> &y,
123 const std::vector<float> &v);
160 bool from_csv(
const std::string &fname);
257 virtual std::vector<float>
get_x()
const;
269 virtual std::vector<float>
get_xy()
const;
280 virtual std::vector<float>
get_y()
const;
348 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
373 void set_points(
const std::vector<float> &x,
const std::vector<float> &y);
384 void set_values(
const std::vector<float> &new_values);
408 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
425 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
462 void to_array(Array &array, Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f})
const;
492 Array *p_noise_x =
nullptr,
493 Array *p_noise_y =
nullptr,
494 Vec4<float> bbox_array = {0.f, 1.f, 0.f, 1.f})
const;
524 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f},
527 Array *p_noise_x =
nullptr,
528 Array *p_noise_y =
nullptr,
529 Vec4<float> bbox_array = {0.f, 1.f, 0.f, 1.f})
const;
539 void to_csv(
const std::string &fname)
const;
574 void to_png(
const std::string &fname,
576 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f},
578 Vec2<int> shape = {512, 512});
598Cloud
merge_cloud(
const Cloud &cloud1,
const Cloud &cloud2);
628 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
654 const Array &density,
656 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
683 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
712 const Array &density,
714 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
746 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
778 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
805 const Vec2<float> &jitter_amount,
806 const Vec2<float> &stagger_ratio,
808 const Vec4<float> &bbox = {0.f, 1.f, 0.f, 1.f});
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
unsigned int uint
Definition array.hpp:14
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:32
Represents a collection of unordered points in 2D space.
Definition cloud.hpp:55
Array to_array_sdf(Vec2< int > shape, Vec4< float > bbox, Array *p_noise_x=nullptr, Array *p_noise_y=nullptr, Vec4< float > bbox_array={0.f, 1.f, 0.f, 1.f}) const
Generate an array filled with the signed distance function (SDF) to the cloud points.
Definition cloud.cpp:465
std::vector< int > get_convex_hull_point_indices() const
Computes the indices of the points that form the convex hull of a set of points.
Definition cloud.cpp:154
void clear()
Clear all data from the cloud.
Definition cloud.cpp:64
void rejection_filter_density(const Array &density_mask, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Filter a point cloud using rejection sampling based on a density mask.
Definition cloud.cpp:305
Point get_center() const
Calculates the centroid of a set of points.
Definition cloud.cpp:146
void remap_values(float vmin, float vmax)
Remap the values of the cloud points to a target range.
Definition cloud.cpp:323
bool from_csv(const std::string &fname)
Loads point data from a CSV file into the Cloud object.
Definition cloud.cpp:69
size_t get_npoints() const
Get the number of points in the cloud.
Definition cloud.cpp:170
std::vector< float > get_values() const
Get the values assigned to the points in the cloud.
Definition cloud.cpp:175
void randomize(uint seed, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Randomize the positions and values of the cloud points.
Definition cloud.cpp:294
void set_values(const std::vector< float > &new_values)
Set new values for the cloud points.
Definition cloud.cpp:354
void set_points(const std::vector< float > &x, const std::vector< float > &y)
Set points of the using x, y coordinates.
Definition cloud.cpp:342
Cloud()
Default constructor for the Cloud class.
Definition cloud.hpp:64
Cloud(const std::vector< Point > &points)
Constructs a new Cloud object based on a list of existing points.
Definition cloud.hpp:91
void to_array_interp(Array &array, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, InterpolationMethod2D interpolation_method=InterpolationMethod2D::DELAUNAY, Array *p_noise_x=nullptr, Array *p_noise_y=nullptr, Vec4< float > bbox_array={0.f, 1.f, 0.f, 1.f}) const
Interpolate the values of an array using the cloud points.
Definition cloud.cpp:435
void to_png(const std::string &fname, int cmap, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, int depth=CV_8U, Vec2< int > shape={512, 512})
Saves the current data as a PNG image file.
Definition cloud.cpp:533
float get_values_min() const
Get the minimum value among the points in the cloud.
Definition cloud.cpp:192
virtual std::vector< float > get_x() const
Get the x coordinates of the points in the cloud.
Definition cloud.cpp:200
std::vector< Point > points
Points of the cloud.
Definition cloud.hpp:57
virtual std::vector< float > get_xy() const
Get the concatenated x and y coordinates of the points in the cloud.
Definition cloud.cpp:209
Vec4< float > get_bbox() const
Get the bounding box of the cloud.
Definition cloud.cpp:131
void add_point(const Point &p)
Add a new point to the cloud.
Definition cloud.cpp:59
std::vector< float > interpolate_values_from_array(const Array &array, Vec4< float > bbox)
Interpolate values from an array at the points' (x, y) locations.
Definition cloud.cpp:230
float get_values_max() const
Get the maximum value among the points in the cloud.
Definition cloud.cpp:184
virtual std::vector< float > get_y() const
Get the y coordinates of the points in the cloud.
Definition cloud.cpp:221
void set_values_from_array(const Array &array, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Set the values of the cloud points using values from an underlying array.
Definition cloud.cpp:369
void to_array(Array &array, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) const
Project the cloud points onto an array.
Definition cloud.cpp:417
void set_values_from_min_distance()
Sets point values based on the distance to their nearest neighbor.
Definition cloud.cpp:405
Graph to_graph_delaunay()
Convert the cloud to a graph using Delaunay triangulation.
Definition cloud.cpp:515
void set_values_from_chull_distance()
Set the values of the cloud points based on the distance to the convex hull of the cloud.
Definition cloud.cpp:386
void set_values_from_border_distance(const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Sets point values based on their distance to the bounding box border.
Definition cloud.cpp:375
void to_csv(const std::string &fname) const
Export the cloud data to a CSV file.
Definition cloud.cpp:501
void print()
Print information about the cloud's points.
Definition cloud.cpp:270
void remove_point(int point_idx)
Remove a point from the cloud.
Definition cloud.cpp:337
A class to represent and manipulate 2D points that can carry a value.
Definition point.hpp:38
Header file for 2D interpolation methods.
Definition algebra.hpp:28
Cloud random_cloud_distance(float min_dist, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Generates a random cloud of points separated by at least a given minimum distance.
Definition cloud.cpp:581
Cloud random_cloud_jittered(size_t count, const Vec2< float > &jitter_amount, const Vec2< float > &stagger_ratio, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Generates a jittered grid cloud of points.
Definition cloud.cpp:625
InterpolationMethod2D
Enumeration of 2D interpolation methods.
Definition interpolate2d.hpp:34
@ DELAUNAY
Delaunay triangulation method for 2D interpolation.
Definition interpolate2d.hpp:35
Cloud random_cloud_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 a random cloud of points with distances drawn from a power-law distribution.
Definition cloud.cpp:599
Cloud random_cloud_density(size_t count, const Array &density, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Generates a random cloud of points based on a spatial density map.
Definition cloud.cpp:571
Cloud random_cloud(size_t count, uint seed, const PointSamplingMethod &method=PointSamplingMethod::RND_LHS, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Generates a random cloud of points within a bounding box.
Definition cloud.cpp:561
PointSamplingMethod
Enumeration of point sampling methods.
Definition point_sampling.hpp:31
@ RND_LHS
Latin Hypercube Sampling.
Definition point_sampling.hpp:35
Cloud merge_cloud(const Cloud &cloud1, const Cloud &cloud2)
Merges two point clouds into one.
Definition cloud.cpp:544
Cloud random_cloud_distance_weibull(float dist_min, float lambda, float k, uint seed, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f})
Generates a random cloud of points with distances drawn from a Weibull distribution.
Definition cloud.cpp:614
Defines a class for representing and manipulating 3D points.
Vec4 class for basic manipulation of 4D vectors.
Definition algebra.hpp:564