HighMap library (C++)
Loading...
Searching...
No Matches
carving.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
5#pragma once
9
10namespace hmap
11{
12
13// clang-format off
21// clang-format on
22
61void dig_path(Array &z,
62 Path &path,
63 int width = 1,
64 int decay = 2,
65 int flattening_radius = 16,
66 bool force_downhill = false,
67 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
68 float depth = 0.f);
69
100void dig_river(Array &z,
101 const std::vector<Path> &path_list,
102 float riverbank_talus,
103 int river_width = 0,
104 int merging_width = 0,
105 float depth = 0.f,
106 float riverbed_talus = 0.f,
107 float noise_ratio = 0.9f,
108 std::uint32_t seed = 0,
109 Array *p_mask = nullptr);
110
111void dig_river(Array &z,
112 const Path &path,
113 float riverbank_talus,
114 int river_width = 0,
115 int merging_width = 0,
116 float depth = 0.f,
117 float riverbed_talus = 0.f,
118 float noise_ratio = 0.9f,
119 std::uint32_t seed = 0,
120 Array *p_mask = nullptr);
121
149void flatbed_carve(Array &z,
150 const Path &path,
151 float bottom_extent = 32.f, // pixels
152 float vmin = 0.1f,
153 float depth = 0.05f,
154 float falloff_distance = 128.f,
155 float outer_slope = 0.1f,
156 bool preserve_bedshape = true,
157 RadialProfile radial_profile = RadialProfile::RP_GAIN,
158 float radial_profile_parameter = 2.f,
159 Array *p_falloff_mask = nullptr,
160 const Array *p_noise_r = nullptr,
161 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
162
216void trench(Array &z,
217 const Path &path,
218 float width,
219 bool enable_width_depth_scaling = true,
220 bool enable_width_distance_scaling = true,
221 bool enable_width_curvature_scaling = false,
222 float curvature_radius_min = 1.f,
223 float curv_width_ratio_min = 0.5f,
224 float curv_width_ratio_max = 2.f,
226 float radial_profile_parameter = 2.f,
227 ElevationLongitudinalProfile longitudinal_profile =
229 float elevation_shift = -0.05f,
230 float shift_ramp_start_ratio = 0.f,
231 float shift_ramp_end_ratio = 0.f,
232 float min_slope = 0.001f,
233 size_t k_neighbors = 8,
234 const Array *p_noise_r = nullptr,
235 Array *p_bending_mask = nullptr,
236 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
237
238} // namespace hmap
Header file for boundary condition functions and utilities.
Definition algebra.hpp:23
void trench(Array &z, const Path &path, float width, bool enable_width_depth_scaling=true, bool enable_width_distance_scaling=true, bool enable_width_curvature_scaling=false, float curvature_radius_min=1.f, float curv_width_ratio_min=0.5f, float curv_width_ratio_max=2.f, RadialProfile radial_profile=RadialProfile::RP_SMOOTHSTEP_UPPER, float radial_profile_parameter=2.f, ElevationLongitudinalProfile longitudinal_profile=ElevationLongitudinalProfile::ELP_DECREASING, float elevation_shift=-0.05f, float shift_ramp_start_ratio=0.f, float shift_ramp_end_ratio=0.f, float min_slope=0.001f, size_t k_neighbors=8, const Array *p_noise_r=nullptr, Array *p_bending_mask=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Carves a trench along a given path into a heightmap.
Definition trench.cpp:24
ElevationLongitudinalProfile
Definition carving.hpp:15
@ ELP_UNCHANGED
Definition carving.hpp:16
@ ELP_INCREASING
Definition carving.hpp:19
@ ELP_DECREASING
Definition carving.hpp:18
@ ELP_FLAT
Definition carving.hpp:17
RadialProfile
Radial profile type.
Definition profiles.hpp:51
@ RP_GAIN
Definition profiles.hpp:52
@ RP_SMOOTHSTEP_UPPER
Definition profiles.hpp:56
void dig_path(Array &z, Path &path, int width=1, int decay=2, int flattening_radius=16, bool force_downhill=false, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, float depth=0.f)
Dig a path on a heightmap.
Definition dig_path.cpp:18
void flatbed_carve(Array &z, const Path &path, float bottom_extent=32.f, float vmin=0.1f, float depth=0.05f, float falloff_distance=128.f, float outer_slope=0.1f, bool preserve_bedshape=true, RadialProfile radial_profile=RadialProfile::RP_GAIN, float radial_profile_parameter=2.f, Array *p_falloff_mask=nullptr, const Array *p_noise_r=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Blends a flatbed carve into an existing heightmap.
Definition flatbed_carve.cpp:114
void dig_river(Array &z, const std::vector< Path > &path_list, float riverbank_talus, int river_width=0, int merging_width=0, float depth=0.f, float riverbed_talus=0.f, float noise_ratio=0.9f, std::uint32_t seed=0, Array *p_mask=nullptr)
Modifies the elevation array to carve a river along a specified path.
Definition dig_river.cpp:20
Path class for manipulating and analyzing paths in 2D space.