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
43void extrapolate_borders(Array &array, int nbuffer = 1, float sigma = 0.f);
44
73void falloff(Array &array,
74 float strength = 1.f,
76 const Array *p_noise = nullptr,
77 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
78
92void fill_borders(Array &array);
93
94void fill_borders(Array &array, int nbuffer);
95
115Array generate_buffered_array(const Array &array,
116 Vec4<int> buffers,
117 bool zero_padding = false);
118
138void make_periodic(Array &array, int nbuffer);
139
165Array make_periodic_stitching(const Array &array, float overlap);
166
191Array make_periodic_tiling(const Array &array, float overlap, Vec2<int> tiling);
192
214void set_borders(Array &array,
215 Vec4<float> border_values,
216 Vec4<int> buffer_sizes);
217
231void set_borders(Array &array, float border_values, int buffer_sizes);
232
246void sym_borders(Array &array, Vec4<int> buffer_sizes);
247
260void zeroed_borders(Array &array);
261
288void zeroed_edges(Array &array,
289 float sigma = 1.f,
291 const Array *p_noise = nullptr,
292 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
293
294} // 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:28
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:116
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:225
void falloff(Array &array, float strength=1.f, DistanceFunction dist_fct=DistanceFunction::EUCLIDIAN, const Array *p_noise=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Applies a falloff effect to the input array based on distance.
Definition boundary.cpp:77
void make_periodic(Array &array, int nbuffer)
Adjusts the input array to be periodic in both directions by transitioning smoothly at the boundaries...
Definition boundary.cpp:192
Array generate_buffered_array(const Array &array, Vec4< int > 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:154
void sym_borders(Array &array, Vec4< int > buffer_sizes)
Fills the values at the domain borders using symmetry over a specified buffer depth.
Definition boundary.cpp:374
DistanceFunction
Distance function type.
Definition math.hpp:43
@ EUCLIDIAN
Euclidian.
Definition math.hpp:45
void set_borders(Array &array, Vec4< float > border_values, Vec4< int > buffer_sizes)
Enforces specific values at the boundaries of the array.
Definition boundary.cpp:318
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:16
Array make_periodic_tiling(const Array &array, float overlap, Vec2< int > tiling)
Creates a tiled, periodic array by applying a transition with overlap in both directions.
Definition boundary.cpp:293
void zeroed_borders(Array &array)
Fills the border values (e.g., i = 0, j = 0, etc.) of the array with zeros.
Definition boundary.cpp:399
void zeroed_edges(Array &array, float sigma=1.f, DistanceFunction dist_fct=DistanceFunction::EUCLIDIAN, const Array *p_noise=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Applies a smooth transition to zero at the array borders.
Definition boundary.cpp:417