HighMap library (C++)
Loading...
Searching...
No Matches
scatter_item.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
9#pragma once
10
11#include <cstdint>
12#include <string>
13
14#include <glm/glm.hpp>
15
17
18#define HMAP_DEFAULT_SCATTER_RADIUS 1e-3f
19
20namespace hmap
21{
22
29{
30public:
31 glm::vec3 position = {0.f, 0.f, 0.f};
32 uint32_t class_id = 0;
33 float radius = HMAP_DEFAULT_SCATTER_RADIUS;
34
35 // ==========================================================================
36 // Constructors
37 // ==========================================================================
38
42 ScatterItem() = default;
43
50 ScatterItem(const glm::vec3 &position,
51 uint32_t class_id = 0,
52 float radius = HMAP_DEFAULT_SCATTER_RADIUS);
53
61 ScatterItem(const glm::vec2 &position_2d,
62 uint32_t class_id = 0,
63 float radius = HMAP_DEFAULT_SCATTER_RADIUS);
64
73 ScatterItem(float x,
74 float y,
75 float z = 0.0f,
76 uint32_t class_id = 0,
77 float radius = HMAP_DEFAULT_SCATTER_RADIUS);
78
79 // ==========================================================================
80 // Conversions
81 // ==========================================================================
82
87 Point to_point() const;
88
93 std::string to_string() const;
94
99 glm::vec2 to_vec2() const;
100
105 glm::vec3 to_vec3() const;
106
107 // ==========================================================================
108 // Operators
109 // ==========================================================================
110
111 bool operator==(const ScatterItem &other) const;
112 bool operator!=(const ScatterItem &other) const;
113};
114
115} // namespace hmap
A class to represent and manipulate 2D points that can carry a value.
Definition point.hpp:26
glm::vec3 position
3D spatial position (x, y, elevation z).
Definition scatter_item.hpp:31
std::string to_string() const
Returns a formatted string representation of the item.
Definition scatter_item.cpp:50
bool operator!=(const ScatterItem &other) const
Definition scatter_item.cpp:80
float radius
Characteristic radius.
Definition scatter_item.hpp:33
bool operator==(const ScatterItem &other) const
Definition scatter_item.cpp:74
ScatterItem()=default
Default constructor initializing item at origin.
Point to_point() const
Converts the item to a 2D Point (x, y) with value set to radius.
Definition scatter_item.cpp:45
glm::vec2 to_vec2() const
Converts the item position to glm::vec2 (x, y).
Definition scatter_item.cpp:60
glm::vec3 to_vec3() const
Converts the item position to glm::vec3 (x, y, z).
Definition scatter_item.cpp:65
uint32_t class_id
Unique category/class identifier (species, rock type, prop class).
Definition scatter_item.hpp:32
Definition opencv.hpp:20