HighMap library (C++)
Loading...
Searching...
No Matches
boundary.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
17#pragma once
18#include "highmap/array.hpp"
19#include "highmap/math.hpp"
20
21namespace hmap
22{
23
28// clang-format off
35// clang-format on
36
41// clang-format off
49// clang-format on
50
70void extrapolate_borders(Array &array, int nbuffer = 1, float sigma = 0.f);
71
100void falloff(Array &array,
101 float strength = 1.f,
103 const Array *p_noise = nullptr,
104 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
105
119void fill_borders(Array &array);
120
121void fill_borders(Array &array, int nbuffer);
122
142Array generate_buffered_array(const Array &array,
143 glm::ivec4 buffers,
144 bool zero_padding = false);
145
165void make_periodic(
166 Array &array,
167 int nbuffer,
168 const PeriodicityType &periodicity_type = PeriodicityType::PERIODICITY_XY);
169
195Array make_periodic_stitching(const Array &array, float overlap);
196
221Array make_periodic_tiling(const Array &array,
222 float overlap,
223 glm::ivec2 tiling);
224
246void set_borders(Array &array,
247 glm::vec4 border_values,
248 glm::ivec4 buffer_sizes);
249
263void set_borders(Array &array, float border_values, int buffer_sizes);
264
278void sym_borders(Array &array, glm::ivec4 buffer_sizes);
279
292void zeroed_borders(Array &array);
293
320void zeroed_edges(Array &array,
321 float sigma = 1.f,
323 const Array *p_noise = nullptr,
324 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
325
326} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Provides core mathematical utilities for procedural generation, including trigonometry,...
Definition algebra.hpp:22
void fill_borders(Array &array)
Fills the border values of an array (e.g., i = 0, j = 0, etc.) based on the values of the first neigh...
Definition boundary.cpp:117
Array make_periodic_stitching(const Array &array, float overlap)
Creates a periodic array in both directions using a stitching operation that minimizes errors at the ...
Definition boundary.cpp:262
DomainBoundary
Describes which domain boundary.
Definition boundary.hpp:43
@ BOUNDARY_TOP
j = 0
Definition boundary.hpp:46
@ BOUNDARY_LEFT
i = 0
Definition boundary.hpp:44
@ BOUNDARY_BOTTOM
j = ny - 1
Definition boundary.hpp:47
@ BOUNDARY_RIGHT
i = nx - 1
Definition boundary.hpp:45
void sym_borders(Array &array, glm::ivec4 buffer_sizes)
Fills the values at the domain borders using symmetry over a specified buffer depth.
Definition boundary.cpp:409
void make_periodic(Array &array, int nbuffer, const PeriodicityType &periodicity_type=PeriodicityType::PERIODICITY_XY)
Adjusts the input array to be periodic in both directions by transitioning smoothly at the boundaries...
Definition boundary.cpp:193
PeriodicityType
Describes the periodicity mode applied along map axes.
Definition boundary.hpp:30
@ PERIODICITY_XY
Periodic along both the X and Y axes.
Definition boundary.hpp:33
@ PERIODICITY_X
Periodic only along the X axis.
Definition boundary.hpp:31
@ PERIODICITY_Y
Periodic only along the Y axis.
Definition boundary.hpp:32
DistanceFunction
Distance function type.
Definition math.hpp:43
@ EUCLIDIAN
Euclidian.
Definition math.hpp:45
void extrapolate_borders(Array &array, int nbuffer=1, float sigma=0.f)
Performs linear extrapolation of values at the borders of an array (e.g., i = 0, j = 0,...
Definition boundary.cpp:17
Array generate_buffered_array(const Array &array, glm::ivec4 buffers, bool zero_padding=false)
Creates and returns a new array with additional buffer zones at the boundaries, where the buffer valu...
Definition boundary.cpp:155
void zeroed_edges(Array &array, float sigma=1.f, DistanceFunction dist_fct=DistanceFunction::EUCLIDIAN, const Array *p_noise=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Applies a smooth transition to zero at the array borders.
Definition boundary.cpp:452
void falloff(Array &array, float strength=1.f, DistanceFunction dist_fct=DistanceFunction::EUCLIDIAN, const Array *p_noise=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Applies a falloff effect to the input array based on distance.
Definition boundary.cpp:78
Array make_periodic_tiling(const Array &array, float overlap, glm::ivec2 tiling)
Creates a tiled, periodic array by applying a transition with overlap in both directions.
Definition boundary.cpp:330
void zeroed_borders(Array &array)
Fills the border values (e.g., i = 0, j = 0, etc.) of the array with zeros.
Definition boundary.cpp:434
void set_borders(Array &array, glm::vec4 border_values, glm::ivec4 buffer_sizes)
Enforces specific values at the boundaries of the array.
Definition boundary.cpp:355