HighMap library (C++)
Loading...
Searching...
No Matches
rock_field.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 <cstddef>
12#include <cstdint>
13#include <vector>
14
15#include <glm/glm.hpp>
16
17#include "highmap/array.hpp"
22
23namespace hmap
24{
25
31class RockField : public ScatterField
32{
33public:
34 // ==========================================================================
35 // Constructors
36 // ==========================================================================
37
41 RockField() = default;
42
47 RockField(const std::vector<Rock> &rocks);
48
53 RockField(std::vector<Rock> &&rocks) noexcept;
54
59 RockField(const ScatterField &field);
60
65 RockField(ScatterField &&field) noexcept;
66
74 RockField(const Cloud &cloud,
75 uint32_t class_id = 0,
76 float default_radius = HMAP_DEFAULT_ROCK_RADIUS);
77
78 // ==========================================================================
79 // Rock-Specific Operations
80 // ==========================================================================
81
94 void apply_power_law_distribution(float alpha = 2.0f,
95 float r_min = 1e-3f,
96 float r_max = 5e-2f,
97 uint32_t seed = 0);
98
107 uint32_t seed = 0);
108
122 void apply_slope_sorting(const Array &slope,
123 float sorting_strength = 1.0f,
124 const BBox2D &bbox = BBox2D{});
125
134 void simulate_physics(const Array &elevation,
135 const Array *p_friction_map = nullptr,
136 const RockSimulationOptions &options = {});
137
142 std::string to_string() const override;
143};
144
145} // 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
RockField()=default
Default constructor initializing an empty rock field.
void apply_power_law_distribution(float alpha=2.0f, float r_min=1e-3f, float r_max=5e-2f, uint32_t seed=0)
Applies a heavy-tailed power-law (Pareto) radius distribution to all rocks.
Definition rock_field.cpp:71
std::string to_string() const override
Returns a multi-line formatted summary string of the rock field.
Definition rock_field.cpp:174
void apply_slope_sorting(const Array &slope, float sorting_strength=1.0f, const BBox2D &bbox=BBox2D{})
Simulates gravitational slope sorting (scree/talus dynamics).
Definition rock_field.cpp:119
void simulate_physics(const Array &elevation, const Array *p_friction_map=nullptr, const RockSimulationOptions &options={})
Simulates physical movement (sliding, rolling, bouncing, and inter-rock collision avoidance) for this...
Definition rock_field.cpp:167
ScatterField()=default
Default constructor initializing an empty field.
Definition opencv.hpp:20
Array r_max(const Array &array1, const Array &array2, float alpha=0.f)
Generalized Rvachev R-function for smooth maximum / union (exact zero-set).
Definition math.cpp:436
Array slope(glm::ivec2 shape, float angle, float slope, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec2 center={0.5f, 0.5f}, const UvRect &uv_rect=UvRect::unit())
Return an array corresponding to a slope with a given overall.
Definition primitives.cpp:362
Array r_min(const Array &array1, const Array &array2, float alpha=0.f)
Generalized Rvachev R-function for smooth minimum / intersection (exact zero-set).
Definition math.cpp:422
Axis-aligned 2D bounding box in world coordinates.
Definition bbox2d.hpp:25
Parameters defining the size, power-law scaling, and embedding traits of rocks.
Definition rock_distribution.hpp:25
Configuration parameters for GPU-based rock and debris trajectory simulation.
Definition rock_simulation.hpp:30