HighMap library (C++)
Loading...
Searching...
No Matches
functions.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
10#pragma once
11
12#include "highmap/array.hpp"
13#include "highmap/erosion.hpp"
14
15namespace hmap
16{
17
31
43Array get_primitive_base(const PrimitiveType &primitive_type,
44 const glm::ivec2 &shape,
45 const Array *p_noise_x = nullptr,
46 const Array *p_noise_y = nullptr,
47 glm::vec2 center = {0.5f, 0.5f},
48 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
49
68Array biquad_pulse(glm::ivec2 shape,
69 float gain = 1.f,
70 const Array *p_ctrl_param = nullptr,
71 const Array *p_noise_x = nullptr,
72 const Array *p_noise_y = nullptr,
73 const Array *p_stretching = nullptr,
74 glm::vec2 center = {0.5f, 0.5f},
75 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
76
77Array biquad_pulse_x(glm::ivec2 shape, glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
78Array biquad_pulse_y(glm::ivec2 shape, glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
79
99Array bump(glm::ivec2 shape,
100 float gain = 1.f,
101 const Array *p_ctrl_param = nullptr, // gain multiplier
102 const Array *p_noise_x = nullptr,
103 const Array *p_noise_y = nullptr,
104 const Array *p_stretching = nullptr,
105 glm::vec2 center = {0.5f, 0.5f},
106 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
107
151Array bump_lorentzian(
152 glm::ivec2 shape,
153 float shape_factor = 0.5f,
154 float radius = 0.5f,
155 const Array *p_ctrl_param = nullptr, // shape_factor multiplier
156 const Array *p_noise_x = nullptr,
157 const Array *p_noise_y = nullptr,
158 glm::vec2 center = {0.5f, 0.5f},
159 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
160
177Array checkerboard(glm::ivec2 shape,
178 glm::vec2 kw,
179 const Array *p_noise_x = nullptr,
180 const Array *p_noise_y = nullptr,
181 const Array *p_stretching = nullptr,
182 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
183
211Array cone(glm::ivec2 shape,
212 float slope,
213 float apex_elevation = 1.f,
214 bool smooth_profile = false,
215 glm::vec2 center = {0.5f, 0.5f},
216 const Array *p_noise_x = nullptr,
217 const Array *p_noise_y = nullptr,
218 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
219
273Array cone_complex(
274 glm::ivec2 shape,
275 float alpha,
276 float radius = 0.5f,
277 bool smooth_profile = true,
278 float valley_amp = 0.2f,
279 int valley_nb = 5,
280 float valley_decay_ratio = 0.5f,
281 float valley_angle0 = 15.f,
283 float erosion_delta = 0.01f,
284 float radial_waviness_amp = 0.05f,
285 float radial_waviness_kw = 2.f,
286 float bias_angle = 30.f,
287 float bias_amp = 0.75f,
288 float bias_exponent = 1.f,
289 glm::vec2 center = {0.5f, 0.5f},
290 const Array *p_ctrl_param = nullptr,
291 const Array *p_noise_x = nullptr,
292 const Array *p_noise_y = nullptr,
293 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
294
326Array cone_sigmoid(glm::ivec2 shape,
327 float alpha,
328 float radius = 0.5f,
329 glm::vec2 center = {0.5f, 0.5f},
330 const Array *p_noise_x = nullptr,
331 const Array *p_noise_y = nullptr,
332 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
333
341Array constant(glm::ivec2 shape, float value = 0.f);
342
346Array cubic_pulse(glm::ivec2 shape,
347 const Array *p_noise_x,
348 const Array *p_noise_y,
349 glm::vec2 center = {0.5f, 0.5f},
350 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
351
386Array disk(glm::ivec2 shape,
387 float radius,
388 float slope = 1.f,
389 const Array *p_ctrl_param = nullptr,
390 const Array *p_noise_x = nullptr,
391 const Array *p_noise_y = nullptr,
392 const Array *p_stretching = nullptr,
393 glm::vec2 center = {0.5f, 0.5f},
394 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
395
416Array gaussian_pulse(glm::ivec2 shape,
417 float sigma,
418 const Array *p_ctrl_param = nullptr,
419 const Array *p_noise_x = nullptr,
420 const Array *p_noise_y = nullptr,
421 const Array *p_stretching = nullptr,
422 glm::vec2 center = {0.5f, 0.5f},
423 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
424
454Array multisteps(glm::ivec2 shape,
455 float angle,
456 float r = 1.2f,
457 int nsteps = 8,
458 float elevation_exponent = 0.7f,
459 float shape_gain = 4.f,
460 float scale = 0.5f,
461 float outer_slope = 0.1f,
462 const Array *p_ctrl_param = nullptr,
463 const Array *p_noise_x = nullptr,
464 const Array *p_noise_y = nullptr,
465 const glm::vec2 &center = {0.5f, 0.5f},
466 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
467
491Array paraboloid(glm::ivec2 shape,
492 float angle,
493 float a,
494 float b,
495 float v0 = 0.f,
496 bool reverse_x = false,
497 bool reverse_y = false,
498 const Array *p_noise_x = nullptr,
499 const Array *p_noise_y = nullptr,
500 const Array *p_stretching = nullptr,
501 glm::vec2 center = {0.5f, 0.5f},
502 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
503
537Array polar_shape(glm::ivec2 shape,
538 float rmin = 0.1f,
539 float rmax = 0.3f,
540 float aspect_ratio = 1.f,
541 float smoothing_width = 0.1f,
542 bool square_base = false,
543 float angle = 15.f,
544 float sector_angle = 90.f,
545 float vmin = 0.5f,
546 float kt_value = 0.f,
547 float kr_border = 0.f,
548 float kr_border_ratio = 0.1f,
549 const Array *p_noise_r = nullptr,
550 const Array *p_noise_theta = nullptr,
551 glm::vec2 center = {0.5f, 0.5f},
552 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
553
592Array rectangle(glm::ivec2 shape,
593 float rx,
594 float ry,
595 float angle,
596 float slope = 1.f,
597 const Array *p_ctrl_param = nullptr,
598 const Array *p_noise_x = nullptr,
599 const Array *p_noise_y = nullptr,
600 const Array *p_stretching = nullptr,
601 glm::vec2 center = {0.5f, 0.5f},
602 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
623Array slope(glm::ivec2 shape,
624 float angle,
625 float slope,
626 const Array *p_ctrl_param = nullptr,
627 const Array *p_noise_x = nullptr,
628 const Array *p_noise_y = nullptr,
629 const Array *p_stretching = nullptr,
630 glm::vec2 center = {0.5f, 0.5f},
631 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
635Array smooth_cosine(glm::ivec2 shape,
636 const Array *p_noise_x,
637 const Array *p_noise_y,
638 glm::vec2 center = {0.5f, 0.5f},
639 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
640
662Array step(glm::ivec2 shape,
663 float angle,
664 float slope,
665 const Array *p_ctrl_param = nullptr,
666 const Array *p_noise_x = nullptr,
667 const Array *p_noise_y = nullptr,
668 const Array *p_stretching = nullptr,
669 glm::vec2 center = {0.5f, 0.5f},
670 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
671
689void swirl(Array &dx,
690 Array &dy,
691 float amplitude = 1.f,
692 float exponent = 1.f,
693 const Array *p_noise = nullptr,
694 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
695
713Array wave_dune(glm::ivec2 shape,
714 float kw,
715 float angle,
716 float xtop,
717 float xbottom,
718 float phase_shift = 0.f,
719 const Array *p_noise_x = nullptr,
720 const Array *p_noise_y = nullptr,
721 const Array *p_stretching = nullptr,
722 glm::vec2 center = {0.5f, 0.5f},
723 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
724
746Array wave_sine(glm::ivec2 shape,
747 float kw,
748 float angle,
749 float phase_shift = 0.f,
750 const Array *p_noise_x = nullptr,
751 const Array *p_noise_y = nullptr,
752 const Array *p_stretching = nullptr,
753 glm::vec2 center = {0.5f, 0.5f},
754 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
755
776Array wave_square(glm::ivec2 shape,
777 float kw,
778 float angle,
779 float phase_shift = 0.f,
780 const Array *p_noise_x = nullptr,
781 const Array *p_noise_y = nullptr,
782 const Array *p_stretching = nullptr,
783 glm::vec2 center = {0.5f, 0.5f},
784 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
785
808Array wave_triangular(glm::ivec2 shape,
809 float kw,
810 float angle,
811 float slant_ratio,
812 float phase_shift = 0.f,
813 const Array *p_noise_x = nullptr,
814 const Array *p_noise_y = nullptr,
815 const Array *p_stretching = nullptr,
816 glm::vec2 center = {0.5f, 0.5f},
817 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
818
819} // namespace hmap
820
821namespace hmap::gpu
822{
823
852Array hemisphere_field(glm::ivec2 shape,
853 glm::vec2 kw,
854 std::uint32_t seed,
855 float rmin = 0.05f,
856 float rmax = 0.8f,
857 float amplitude_random_ratio = 1.f,
858 float density = 0.1f,
859 glm::vec2 jitter = {1.f, 1.f},
860 float shift = 0.f,
861 const Array *p_noise_x = nullptr,
862 const Array *p_noise_y = nullptr,
863 const Array *p_noise_distance = nullptr,
864 const Array *p_density_multiplier = nullptr,
865 const Array *p_size_multiplier = nullptr,
866 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
867
869Array hemisphere_field_fbm(glm::ivec2 shape,
870 glm::vec2 kw,
871 std::uint32_t seed,
872 float rmin = 0.05f,
873 float rmax = 0.8f,
874 float amplitude_random_ratio = 1.f,
875 float density = 0.1f,
876 glm::vec2 jitter = {0.5f, 0.5f},
877 float shift = 0.1f,
878 int octaves = 8,
879 float persistence = 0.5f,
880 float lacunarity = 2.f,
881 const Array *p_noise_x = nullptr,
882 const Array *p_noise_y = nullptr,
883 const Array *p_noise_distance = nullptr,
884 const Array *p_density_multiplier = nullptr,
885 const Array *p_size_multiplier = nullptr,
886 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
887
920Array multisteps(glm::ivec2 shape,
921 float angle,
922 std::uint32_t seed,
923 glm::vec2 kw = {2.f, 2.f},
924 float noise_amp = 0.1f,
925 float noise_rugosity = 0.f,
926 bool noise_inflate = true,
927 float r = 1.2f,
928 int nsteps = 8,
929 float elevation_exponent = 0.7f,
930 float shape_gain = 4.f,
931 float scale = 0.5f,
932 float outer_slope = 0.1f,
933 const Array *p_ctrl_param = nullptr,
934 const glm::vec2 &center = {0.5f, 0.5f},
935 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
936
982Array polygon_field(glm::ivec2 shape,
983 glm::vec2 kw,
984 std::uint32_t seed,
985 float rmin = 0.05f,
986 float rmax = 0.8f,
987 float clamping_dist = 0.1f,
988 float clamping_k = 0.1f,
989 int n_vertices_min = 3,
990 int n_vertices_max = 16,
991 float density = 0.5f,
992 glm::vec2 jitter = {0.5f, 0.5f},
993 float shift = 0.1f,
994 const Array *p_noise_x = nullptr,
995 const Array *p_noise_y = nullptr,
996 const Array *p_noise_distance = nullptr,
997 const Array *p_density_multiplier = nullptr,
998 const Array *p_size_multiplier = nullptr,
999 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
1000
1045Array polygon_field_fbm(glm::ivec2 shape,
1046 glm::vec2 kw,
1047 std::uint32_t seed,
1048 float rmin = 0.05f,
1049 float rmax = 0.8f,
1050 float clamping_dist = 0.1f,
1051 float clamping_k = 0.1f,
1052 int n_vertices_min = 3,
1053 int n_vertices_max = 16,
1054 float density = 0.1f,
1055 glm::vec2 jitter = {0.5f, 0.5f},
1056 float shift = 0.1f,
1057 int octaves = 8,
1058 float persistence = 0.5f,
1059 float lacunarity = 2.f,
1060 const Array *p_noise_x = nullptr,
1061 const Array *p_noise_y = nullptr,
1062 const Array *p_noise_distance = nullptr,
1063 const Array *p_density_multiplier = nullptr,
1064 const Array *p_size_multiplier = nullptr,
1065 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
1066
1067} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition blending.hpp:186
Array polygon_field(glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float rmin=0.05f, float rmax=0.8f, float clamping_dist=0.1f, float clamping_k=0.1f, int n_vertices_min=3, int n_vertices_max=16, float density=0.5f, glm::vec2 jitter={0.5f, 0.5f}, float shift=0.1f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a scalar field representing the signed distance to randomly generated polygons.
Definition primitives_gpu.cpp:593
Array hemisphere_field_fbm(glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float rmin=0.05f, float rmax=0.8f, float amplitude_random_ratio=1.f, float density=0.1f, glm::vec2 jitter={0.5f, 0.5f}, float shift=0.1f, int octaves=8, float persistence=0.5f, float lacunarity=2.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
See hmap::hemisphere_field.
Definition primitives_gpu.cpp:389
Array multisteps(glm::ivec2 shape, float angle, std::uint32_t seed, glm::vec2 kw={2.f, 2.f}, float noise_amp=0.1f, float noise_rugosity=0.f, bool noise_inflate=true, float r=1.2f, int nsteps=8, float elevation_exponent=0.7f, float shape_gain=4.f, float scale=0.5f, float outer_slope=0.1f, const Array *p_ctrl_param=nullptr, const glm::vec2 &center={0.5f, 0.5f}, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
GPU-accelerated multi-step height generation with procedural noise.
Definition multisteps.cpp:86
Array polygon_field_fbm(glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float rmin=0.05f, float rmax=0.8f, float clamping_dist=0.1f, float clamping_k=0.1f, int n_vertices_min=3, int n_vertices_max=16, float density=0.1f, glm::vec2 jitter={0.5f, 0.5f}, float shift=0.1f, int octaves=8, float persistence=0.5f, float lacunarity=2.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a scalar field representing the signed distance to randomly generated polygons combined wit...
Definition primitives_gpu.cpp:653
Array hemisphere_field(glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float rmin=0.05f, float rmax=0.8f, float amplitude_random_ratio=1.f, float density=0.1f, glm::vec2 jitter={1.f, 1.f}, float shift=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a scalar field representing the signed distance to randomly generated hemispheres.
Definition primitives_gpu.cpp:335
Definition algebra.hpp:23
Array biquad_pulse_x(glm::ivec2 shape, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Definition primitives.cpp:39
Array wave_triangular(glm::ivec2 shape, float kw, float angle, float slant_ratio, float phase_shift=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a triangular wave.
Definition wave.cpp:94
Array bump(glm::ivec2 shape, float gain=1.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a bump.
Definition primitives.cpp:79
ErosionProfile
Procedural erosion angular profile type.
Definition profiles.hpp:20
@ EP_TRIANGLE_GRENIER
Definition profiles.hpp:29
Array constant(glm::ivec2 shape, float value=0.f)
Return a constant value array.
Definition primitives.cpp:140
Array biquad_pulse(glm::ivec2 shape, float gain=1.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a 'biquadratic pulse'.
Definition primitives.cpp:17
Array cubic_pulse(glm::ivec2 shape)
Generates a cubic pulse kernel array.
Definition kernels.cpp:98
Array bump_lorentzian(glm::ivec2 shape, float shape_factor=0.5f, float radius=0.5f, 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})
Generates a 2D Lorentzian bump pattern.
Definition primitives.cpp:101
Array checkerboard(glm::ivec2 shape, glm::vec2 kw, 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})
Return a checkerboard heightmap.
Definition checkerboard.cpp:15
PrimitiveType
Defines the primitive shape used for synthesis.
Definition functions.hpp:23
@ PRIM_BIQUAD_PULSE
Definition functions.hpp:24
@ PRIM_CONE_SMOOTH
Definition functions.hpp:27
@ PRIM_BUMP
Definition functions.hpp:25
@ PRIM_SMOOTH_COSINE
Definition functions.hpp:29
@ PRIM_CUBIC_PULSE
Definition functions.hpp:28
@ PRIM_CONE
Definition functions.hpp:26
Array gaussian_pulse(glm::ivec2 shape, float sigma, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a gaussian_decay pulse kernel.
Definition primitives.cpp:201
Array cone_sigmoid(glm::ivec2 shape, float alpha, float radius=0.5f, glm::vec2 center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a smooth conical heightmap using a sigmoid-based profile.
Definition cone.cpp:151
Array wave_square(glm::ivec2 shape, float kw, float angle, float phase_shift=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a square wave.
Definition wave.cpp:68
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, const Array *p_stretching=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:288
void swirl(Array &dx, Array &dy, float amplitude=1.f, float exponent=1.f, const Array *p_noise=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generate displacements dx and dy to apply a swirl effect to another primitve.
Definition swirl.cpp:11
Array step(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, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a step function (Heaviside with an optional talus slope at the transition).
Definition primitives.cpp:341
Array paraboloid(glm::ivec2 shape, float angle, float a, float b, float v0=0.f, bool reverse_x=false, bool reverse_y=false, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a paraboloid.
Definition primitives.cpp:223
Array polar_shape(glm::ivec2 shape, float rmin=0.1f, float rmax=0.3f, float aspect_ratio=1.f, float smoothing_width=0.1f, bool square_base=false, float angle=15.f, float sector_angle=90.f, float vmin=0.5f, float kt_value=0.f, float kr_border=0.f, float kr_border_ratio=0.1f, const Array *p_noise_r=nullptr, const Array *p_noise_theta=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generate a polar-based shape mask with optional angular and radial perturbations.
Definition polar_shape.cpp:16
Array get_primitive_base(const PrimitiveType &primitive_type, const glm::ivec2 &shape, 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})
Generates a primitive shape as a 2D array.
Definition primitives.cpp:366
float angle(const Point &p1, const Point &p2)
Computes the angle between two points relative to the x-axis.
Definition points.cpp:46
void gain(Array &array, float factor, const Array *p_mask)
Apply a gain correction to the array elements.
Definition filters.cpp:173
Array wave_dune(glm::ivec2 shape, float kw, float angle, float xtop, float xbottom, float phase_shift=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a dune shape wave.
Definition wave.cpp:12
Array disk(glm::ivec2 shape)
Generates a disk-shaped kernel footprint.
Definition kernels.cpp:226
Array cone_complex(glm::ivec2 shape, float alpha, float radius=0.5f, bool smooth_profile=true, float valley_amp=0.2f, int valley_nb=5, float valley_decay_ratio=0.5f, float valley_angle0=15.f, const ErosionProfile &erosion_profile=ErosionProfile::EP_TRIANGLE_GRENIER, float erosion_delta=0.01f, float radial_waviness_amp=0.05f, float radial_waviness_kw=2.f, float bias_angle=30.f, float bias_amp=0.75f, float bias_exponent=1.f, glm::vec2 center={0.5f, 0.5f}, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a complex conical heightfield with valleys, directional bias, and radial waviness.
Definition cone.cpp:70
Array smooth_cosine(glm::ivec2 shape)
Generate a smooth cosine kernel.
Definition kernels.cpp:432
Array rectangle(glm::ivec2 shape, float rx, float ry, float angle, float slope=1.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generates a rectangle-shaped heightmap with optional modifications.
Definition primitives.cpp:263
Array multisteps(glm::ivec2 shape, float angle, float r=1.2f, int nsteps=8, float elevation_exponent=0.7f, float shape_gain=4.f, float scale=0.5f, float outer_slope=0.1f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const glm::vec2 &center={0.5f, 0.5f}, const glm::vec4 &bbox={0.f, 1.f, 0.f, 1.f})
Generate a multi-step height profile along a rotated axis.
Definition multisteps.cpp:17
Array biquad_pulse_y(glm::ivec2 shape, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Definition primitives.cpp:59
Array wave_sine(glm::ivec2 shape, float kw, float angle, float phase_shift=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a sine wave.
Definition wave.cpp:42
Array cone(glm::ivec2 shape)
Generates a cone-shaped kernel array.
Definition kernels.cpp:57