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
81Array band(glm::ivec2 shape,
82 float angle,
83 float length = 0.5f,
84 float width = 0.1f,
86 float profile_param = 0.f,
87 const Array *p_noise_r = nullptr,
88 const Array *p_noise_offset = nullptr,
89 glm::vec2 center = {0.5f, 0.5f},
90 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
91
110Array biquad_pulse(glm::ivec2 shape,
111 float gain = 1.f,
112 const Array *p_ctrl_param = nullptr,
113 const Array *p_noise_x = nullptr,
114 const Array *p_noise_y = nullptr,
115 glm::vec2 center = {0.5f, 0.5f},
116 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
117
118Array biquad_pulse_x(glm::ivec2 shape, glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
119Array biquad_pulse_y(glm::ivec2 shape, glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
120
140Array bump(glm::ivec2 shape,
141 float gain = 1.f,
142 const Array *p_ctrl_param = nullptr, // gain multiplier
143 const Array *p_noise_x = nullptr,
144 const Array *p_noise_y = nullptr,
145 glm::vec2 center = {0.5f, 0.5f},
146 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
147
191Array bump_lorentzian(
192 glm::ivec2 shape,
193 float shape_factor = 0.5f,
194 float radius = 0.5f,
195 const Array *p_ctrl_param = nullptr, // shape_factor multiplier
196 const Array *p_noise_x = nullptr,
197 const Array *p_noise_y = nullptr,
198 glm::vec2 center = {0.5f, 0.5f},
199 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
200
217Array checkerboard(glm::ivec2 shape,
218 glm::vec2 kw,
219 const Array *p_noise_x = nullptr,
220 const Array *p_noise_y = nullptr,
221 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
222
250Array cone(glm::ivec2 shape,
251 float slope,
252 float apex_elevation = 1.f,
253 bool smooth_profile = false,
254 glm::vec2 center = {0.5f, 0.5f},
255 const Array *p_noise_x = nullptr,
256 const Array *p_noise_y = nullptr,
257 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
258
312Array cone_complex(
313 glm::ivec2 shape,
314 float alpha,
315 float radius = 0.5f,
316 bool smooth_profile = true,
317 float valley_amp = 0.2f,
318 int valley_nb = 5,
319 float valley_decay_ratio = 0.5f,
320 float valley_angle0 = 15.f,
322 float erosion_delta = 0.01f,
323 float radial_waviness_amp = 0.05f,
324 float radial_waviness_kw = 2.f,
325 float bias_angle = 30.f,
326 float bias_amp = 0.75f,
327 float bias_exponent = 1.f,
328 glm::vec2 center = {0.5f, 0.5f},
329 const Array *p_ctrl_param = nullptr,
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
365Array cone_sigmoid(glm::ivec2 shape,
366 float alpha,
367 float radius = 0.5f,
368 glm::vec2 center = {0.5f, 0.5f},
369 const Array *p_noise_x = nullptr,
370 const Array *p_noise_y = nullptr,
371 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
372
380Array constant(glm::ivec2 shape, float value = 0.f);
381
385Array cubic_pulse(glm::ivec2 shape,
386 const Array *p_noise_x,
387 const Array *p_noise_y,
388 glm::vec2 center = {0.5f, 0.5f},
389 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
390
425Array disk(glm::ivec2 shape,
426 float radius,
427 float slope = 1.f,
428 const Array *p_ctrl_param = nullptr,
429 const Array *p_noise_x = nullptr,
430 const Array *p_noise_y = nullptr,
431 glm::vec2 center = {0.5f, 0.5f},
432 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
433
454Array gaussian_pulse(glm::ivec2 shape,
455 float sigma,
456 const Array *p_ctrl_param = nullptr,
457 const Array *p_noise_x = nullptr,
458 const Array *p_noise_y = nullptr,
459 glm::vec2 center = {0.5f, 0.5f},
460 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
461
491Array multisteps(glm::ivec2 shape,
492 float angle,
493 float r = 1.2f,
494 int nsteps = 8,
495 float elevation_exponent = 0.7f,
496 float shape_gain = 4.f,
497 float scale = 0.5f,
498 float outer_slope = 0.1f,
499 const Array *p_ctrl_param = nullptr,
500 const Array *p_noise_x = nullptr,
501 const Array *p_noise_y = nullptr,
502 const glm::vec2 &center = {0.5f, 0.5f},
503 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
504
528Array paraboloid(glm::ivec2 shape,
529 float angle,
530 float a,
531 float b,
532 float v0 = 0.f,
533 bool reverse_x = false,
534 bool reverse_y = false,
535 const Array *p_noise_x = nullptr,
536 const Array *p_noise_y = nullptr,
537 glm::vec2 center = {0.5f, 0.5f},
538 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
539
573Array polar_shape(glm::ivec2 shape,
574 float rmin = 0.1f,
575 float rmax = 0.3f,
576 float aspect_ratio = 1.f,
577 float smoothing_width = 0.1f,
578 bool square_base = false,
579 float angle = 15.f,
580 float sector_angle = 90.f,
581 float vmin = 0.5f,
582 float kt_value = 0.f,
583 float kr_border = 0.f,
584 float kr_border_ratio = 0.1f,
585 const Array *p_noise_r = nullptr,
586 const Array *p_noise_theta = nullptr,
587 glm::vec2 center = {0.5f, 0.5f},
588 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
589
628Array rectangle(glm::ivec2 shape,
629 float rx,
630 float ry,
631 float angle,
632 float slope = 1.f,
633 const Array *p_ctrl_param = nullptr,
634 const Array *p_noise_x = nullptr,
635 const Array *p_noise_y = nullptr,
636 glm::vec2 center = {0.5f, 0.5f},
637 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
658Array slope(glm::ivec2 shape,
659 float angle,
660 float slope,
661 const Array *p_ctrl_param = nullptr,
662 const Array *p_noise_x = nullptr,
663 const Array *p_noise_y = nullptr,
664 glm::vec2 center = {0.5f, 0.5f},
665 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
669Array smooth_cosine(glm::ivec2 shape,
670 const Array *p_noise_x,
671 const Array *p_noise_y,
672 glm::vec2 center = {0.5f, 0.5f},
673 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
674
696Array step(glm::ivec2 shape,
697 float angle,
698 float slope,
699 const Array *p_ctrl_param = nullptr,
700 const Array *p_noise_x = nullptr,
701 const Array *p_noise_y = nullptr,
702 glm::vec2 center = {0.5f, 0.5f},
703 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
704
722void swirl(Array &dx,
723 Array &dy,
724 float amplitude = 1.f,
725 float exponent = 1.f,
726 const Array *p_noise = nullptr,
727 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
728
746Array wave_dune(glm::ivec2 shape,
747 float kw,
748 float angle,
749 float xtop,
750 float xbottom,
751 float phase_shift = 0.f,
752 const Array *p_noise_x = nullptr,
753 const Array *p_noise_y = nullptr,
754 glm::vec2 center = {0.5f, 0.5f},
755 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
756
778Array wave_sine(glm::ivec2 shape,
779 float kw,
780 float angle,
781 float phase_shift = 0.f,
782 const Array *p_noise_x = nullptr,
783 const Array *p_noise_y = nullptr,
784 glm::vec2 center = {0.5f, 0.5f},
785 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
786
807Array wave_square(glm::ivec2 shape,
808 float kw,
809 float angle,
810 float phase_shift = 0.f,
811 const Array *p_noise_x = nullptr,
812 const Array *p_noise_y = nullptr,
813 glm::vec2 center = {0.5f, 0.5f},
814 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
815
838Array wave_triangular(glm::ivec2 shape,
839 float kw,
840 float angle,
841 float slant_ratio,
842 float phase_shift = 0.f,
843 const Array *p_noise_x = nullptr,
844 const Array *p_noise_y = nullptr,
845 glm::vec2 center = {0.5f, 0.5f},
846 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
847
848} // namespace hmap
849
850namespace hmap::gpu
851{
852
881Array hemisphere_field(glm::ivec2 shape,
882 glm::vec2 kw,
883 std::uint32_t seed,
884 float rmin = 0.05f,
885 float rmax = 0.8f,
886 float amplitude_random_ratio = 1.f,
887 float density = 0.1f,
888 glm::vec2 jitter = {1.f, 1.f},
889 float shift = 0.f,
890 const Array *p_noise_x = nullptr,
891 const Array *p_noise_y = nullptr,
892 const Array *p_noise_distance = nullptr,
893 const Array *p_density_multiplier = nullptr,
894 const Array *p_size_multiplier = nullptr,
895 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
896
898Array hemisphere_field_fbm(glm::ivec2 shape,
899 glm::vec2 kw,
900 std::uint32_t seed,
901 float rmin = 0.05f,
902 float rmax = 0.8f,
903 float amplitude_random_ratio = 1.f,
904 float density = 0.1f,
905 glm::vec2 jitter = {0.5f, 0.5f},
906 float shift = 0.1f,
907 int octaves = 8,
908 float persistence = 0.5f,
909 float lacunarity = 2.f,
910 const Array *p_noise_x = nullptr,
911 const Array *p_noise_y = nullptr,
912 const Array *p_noise_distance = nullptr,
913 const Array *p_density_multiplier = nullptr,
914 const Array *p_size_multiplier = nullptr,
915 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
916
949Array multisteps(glm::ivec2 shape,
950 float angle,
951 std::uint32_t seed,
952 glm::vec2 kw = {2.f, 2.f},
953 float noise_amp = 0.1f,
954 float noise_rugosity = 0.f,
955 bool noise_inflate = true,
956 float r = 1.2f,
957 int nsteps = 8,
958 float elevation_exponent = 0.7f,
959 float shape_gain = 4.f,
960 float scale = 0.5f,
961 float outer_slope = 0.1f,
962 const Array *p_ctrl_param = nullptr,
963 const glm::vec2 &center = {0.5f, 0.5f},
964 const glm::vec4 &bbox = {0.f, 1.f, 0.f, 1.f});
965
1011Array polygon_field(glm::ivec2 shape,
1012 glm::vec2 kw,
1013 std::uint32_t seed,
1014 float rmin = 0.05f,
1015 float rmax = 0.8f,
1016 float clamping_dist = 0.1f,
1017 float clamping_k = 0.1f,
1018 int n_vertices_min = 3,
1019 int n_vertices_max = 16,
1020 float density = 0.5f,
1021 glm::vec2 jitter = {0.5f, 0.5f},
1022 float shift = 0.1f,
1023 const Array *p_noise_x = nullptr,
1024 const Array *p_noise_y = nullptr,
1025 const Array *p_noise_distance = nullptr,
1026 const Array *p_density_multiplier = nullptr,
1027 const Array *p_size_multiplier = nullptr,
1028 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
1029
1074Array polygon_field_fbm(glm::ivec2 shape,
1075 glm::vec2 kw,
1076 std::uint32_t seed,
1077 float rmin = 0.05f,
1078 float rmax = 0.8f,
1079 float clamping_dist = 0.1f,
1080 float clamping_k = 0.1f,
1081 int n_vertices_min = 3,
1082 int n_vertices_max = 16,
1083 float density = 0.1f,
1084 glm::vec2 jitter = {0.5f, 0.5f},
1085 float shift = 0.1f,
1086 int octaves = 8,
1087 float persistence = 0.5f,
1088 float lacunarity = 2.f,
1089 const Array *p_noise_x = nullptr,
1090 const Array *p_noise_y = nullptr,
1091 const Array *p_noise_distance = nullptr,
1092 const Array *p_density_multiplier = nullptr,
1093 const Array *p_size_multiplier = nullptr,
1094 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
1095
1096} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition blending.hpp:225
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:670
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:440
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:93
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:741
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:375
Definition algebra.hpp:23
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, 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:18
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 biquad_pulse_x(glm::ivec2 shape, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Definition primitives.cpp:45
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, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a paraboloid.
Definition primitives.cpp:260
ErosionProfile
Procedural erosion angular profile type.
Definition profiles.hpp:20
@ EP_TRIANGLE_GRENIER
Definition profiles.hpp:29
RadialProfile
Radial profile type.
Definition profiles.hpp:51
@ RP_SMOOTHSTEP
Definition profiles.hpp:55
Array constant(glm::ivec2 shape, float value=0.f)
Return a constant value array.
Definition primitives.cpp:161
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, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a bump.
Definition primitives.cpp:89
Array cubic_pulse(glm::ivec2 shape)
Generates a cubic pulse kernel array.
Definition kernels.cpp:107
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:116
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 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:162
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: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:165
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, 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:13
Array band(glm::ivec2 shape, float angle, float length=0.5f, float width=0.1f, RadialProfile profile=RadialProfile::RP_SMOOTHSTEP, float profile_param=0.f, const Array *p_noise_r=nullptr, const Array *p_noise_offset=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generate a bounded band (capsule) mask.
Definition band.cpp:17
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, 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:75
Array checkerboard(glm::ivec2 shape, glm::vec2 kw, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return a checkerboard heightmap.
Definition checkerboard.cpp:16
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, 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:303
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:17
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:425
float angle(const Point &p1, const Point &p2)
Computes the angle between two points relative to the x-axis.
Definition points.cpp:52
void gain(Array &array, float factor, const Array *p_mask)
Apply a gain correction to the array elements.
Definition filters.cpp:198
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, 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:233
Array disk(glm::ivec2 shape)
Generates a disk-shaped kernel footprint.
Definition kernels.cpp:245
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, 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:104
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:75
Array smooth_cosine(glm::ivec2 shape)
Generate a smooth cosine kernel.
Definition kernels.cpp:467
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, 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:46
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:18
Array biquad_pulse_y(glm::ivec2 shape, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Definition primitives.cpp:67
Array cone(glm::ivec2 shape)
Generates a cone-shaped kernel array.
Definition kernels.cpp:62
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, 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:395