127 float footprint_ratio = 1.f,
128 glm::vec2 shift = {0.f, 0.f},
129 glm::vec2
scale = {1.f, 1.f});
144 const std::vector<GaussianPush> &pushes);
191 const std::vector<std::vector<float>> &values,
192 float width_factor = 1.f,
193 const Array *p_noise_x =
nullptr,
194 const Array *p_noise_y =
nullptr,
195 const Array *p_stretching =
nullptr,
266 const std::vector<Path> &contours,
267 const std::vector<float> &elevations,
268 const Array *p_probability =
nullptr,
269 float randomness = 1.f,
270 std::uint32_t seed = 0,
271 float peak_ratio = 0.5f,
272 float outside_ratio = 1.f,
273 bool smoothstep =
false,
300 const Array *p_probability =
nullptr,
301 float randomness = 1.f,
302 std::uint32_t seed = 0,
303 float peak_ratio = 0.5f,
304 float outside_ratio = 1.f,
305 bool smoothstep =
false);
342 const Array *p_coastline =
nullptr,
343 const Array *p_boundary =
nullptr,
344 float mountain_elevation = 1.0f,
345 float coastline_elevation = 0.0f,
346 float boundary_elevation = -1.0f,
347 int iterations_max = 500,
348 float tolerance = 1e-5f,
349 const Array *p_noise =
nullptr,
350 float noise_amplitude = 0.0f);
386 float noise_scale = 1.f,
432 const std::vector<float> &xr,
433 const std::vector<float> &yr,
434 const std::vector<float> &zr,
436 float k_smoothing = 1.f,
440 const Array *p_noise_x =
nullptr,
441 const Array *p_noise_y =
nullptr,
442 const Array *p_stretching =
nullptr,
496 const std::vector<float> &xr,
497 const std::vector<float> &yr,
498 const std::vector<float> &zr,
500 float k_smoothing = 1.f,
504 const Array *p_noise_x =
nullptr,
505 const Array *p_noise_y =
nullptr,
506 const Array *p_stretching =
nullptr,
568 const std::vector<DeformationConstraint> &constraints,
570 int iterations = 200,
574 float talus_max = 0.f,
575 int n_candidates = 512,
576 float p_best = 0.65f,
577 float top_fraction = 0.1f,
578 float tolerance = 1e-3f,
579 std::vector<GaussianPush> *p_pushes =
nullptr);
635 const std::vector<float> &xr,
636 const std::vector<float> &yr,
637 const std::vector<float> &zr,
640 bool kernel_scale_radius,
641 bool kernel_scale_amplitude,
644 float k_smoothing = 0.1f,
645 bool kernel_flip =
true,
646 bool kernel_rotate =
false,
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
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, const UvRect &uv_rect=UvRect::unit())
Generate a heightmap from a coarse grid of control points with defined elevation values.
Definition base_elevation.cpp:16
void apply_gaussian_pushes(Array &array, const std::vector< GaussianPush > &pushes)
Apply a sequence of truncated-Gaussian pushes to a heightmap.
Definition sls_deformation.cpp:212
Array threshold(const Array &array, float x0, float x1)
Linear threshold.
Definition math.cpp:640
Array elevation_from_contours(glm::ivec2 shape, const std::vector< Path > &contours, const std::vector< float > &elevations, const Array *p_probability=nullptr, float randomness=1.f, std::uint32_t seed=0, float peak_ratio=0.5f, float outside_ratio=1.f, bool smoothstep=false, const UvRect &uv_rect=UvRect::unit())
Synthesize a heightmap from sparse closed iso-contours with known elevations using stochastic front p...
Definition elevation_from_contours.cpp:872
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 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:12
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:163
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, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, const UvRect &uv_rect_array=UvRect::unit())
Generate a heightmap based on a set of ridgelines with quadratic Bezier interpolation.
Definition ridgelines.cpp:111
DeformationConstraintType
Penalty type of a deformation constraint (see DeformationConstraint).
Definition authoring.hpp:32
@ ABOVE
penalize only heights below the target (target acts as a floor)
Definition authoring.hpp:34
@ BELOW
Definition authoring.hpp:35
@ MATCH
penalize any deviation from the target height
Definition authoring.hpp:33
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 sls_deformation(const Array &z, const std::vector< DeformationConstraint > &constraints, std::uint32_t seed, int iterations=200, int ir_min=4, int ir_max=64, int n_radii=7, float talus_max=0.f, int n_candidates=512, float p_best=0.65f, float top_fraction=0.1f, float tolerance=1e-3f, std::vector< GaussianPush > *p_pushes=nullptr)
Deform a heightmap to satisfy a set of constraints using stochastic local search over truncated-Gauss...
Definition sls_deformation.cpp:231
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, const UvRect &uv_rect_array=UvRect::unit())
Generate a heightmap by stamping a kernel at predefined locations.
Definition stamping.cpp:22
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, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, const UvRect &uv_rect_array=UvRect::unit())
Generate a heightmap based on a set of ridgelines and a specified slope.
Definition ridgelines.cpp:21
Path class for manipulating and analyzing paths in 2D space.
Truncated-Gaussian push operation, the elementary deformation used by sls_deformation.
Definition authoring.hpp:76
int i
center index (x)
Definition authoring.hpp:77
float amplitude
height displacement at the center
Definition authoring.hpp:80
int j
center index (y)
Definition authoring.hpp:78
int ir
kernel radius in pixels
Definition authoring.hpp:79
Axis-aligned rectangle in normalized [0, 1]^2 domain/UV space.
Definition uv_rect.hpp:30
static constexpr UvRect unit()
Definition uv_rect.hpp:46