|
HighMap library (C++)
|
Represents a drainage basin network constructed on a 3D terrain mesh. More...
#include <drainage_basin.hpp>
Public Member Functions | |
| DrainageBasin (std::vector< glm::vec3 > xyz_) | |
| Construct a new Drainage Basin object. | |
| const std::vector< glm::vec3 > & | get_xyz () const |
| Get the 3D coordinates of the terrain vertices. | |
| size_t | size () const |
| Get the number of vertices in the basin. | |
| void | to_csv (const std::string &filename) const |
| Export the drainage basin data to a CSV file. | |
| const TerrainTriMesh & | get_mesh () const |
| Get the underlying terrain tri mesh (const). | |
| TerrainTriMesh & | get_mesh () |
| Get the underlying terrain tri mesh (non-const). | |
| std::vector< float > | compute_vertex_areas () const |
| Compute the area of each vertex in the mesh. | |
| void | remap (float zmin=0.f, float zmax=1.f) |
| Remap the elevation (z) values of the mesh vertices to a target range. | |
| void | compute_receivers () |
| Compute the flow receiver for each vertex deterministically. | |
| void | compute_receivers (unsigned int seed, float noise_strength=0.25f) |
| Compute the flow receiver for each vertex with noise for stochastic variations. | |
| void | update_stream_tree (unsigned int seed, float noise_strength) |
| Update the stream tree stochastically. | |
| void | update_stream_tree () |
| Update the stream tree deterministically. | |
| void | update_traversals () |
| Update cached traversal orders for upstream/downstream computations. | |
| std::vector< size_t > & | get_outlets () const |
| Get the indices of the outlets in the basin. | |
| void | set_outlets (const std::vector< size_t > &outlet_indices) |
| Set the outlets of the basin. | |
| const std::vector< size_t > & | get_receivers () const |
| Get the receiver index of each vertex. | |
| void | invert_receiver_map () |
| Invert the receiver map to build a map of children/downstream receivers. | |
| std::vector< bool > | compute_is_ridge_node () const |
| Compute whether each vertex is a ridge node (no upstream flow). | |
| std::vector< size_t > | compute_strahler_order () const |
| Compute the Strahler stream order for each vertex. | |
| std::pair< std::vector< size_t >, bool > | find_subroots () |
| Find subroots of the flow network. | |
| std::vector< std::vector< size_t > > | get_main_channels () const |
| Get the main channel paths of the flow network. | |
| void | remove_lakes (const std::vector< size_t > &subroot) |
| Remove lakes by draining local depressions. | |
| std::vector< float > | compute_response_times (const std::vector< float > &area_acc, const std::vector< float > &erodibility, float m_exp) const |
| Compute response times of the basin vertices. | |
| void | flow_breach () |
| Perform flow breaching to resolve depressions. | |
| std::vector< std::vector< glm::vec3 > > | flow_breach_paths () |
| Compute the breaching paths for depressions. | |
| float | update_elevations (const std::vector< float > &response_times, float uplift_rate, const std::vector< float > &max_slope) |
| Update terrain elevations based on response times and uplift. | |
| void | accumulate_area_by_outlet (const std::vector< float > &area, std::vector< float > &acc) const |
| Accumulate contributing area down the network by outlet. | |
| const std::vector< size_t > & | for_each_upstream (size_t outlet) const |
| Get the cached upstream traversal order from a specific outlet. | |
| auto | for_each_downstream (size_t outlet) const |
| Get the cached downstream traversal order from a specific outlet. | |
Represents a drainage basin network constructed on a 3D terrain mesh.
This class handles the construction and analysis of hydrological flow networks (receivers, streams, outlets) on a 3D triangular mesh. It allows simulating river network development, calculating Strahler orders, inverting receiver maps, breaching lakes, and updating elevations based on response times.
| hmap::DrainageBasin::DrainageBasin | ( | std::vector< glm::vec3 > | xyz_ | ) |
Construct a new Drainage Basin object.
| xyz_ | Input 3D points representing the terrain vertices. |
| const std::vector< glm::vec3 > & hmap::DrainageBasin::get_xyz | ( | ) | const |
Get the 3D coordinates of the terrain vertices.
| size_t hmap::DrainageBasin::size | ( | ) | const |
Get the number of vertices in the basin.
| void hmap::DrainageBasin::to_csv | ( | const std::string & | filename | ) | const |
Export the drainage basin data to a CSV file.
| filename | Path to the output CSV file. |
| const TerrainTriMesh & hmap::DrainageBasin::get_mesh | ( | ) | const |
Get the underlying terrain tri mesh (const).
| TerrainTriMesh & hmap::DrainageBasin::get_mesh | ( | ) |
Get the underlying terrain tri mesh (non-const).
| std::vector< float > hmap::DrainageBasin::compute_vertex_areas | ( | ) | const |
Compute the area of each vertex in the mesh.
Remap the elevation (z) values of the mesh vertices to a target range.
| zmin | Minimum target elevation value. |
| zmax | Maximum target elevation value. |
| void hmap::DrainageBasin::compute_receivers | ( | ) |
Compute the flow receiver for each vertex deterministically.
| void hmap::DrainageBasin::compute_receivers | ( | unsigned int | seed, |
| float | noise_strength = 0.25f |
||
| ) |
Compute the flow receiver for each vertex with noise for stochastic variations.
| seed | Seed for random generation. |
| noise_strength | Strength of the noise added to elevations during receiver computation. |
| void hmap::DrainageBasin::update_stream_tree | ( | unsigned int | seed, |
| float | noise_strength | ||
| ) |
Update the stream tree stochastically.
| seed | Seed for random generation. |
| noise_strength | Strength of noise. |
| void hmap::DrainageBasin::update_stream_tree | ( | ) |
Update the stream tree deterministically.
| void hmap::DrainageBasin::update_traversals | ( | ) |
Update cached traversal orders for upstream/downstream computations.
| std::vector< size_t > & hmap::DrainageBasin::get_outlets | ( | ) | const |
Get the indices of the outlets in the basin.
| void hmap::DrainageBasin::set_outlets | ( | const std::vector< size_t > & | outlet_indices | ) |
Set the outlets of the basin.
| outlet_indices | Vector containing the new outlet indices. |
| const std::vector< size_t > & hmap::DrainageBasin::get_receivers | ( | ) | const |
Get the receiver index of each vertex.
| void hmap::DrainageBasin::invert_receiver_map | ( | ) |
Invert the receiver map to build a map of children/downstream receivers.
| std::vector< bool > hmap::DrainageBasin::compute_is_ridge_node | ( | ) | const |
Compute whether each vertex is a ridge node (no upstream flow).
| std::vector< size_t > hmap::DrainageBasin::compute_strahler_order | ( | ) | const |
Compute the Strahler stream order for each vertex.
| std::pair< std::vector< size_t >, bool > hmap::DrainageBasin::find_subroots | ( | ) |
Find subroots of the flow network.
| std::vector< std::vector< size_t > > hmap::DrainageBasin::get_main_channels | ( | ) | const |
Get the main channel paths of the flow network.
| void hmap::DrainageBasin::remove_lakes | ( | const std::vector< size_t > & | subroot | ) |
Remove lakes by draining local depressions.
| subroot | Vector of subroot indices to process. |
| std::vector< float > hmap::DrainageBasin::compute_response_times | ( | const std::vector< float > & | area_acc, |
| const std::vector< float > & | erodibility, | ||
| float | m_exp | ||
| ) | const |
Compute response times of the basin vertices.
| area_acc | Accumulated area for each vertex. |
| erodibility | Erodibility coefficient for each vertex. |
| m_exp | Erodibility exponent. |
| void hmap::DrainageBasin::flow_breach | ( | ) |
Perform flow breaching to resolve depressions.
| std::vector< std::vector< glm::vec3 > > hmap::DrainageBasin::flow_breach_paths | ( | ) |
Compute the breaching paths for depressions.
| float hmap::DrainageBasin::update_elevations | ( | const std::vector< float > & | response_times, |
| float | uplift_rate, | ||
| const std::vector< float > & | max_slope | ||
| ) |
Update terrain elevations based on response times and uplift.
| response_times | Vector of vertex response times. |
| uplift_rate | Rate of tectonic uplift. |
| max_slope | Maximum allowed slope for each vertex. |
| void hmap::DrainageBasin::accumulate_area_by_outlet | ( | const std::vector< float > & | area, |
| std::vector< float > & | acc | ||
| ) | const |
Accumulate contributing area down the network by outlet.
| area | Input area contribution of each vertex. |
| acc | Output accumulated area. |
| const std::vector< size_t > & hmap::DrainageBasin::for_each_upstream | ( | size_t | outlet | ) | const |
Get the cached upstream traversal order from a specific outlet.
| outlet | Index of the outlet. |
|
inline |
Get the cached downstream traversal order from a specific outlet.
| outlet | Index of the outlet. |