HighMap library (C++)
Loading...
Searching...
No Matches
terrain_features.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 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 <array>
16#include <map>
17#include <vector>
18
19#include <glm/glm.hpp>
20
21#include "highmap/array.hpp"
22
26#define HMAP_PACK8(a, b, c, d, e, f, g, h) \
27 ((a << 15) + (b << 13) + (c << 11) + (d << 9) + (e << 7) + (f << 5) + \
28 (g << 3) + (h << 1))
29
30namespace hmap
31{
32
38 const Array &array,
39 float surface_threshold = 0.f,
40 float background_value = 0.f,
41 std::map<float, float> *p_surfaces = nullptr,
42 std::map<float, std::array<float, 2>> *p_centroids = nullptr);
43
48Array geomorphons(const Array &array, int irmin, int irmax, float epsilon);
49
54Array kmeans_clustering2(const Array &array1,
55 const Array &array2,
56 int nclusters,
57 std::vector<Array> *p_scoring = nullptr,
58 Array *p_aggregate_scoring = nullptr,
59 glm::vec2 weights = {1.f, 1.f},
60 std::uint32_t seed = 1);
61
65Array kmeans_clustering3(const Array &array1,
66 const Array &array2,
67 const Array &array3,
68 int nclusters,
69 std::vector<Array> *p_scoring = nullptr,
70 Array *p_aggregate_scoring = nullptr,
71 glm::vec3 weights = {1.f, 1.f, 1.f},
72 std::uint32_t seed = 1);
73
74} // 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
Definition opencv.hpp:20
Array connected_components(const Array &array, float surface_threshold=0.f, float background_value=0.f, std::map< float, float > *p_surfaces=nullptr, std::map< float, std::array< float, 2 > > *p_centroids=nullptr)
Identifies and labels connected components within a binary or labeled array, with optional filtering ...
Definition connected_components.cpp:20
Array geomorphons(const Array &array, int irmin, int irmax, float epsilon)
Classifies terrain into geomorphological features based on the geomorphons method.
Definition geomorphons.cpp:19
Array kmeans_clustering3(const Array &array1, const Array &array2, const Array &array3, int nclusters, std::vector< Array > *p_scoring=nullptr, Array *p_aggregate_scoring=nullptr, glm::vec3 weights={1.f, 1.f, 1.f}, std::uint32_t seed=1)
Performs k-means clustering on three input arrays.
Definition kmeans_clustering.cpp:145
Array kmeans_clustering2(const Array &array1, const Array &array2, int nclusters, std::vector< Array > *p_scoring=nullptr, Array *p_aggregate_scoring=nullptr, glm::vec2 weights={1.f, 1.f}, std::uint32_t seed=1)
Performs k-means clustering on two input arrays, grouping similar data points into clusters.
Definition kmeans_clustering.cpp:22