HighMap library (C++)
Loading...
Searching...
No Matches
poi.hpp
Go to the documentation of this file.
1/* Copyright (c) 2026 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
13#pragma once
14
15#include <cstddef>
16#include <cstdint>
17#include <vector>
18
19#include <glm/glm.hpp>
20
21#include "highmap/array.hpp"
23
24namespace hmap
25{
26
45
52{
53 glm::vec2 position = {0.f, 0.f};
54 float score = 0.f;
55 float elevation = 0.f;
56 float slope = 0.f;
57 float aspect = 0.f;
59};
60
66{
67 int scale_radius = 8;
68 float prominence = 0.05f;
69 float threshold = 0.5f;
70 float min_distance = 0.05f;
71 size_t max_points = 50;
72 float border_margin = 0.02f;
73 std::uint32_t seed = 1337;
74 float jitter = 0.0f;
75 const Array *p_mask = nullptr;
77};
78
79// ============================================================================
80// POI Functions (Alphabetically Sorted)
81// ============================================================================
82
94 PoiType type,
95 const PoiGenerationOptions &options);
96
107 PoiType type,
108 const PoiGenerationOptions &options);
109
119std::vector<PointOfInterest> generate_points_of_interest(
120 const Array &heightmap,
121 PoiType type,
122 const PoiGenerationOptions &options);
123
132std::vector<glm::vec2> generate_points_of_interest_positions(
133 const Array &heightmap,
134 PoiType type,
135 const PoiGenerationOptions &options);
136
149std::vector<PointOfInterest> generate_points_from_score_field(
150 const Array &score_field,
151 const Array &heightmap,
152 const PoiGenerationOptions &options,
153 PoiType type = PoiType::CUSTOM);
154
155} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:31
Represents a collection of unordered points in 2D space.
Definition cloud.hpp:61
Definition of the Cloud class for manipulating sets of 2D points.
Definition opencv.hpp:20
std::vector< PointOfInterest > generate_points_from_score_field(const Array &score_field, const Array &heightmap, const PoiGenerationOptions &options, PoiType type=PoiType::CUSTOM)
Generates a list of PointOfInterest objects from a precomputed score field.
Definition poi.cpp:292
Cloud generate_points_of_interest_cloud(const Array &heightmap, PoiType type, const PoiGenerationOptions &options)
Generates a Cloud of points of interest from a heightmap.
Definition poi.cpp:240
Array compute_poi_suitability_field(const Array &heightmap, PoiType type, const PoiGenerationOptions &options)
Computes a normalized suitability/score field in [0, 1] for a given terrain feature type.
Definition poi.cpp:32
std::vector< glm::vec2 > generate_points_of_interest_positions(const Array &heightmap, PoiType type, const PoiGenerationOptions &options)
Generates 2D positions of points of interest from a heightmap.
Definition poi.cpp:274
PoiType
Classification types for terrain-aware points of interest.
Definition poi.hpp:32
@ FLAT_LOWLAND
Low flat areas / plains.
Definition poi.hpp:41
@ PLATEAU
Elevated flat areas.
Definition poi.hpp:40
@ SETTLEMENT_CANDIDATE
Flat enough, accessible, good relief.
Definition poi.hpp:43
@ CLIFF
High slope / drop-offs.
Definition poi.hpp:39
@ APEX
Local summits / peaks.
Definition poi.hpp:34
@ VALLEY
Elongated low terrain.
Definition poi.hpp:38
@ SINK
Depressions / pits / sinkholes.
Definition poi.hpp:35
@ RIDGE
Elongated high terrain.
Definition poi.hpp:37
@ CUSTOM
Custom or unclassified score field.
Definition poi.hpp:33
@ VIEWPOINT
High elevation + high prominence / openness.
Definition poi.hpp:42
@ SADDLE
Col / pass / saddle points.
Definition poi.hpp:36
std::vector< PointOfInterest > generate_points_of_interest(const Array &heightmap, PoiType type, const PoiGenerationOptions &options)
Generates a list of PointOfInterest objects from a heightmap.
Definition poi.cpp:257
Axis-aligned 2D bounding box in world coordinates.
Definition bbox2d.hpp:25
static constexpr BBox2D unit()
Definition bbox2d.hpp:39
Configuration parameters for procedural point-of-interest generation.
Definition poi.hpp:66
float border_margin
Exclusion margin near bounding box edges.
Definition poi.hpp:72
const Array * p_mask
Optional exclusion / region-of-interest mask.
Definition poi.hpp:75
int scale_radius
Neighborhood radius for local metrics.
Definition poi.hpp:67
float min_distance
Minimum Euclidean separation distance between points.
Definition poi.hpp:70
BBox2D bbox
Domain bounding box.
Definition poi.hpp:76
float jitter
Stochastic displacement ratio in [0, 1].
Definition poi.hpp:74
float prominence
Minimum elevation prominence over neighborhood.
Definition poi.hpp:68
float threshold
Score / suitability acceptance threshold in [0, 1].
Definition poi.hpp:69
size_t max_points
Maximum number of points to generate.
Definition poi.hpp:71
std::uint32_t seed
PRNG seed for deterministic generation and jitter.
Definition poi.hpp:73
Represents a terrain-aware point of interest with physical descriptors.
Definition poi.hpp:52
PoiType type
Point type classification.
Definition poi.hpp:58
float aspect
Aspect angle in radians [-π, π].
Definition poi.hpp:57
float score
Suitability or feature score in [0, 1].
Definition poi.hpp:54
glm::vec2 position
Coordinates in domain or normalized units.
Definition poi.hpp:53
float elevation
Terrain elevation at point.
Definition poi.hpp:55
float slope
Slope magnitude / talus.
Definition poi.hpp:56