HighMap library (C++)
Loading...
Searching...
No Matches
authoring.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#pragma once
5#include "highmap/array.hpp"
7
8namespace hmap
9{
10
11class Cloud; // from highmap/geometry.hpp
12
26
68void alter_elevation(Array &array,
69 const Cloud &cloud,
70 int ir,
71 float footprint_ratio = 1.f,
72 glm::vec2 shift = {0.f, 0.f},
73 glm::vec2 scale = {1.f, 1.f});
74
119Array base_elevation(glm::ivec2 shape,
120 const std::vector<std::vector<float>> &values,
121 float width_factor = 1.f,
122 const Array *p_noise_x = nullptr,
123 const Array *p_noise_y = nullptr,
124 const Array *p_stretching = nullptr,
125 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
126
161Array elevation_from_sparse_constraints(const Array &mountains,
162 const Array *p_coastline = nullptr,
163 const Array *p_boundary = nullptr,
164 float mountain_elevation = 1.0f,
165 float coastline_elevation = 0.0f,
166 float boundary_elevation = -1.0f,
167 int iterations_max = 500,
168 float tolerance = 1e-5f,
169 const Array *p_noise = nullptr,
170 float noise_amplitude = 0.0f);
171
204Array reverse_midpoint(const Array &array,
205 std::uint32_t seed,
206 float noise_scale = 1.f,
207 float threshold = 0.f);
208
251Array ridgelines(glm::ivec2 shape,
252 const std::vector<float> &xr,
253 const std::vector<float> &yr,
254 const std::vector<float> &zr,
255 float slope,
256 float k_smoothing = 1.f,
257 float width = 0.1f,
258 float vmin = 0.f,
259 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
260 const Array *p_noise_x = nullptr,
261 const Array *p_noise_y = nullptr,
262 const Array *p_stretching = nullptr,
263 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
264
315Array ridgelines_bezier(glm::ivec2 shape,
316 const std::vector<float> &xr,
317 const std::vector<float> &yr,
318 const std::vector<float> &zr,
319 float slope,
320 float k_smoothing = 1.f,
321 float width = 0.1f,
322 float vmin = 0.f,
323 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
324 const Array *p_noise_x = nullptr,
325 const Array *p_noise_y = nullptr,
326 const Array *p_stretching = nullptr,
327 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
328
382Array stamping(glm::ivec2 shape,
383 const std::vector<float> &xr,
384 const std::vector<float> &yr,
385 const std::vector<float> &zr,
386 Array kernel,
387 int kernel_ir,
388 bool kernel_scale_radius,
389 bool kernel_scale_amplitude,
390 StampingBlendMethod blend_method,
391 std::uint32_t seed,
392 float k_smoothing = 0.1f,
393 bool kernel_flip = true,
394 bool kernel_rotate = false,
395 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
396
397} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition algebra.hpp:23
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}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return an array corresponding to a slope with a given overall.
Definition primitives.cpp:333
Array threshold(const Array &array, float x0, float x1)
Linear threshold.
Definition math.cpp:498
Array ridgelines_bezier(glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, float slope, float k_smoothing=1.f, float width=0.1f, float vmin=0.f, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap based on a set of ridgelines with quadratic Bezier interpolation.
Definition ridgelines.cpp:111
StampingBlendMethod
Blending method for the stamping operator.
Definition authoring.hpp:17
@ SUBSTRACT
substract
Definition authoring.hpp:24
@ MINIMUM
minimum
Definition authoring.hpp:21
@ ADD
add
Definition authoring.hpp:18
@ MAXIMUM_SMOOTH
maximum smooth
Definition authoring.hpp:20
@ MINIMUM_SMOOTH
minimum smooth
Definition authoring.hpp:22
@ MULTIPLY
multiply
Definition authoring.hpp:23
@ MAXIMUM
maximum
Definition authoring.hpp:19
void alter_elevation(Array &array, const Cloud &cloud, int ir, float footprint_ratio=1.f, glm::vec2 shift={0.f, 0.f}, glm::vec2 scale={1.f, 1.f})
Point-wise alteration: locally enforce a new elevation value while maintaining the 'shape' of the hei...
Definition alter_elevation.cpp:17
Array reverse_midpoint(const Array &array, std::uint32_t seed, float noise_scale=1.f, float threshold=0.f)
Apply the reverse midpoint displacement algorithm to the input array.
Definition reverse_midpoint.cpp:233
Array ridgelines(glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, float slope, float k_smoothing=1.f, float width=0.1f, float vmin=0.f, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap based on a set of ridgelines and a specified slope.
Definition ridgelines.cpp:21
Array elevation_from_sparse_constraints(const Array &mountains, const Array *p_coastline=nullptr, const Array *p_boundary=nullptr, float mountain_elevation=1.0f, float coastline_elevation=0.0f, float boundary_elevation=-1.0f, int iterations_max=500, float tolerance=1e-5f, const Array *p_noise=nullptr, float noise_amplitude=0.0f)
Synthesize a smooth heightmap from sparse elevation constraints using GPU harmonic interpolation (Lap...
Definition elevation_from_sparse_constraints.cpp:11
Cloud scale(const Cloud &cloud, glm::vec2 scale, glm::vec2 center={0.5f, 0.5f})
Scales the point coordinates in a cloud relative to a center point.
Definition cloud_functions.cpp:165
Array base_elevation(glm::ivec2 shape, const std::vector< std::vector< float > > &values, float width_factor=1.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generate a heightmap from a coarse grid of control points with defined elevation values.
Definition base_elevation.cpp:16
Array stamping(glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, Array kernel, int kernel_ir, bool kernel_scale_radius, bool kernel_scale_amplitude, StampingBlendMethod blend_method, std::uint32_t seed, float k_smoothing=0.1f, bool kernel_flip=true, bool kernel_rotate=false, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap by stamping a kernel at predefined locations.
Definition stamping.cpp:22
Path class for manipulating and analyzing paths in 2D space.