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

Header file for hydrological modeling functions and utilities. More...

Go to the source code of this file.

Namespaces

namespace  hmap
 
namespace  hmap::gpu
 

Functions

Array hmap::d8_compute_ndip (const Array &d8)
 Computes the number of drainage paths for each cell based on the D8 flow direction model.
 
void hmap::find_flow_sinks (const Array &z, std::vector< int > &is, std::vector< int > &js)
 Identifies the indices of flow sinks within the heightmap.
 
Array hmap::flooding_uniform_level (const Array &z, float zref)
 Compute water depth for a uniform flooding level.
 
Array hmap::flooding_from_boundaries (const Array &z, float zref, bool from_east=true, bool from_west=true, bool from_north=true, bool from_south=true)
 Compute flooding starting from the lowest boundary points.
 
Array hmap::flooding_from_point (const Array &z, int i, int j, float depth_min=std::numeric_limits< float >::max())
 Flood terrain starting from a single seed point.
 
Array hmap::flooding_from_point (const Array &z, const std::vector< int > &i, const std::vector< int > &j, float depth_min=std::numeric_limits< float >::max())
 Flood terrain starting from multiple seed points.
 
Array hmap::flooding_lake_system (const Array &z, int iterations=500, float epsilon=1e-3f)
 Estimate lake water depths on a terrain by filling depressions.
 
Array hmap::flow_accumulation_d8 (const Array &z)
 Computes the flow accumulation for each cell using the D8 flow direction model.
 
Array hmap::flow_accumulation_dinf (const Array &z, float talus_ref)
 Computes the flow accumulation for each cell using the Multiple Flow Direction (MFD) model.
 
Array hmap::flow_direction_d8 (const Array &z)
 Computes the flow direction from each cell to its downslope neighbor using the D8 model.
 
std::vector< Arrayhmap::flow_direction_dinf (const Array &z, float talus_ref)
 Computes the flow direction and weights for each direction using the Multiple Flow Direction (MFD) model.
 
Path hmap::flow_stream (const Array &z, const Vec2< int > ij_start, const float elevation_ratio=0.5f, const float distance_exponent=2.f, const float upward_penalization=100.f)
 Computes the optimal flow path from a starting point to the boundary of a given elevation array.
 
Array hmap::generate_riverbed (const Path &path, Vec2< int > shape, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, bool bezier_smoothing=false, float depth_start=0.01f, float depth_end=1.f, float slope_start=64.f, float slope_end=32.f, float shape_exponent_start=1.f, float shape_exponent_end=10.f, float k_smoothing=0.5f, int post_filter_ir=0, Array *p_noise_x=nullptr, Array *p_noise_y=nullptr, Array *p_noise_r=nullptr)
 Generates a 2D array representing a riverbed based on a specified path.
 
Array hmap::merge_water_depths (const Array &depth1, const Array &depth2, float k_smooth=0.f)
 Merge two water depth fields.
 
Array hmap::water_depth_from_mask (const Array &z, const Array &mask, float mask_threshold=0.f, int iterations_max=10000, float tolerance=1e-2f, float omega=1.8f)
 Compute water depth over a masked terrain using harmonic interpolation.
 
void hmap::water_depth_dry_out (Array &water_depth, float dry_out_ratio=0.5f, const Array *p_mask=nullptr, float depth_max=std::numeric_limits< float >::max())
 Apply a drying factor to a water depth field.
 
Array hmap::water_depth_increase (const Array &water_depth, const Array &z, float additional_depth)
 Simulates the increase in water depth over a terrain.
 
Array hmap::water_mask (const Array &water_depth)
 Generates a binary mask representing water presence.
 
Array hmap::water_mask (const Array &water_depth, const Array &z, float additional_depth)
 Computes a gradient-based water mask using an extended water depth model.
 
Array hmap::gpu::flow_direction_d8 (const Array &z)
 See hmap::flow_direction_d8.
 
Array hmap::gpu::generate_riverbed (const Path &path, Vec2< int > shape, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, bool bezier_smoothing=false, float depth_start=0.01f, float depth_end=1.f, float slope_start=64.f, float slope_end=32.f, float shape_exponent_start=1.f, float shape_exponent_end=10.f, float k_smoothing=0.5f, int post_filter_ir=0, Array *p_noise_x=nullptr, Array *p_noise_y=nullptr, Array *p_noise_r=nullptr)
 See hmap::generate_riverbed.
 

Detailed Description

Header file for hydrological modeling functions and utilities.

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

This header file declares functions and utilities for hydrological modeling, including tools for computing flow directions, flow accumulation, and identifying flow sinks within heightmaps. It supports multiple flow direction models and the D8 model for flow direction and accumulation calculations.

Key functionalities include:

  • Computation of flow directions and flow accumulations using various models.
  • Identification of flow sinks in heightmaps.
  • Support for multiple flow direction models with customizable flow-partition exponents.