Represents an ordered set of points in 2D, forming a polyline (open or closed).
More...
|
| | Path ()=default |
| | Construct a new Path object with default properties. Initializes an empty path with the closed property set to false.
|
| | Path (const Cloud &cloud) |
| | Construct a new Path object based on a cloud of points.
|
| | Path (Cloud &&cloud) noexcept |
| | Move-construct a new Path object based on a cloud of points.
|
| | Path (int npoints, std::uint32_t seed, const BBox2D &bbox=BBox2D{}) |
| | Construct a new Path object with random positions and values. Initializes a path with a specified number of points, random values, and the option to be open or closed.
|
| | Path (const std::vector< Point > &points) |
| | Construct a new Path object based on a list of points. Initializes a path with the specified points and an option to be open or closed.
|
| | Path (std::vector< Point > &&points) noexcept |
| | Move-construct a new Path object based on a list of points.
|
| | Path (const std::vector< float > &x, const std::vector< float > &y) |
| | Construct a new Path object based on x and y coordinates. Initializes a path with the specified x and y coordinates and an option to be open or closed.
|
| | Path (const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &v) |
| | Construct a new Path object based on x, y coordinates, and values. Initializes a path with the specified x and y coordinates, associated values, and an option to be open or closed.
|
| | Path (const std::vector< glm::ivec2 > &indices, const glm::ivec2 &shape, const BBox2D &bbox=BBox2D{}) |
| | Construct a point cloud from grid indices mapped to a bounding box.
|
| | Path (const std::vector< glm::vec3 > &xyv) |
| | Constructs a new Path object from lists of xyz data as glm::vec3.
|
| std::vector< float > | get_arc_length () const |
| | Get the arc length of the path.
|
| std::vector< float > | get_cumulative_distance () const |
| | Get the cumulative distance of the path.
|
| std::vector< float > | get_curvature (bool normalized=false) const |
| | Computes the signed curvature at each point of the path.
|
| std::vector< Point > | get_edge_centers () const |
| | Compute midpoints of path edges.
|
| std::vector< glm::vec2 > | get_normals () const |
| | Computes unit normals at each point of the path.
|
| std::vector< glm::vec2 > | get_tangents () const |
| | Computes unit tangents at each point of the path.
|
| std::vector< float > | get_values () const |
| | Get the values assigned to the points on the path.
|
| std::vector< float > | get_x () const |
| | Get the x coordinates of the points on the path.
|
| std::vector< float > | get_xy () const |
| | Get the coordinates of the points as a single vector.
|
| std::vector< float > | get_y () const |
| | Get the y coordinates of the points on the path.
|
| bool | is_closed () const |
| | Check whether the path is closed.
|
| void | set_closed (bool new_value) |
| | Set whether the path is closed.
|
| void | clear () |
| | Clear the path data.
|
| void | enforce_monotonic_values (bool decreasing=true) |
| | Enforces monotonicity on the values of the points in the path.
|
| void | rasterize_capsules (Array &out_dist_sq, float radius, const BBox2D &bbox=BBox2D{}) const |
| | Rasterize path segments as capsules with a given radius onto a distance map.
|
| void | reorder_nns (int start_index=0) |
| | Reorder points using a nearest neighbor search.
|
| void | reverse () |
| | Reverse the order of points in the path.
|
| void | divide () |
| | Divide the path by adding a point between each pair of consecutive points.
|
| void | resample_by_spacing (float delta, InterpolationMethod1D itp_method=InterpolationMethod1D::LINEAR) |
| | Resample the path to achieve an approximately constant distance between points.
|
| void | resample_interp (int npoints, InterpolationMethod1D itp_method=InterpolationMethod1D::CUBIC) |
| | Resamples the path using cubic interpolation along arc length.
|
| void | resample_uniform (InterpolationMethod1D itp_method=InterpolationMethod1D::LINEAR) |
| | Resample the path to achieve fairly uniform distance between consecutive points.
|
| glm::vec3 | sample_at (float t, const std::vector< float > *p_arc=nullptr, glm::vec2 *p_tangent=nullptr) const |
| | Sample the path using normalized arc-length parameterization.
|
| void | subsample (int step) |
| | Subsample the path by keeping only every n-th point.
|
| void | to_array (Array &array, const BBox2D &bbox=BBox2D{}, bool filled=false) const |
| | Project path points to an array.
|
| Array | to_array (glm::ivec2 shape, const BBox2D &bbox=BBox2D{}, bool filled=false) const |
| | See hmap::to_array.
|
| void | to_array_mask (Array &array, const BBox2D &bbox=BBox2D{}, bool filled=false) const |
| | See hmap::to_array.
|
| void | to_png (std::string fname, glm::ivec2 shape={512, 512}) |
| | Export path as PNG image file.
|
| | Cloud () |
| | Default constructor for the Cloud class.
|
| virtual | ~Cloud ()=default |
| | Cloud (int npoints, std::uint32_t seed, const BBox2D &bbox=BBox2D{}) |
| | Constructs a new Cloud object with random positions and values.
|
| | Cloud (const std::vector< Point > &points) |
| | Constructs a new Cloud object based on a list of existing points.
|
| | Cloud (std::vector< Point > &&points) noexcept |
| | Move-constructs a new Cloud object from an existing points vector.
|
| | Cloud (const std::vector< float > &x, const std::vector< float > &y, float default_value=0.f) |
| | Constructs a new Cloud object from lists of x and y coordinates.
|
| | Cloud (const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &v) |
| | Constructs a new Cloud object from lists of x and y coordinates with assigned values.
|
| | Cloud (const std::vector< glm::ivec2 > &indices, const glm::ivec2 &shape, const BBox2D &bbox=BBox2D{}) |
| | Construct a point cloud from grid indices mapped to a bounding box.
|
| | Cloud (const std::vector< glm::vec3 > &xyv) |
| | Constructs a new Cloud object from lists of xyz data as glm::vec3.
|
| BBox2D | get_bbox () const |
| | Get the bounding box of the cloud.
|
| Point | get_center () const |
| | Calculates the centroid of a set of points.
|
| std::vector< int > | get_convex_hull () const |
| | Computes the indices of the points that form the convex hull of a set of points.
|
| std::vector< float > | get_values () const |
| | Get the values assigned to the points in the cloud.
|
| float | get_values_max () const |
| | Get the maximum value among the points in the cloud.
|
| float | get_values_min () const |
| | Get the minimum value among the points in the cloud.
|
| std::vector< float > | get_x () const |
| | Get the x coordinates of the points in the cloud.
|
| std::vector< float > | get_xy () const |
| | Get the concatenated x and y coordinates of the points in the cloud.
|
| std::vector< float > | get_y () const |
| | Get the y coordinates of the points in the cloud.
|
| size_t | nearest_point (const glm::vec2 &xy) const |
| | Find the index of the nearest point in the cloud.
|
| void | set_points (const std::vector< float > &x, const std::vector< float > &y) |
| | Set points of the using x, y coordinates.
|
| void | set_values (const std::vector< float > &new_values) |
| | Set new values for the cloud points.
|
| void | set_values (float new_value) |
| | Set a single value for all cloud points.
|
| void | set_values_from_array (const Array &array, const BBox2D &bbox=BBox2D{}) |
| | Set the values of the cloud points using values from an underlying array.
|
| void | set_values_from_array (const Array &array, ArraySampling sampling, float radius=0.f, const BBox2D &bbox=BBox2D{}) |
| | Set the values of the cloud points from an array, using a given sampling strategy.
|
| void | set_values_from_border_distance (const BBox2D &bbox=BBox2D{}) |
| | Sets point values based on their distance to the bounding box border.
|
| void | set_values_from_chull_distance () |
| | Set the values of the cloud points based on the distance to the convex hull of the cloud.
|
| void | set_values_from_min_distance () |
| | Sets point values based on the distance to their nearest neighbor.
|
| Point & | operator[] (size_t index) |
| | Access point by index.
|
| const Point & | operator[] (size_t index) const |
| | Access point by index (const).
|
| Point & | at (size_t index) |
| | Access point with bounds checking.
|
| const Point & | at (size_t index) const |
| | Access point with bounds checking (const).
|
| Point & | back () |
| | Access the last point.
|
| const Point & | back () const |
| | Access the last point (const).
|
| std::vector< Point >::iterator | begin () noexcept |
| | Returns an iterator to the first point.
|
| std::vector< Point >::const_iterator | begin () const noexcept |
| | Returns a const iterator to the first point.
|
| size_t | capacity () const noexcept |
| | Returns the number of points that can be held in currently allocated storage.
|
| std::vector< Point >::const_iterator | cbegin () const noexcept |
| | Returns a const iterator to the first point.
|
| std::vector< Point >::const_iterator | cend () const noexcept |
| | Returns a const iterator to the end.
|
| void | clear () |
| | Clear all data from the cloud.
|
| Point * | data () noexcept |
| | Direct pointer to the underlying point array.
|
| const Point * | data () const noexcept |
| | Direct pointer to the underlying point array (const).
|
| void | emplace_back (float x, float y, float v=0.f) |
| | Appends a new point in-place.
|
| bool | empty () const |
| | Check whether the cloud has no points.
|
| std::vector< Point >::iterator | end () noexcept |
| | Returns an iterator to the end.
|
| std::vector< Point >::const_iterator | end () const noexcept |
| | Returns a const iterator to the end.
|
| std::vector< Point >::iterator | erase (std::vector< Point >::const_iterator pos) |
| | Erases the point at the specified position.
|
| std::vector< Point >::iterator | erase (std::vector< Point >::const_iterator first, std::vector< Point >::const_iterator last) |
| | Erases the range of points [first, last).
|
| Point & | front () |
| | Access the first point.
|
| const Point & | front () const |
| | Access the first point (const).
|
| std::vector< Point >::iterator | insert (std::vector< Point >::const_iterator pos, const Point &value) |
| | Inserts a point before pos.
|
| std::vector< Point >::iterator | insert (std::vector< Point >::const_iterator pos, Point &&value) |
| | Inserts a point before pos (move).
|
| template<typename InputIt> |
| std::vector< Point >::iterator | insert (std::vector< Point >::const_iterator pos, InputIt first, InputIt last) |
| | Inserts elements from range [first, last) before pos.
|
| void | pop_back () |
| | Removes the last point.
|
| void | push_back (const Point &p) |
| | Appends a point.
|
| void | push_back (Point &&p) |
| | Appends a point (move).
|
| void | reserve (size_t new_cap) |
| | Reserves storage for at least the specified number of points.
|
| size_t | size () const |
| | Get the number of points in the cloud.
|
| void | print () const |
| | Print information about the cloud's points.
|
| void | randomize (std::uint32_t seed, const BBox2D &bbox=BBox2D{}) |
| | Randomize the positions and values of the cloud points.
|
| void | remap_values (float vmin, float vmax) |
| | Remap the values of the cloud points to a target range.
|
| void | shuffle (float dx, float dy, std::uint32_t seed, float dv=0.f) |
| | Randomly perturbs the positions and values of all points in the cloud.
|
| void | snap_points_to_bounding_box (const BBox2D &bbox=BBox2D{}, float tolerance_ratio=1.f) |
| | Snap points to the bounding box edges and corners.
|
| bool | from_csv (const std::string &fname) |
| | Loads point data from a CSV file into the Cloud object.
|
| void | to_array (Array &array, const BBox2D &bbox=BBox2D{}) const |
| | Project the cloud points onto an array.
|
| Array | to_array (glm::ivec2 shape, const BBox2D &bbox) const |
| | See hmap::to_array.
|
| void | to_array_interp (Array &array, const BBox2D &bbox=BBox2D{}, InterpolationMethod2D interpolation_method=InterpolationMethod2D::ITP2D_DELAUNAY, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const BBox2D &bbox_array=BBox2D{}) const |
| | Interpolate the values of an array using the cloud points.
|
| void | to_csv (const std::string &fname) const |
| | Export the cloud data to a CSV file.
|
| Graph | to_graph_delaunay () const |
| | Convert the cloud to a graph using Delaunay triangulation.
|
| void | to_png (const std::string &fname, int cmap, const BBox2D &bbox=BBox2D{}, int depth=0, glm::ivec2 shape={512, 512}) const |
| | Saves the current data as a PNG image file.
|
| std::vector< glm::vec3 > | to_vec3 () const |
| | Convert path points to a vector of 3D positions.
|