HighMap library (C++)
Loading...
Searching...
No Matches
hmap::TerrainTriMesh::MeshPathCostConfig Struct Reference

Configuration for shortest-path edge costs and heuristics. More...

#include <terrain_tri_mesh.hpp>

Collaboration diagram for hmap::TerrainTriMesh::MeshPathCostConfig:

Public Types

enum class  Metric { EUCLIDEAN_2D , SYMMETRIC_Z , HYDROLOGICAL }
 Cost metric model used for edge traversal. More...

Public Attributes

enum hmap::TerrainTriMesh::MeshPathCostConfig::Metric metric = Metric::EUCLIDEAN_2D
float elevation_weight = 1.0f
 Weight for absolute vertex elevation in SYMMETRIC_Z mode.
float elevation_ratio = 0.5f
 Elevation vs distance balance factor in HYDROLOGICAL mode.
float distance_exponent = 2.0f
 Power exponent applied to upward elevation steps in HYDROLOGICAL mode.
float upward_penalization = 100.0f
 Penalty multiplier for uphill steps in HYDROLOGICAL mode.
float domain_center_weight = 0.0f
 Additional penalty favoring paths passing through the center of the domain.
std::vector< float > vertex_cost_multipliers = {}
 Optional per-vertex cost multipliers applied to incoming edge costs.

Detailed Description

Configuration for shortest-path edge costs and heuristics.

Member Enumeration Documentation

◆ Metric

Cost metric model used for edge traversal.

Enumerator
EUCLIDEAN_2D 

Pure 2D Euclidean distance in the XY plane.

Edge cost is simply the 2D segment length: \( \text{cost} = d_{2D} \)

SYMMETRIC_Z 

Symmetric elevation change metric.

Treats uphill and downhill elevation changes equally: \( \text{cost} = |\Delta z| + w_{elev} \cdot z_{curr} \) where \( w_{elev} \) is elevation_weight.

HYDROLOGICAL 

Asymmetric hydrological flow metric for streams.

Strongly penalizes uphill steps while favoring natural downhill flow:

\[ \text{cost} = (1 - r_{elev}) \cdot d_{2D} + (\Delta z > 0 \;?\; p_{up} \cdot (\Delta z)^{e_{dist}} : |\Delta z|) + r_{elev} \cdot \max(0, \Delta z) \]

where \( r_{elev} \) is elevation_ratio, \(e_{dist} \) is distance_exponent, and \( p_{up} \) is upward_penalization.

Member Data Documentation

◆ metric

enum hmap::TerrainTriMesh::MeshPathCostConfig::Metric hmap::TerrainTriMesh::MeshPathCostConfig::metric = Metric::EUCLIDEAN_2D

◆ elevation_weight

float hmap::TerrainTriMesh::MeshPathCostConfig::elevation_weight = 1.0f

Weight for absolute vertex elevation in SYMMETRIC_Z mode.

◆ elevation_ratio

float hmap::TerrainTriMesh::MeshPathCostConfig::elevation_ratio = 0.5f

Elevation vs distance balance factor in HYDROLOGICAL mode.

◆ distance_exponent

float hmap::TerrainTriMesh::MeshPathCostConfig::distance_exponent = 2.0f

Power exponent applied to upward elevation steps in HYDROLOGICAL mode.

◆ upward_penalization

float hmap::TerrainTriMesh::MeshPathCostConfig::upward_penalization = 100.0f

Penalty multiplier for uphill steps in HYDROLOGICAL mode.

◆ domain_center_weight

float hmap::TerrainTriMesh::MeshPathCostConfig::domain_center_weight = 0.0f

Additional penalty favoring paths passing through the center of the domain.

Adds \( w_{center} \cdot (1 - 2 \cdot d_{border}) \) to the edge cost.

◆ vertex_cost_multipliers

std::vector<float> hmap::TerrainTriMesh::MeshPathCostConfig::vertex_cost_multipliers = {}

Optional per-vertex cost multipliers applied to incoming edge costs.


The documentation for this struct was generated from the following file: