HighMap library (C++)
Loading...
Searching...
No Matches
range.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
19#include "highmap/array.hpp"
20
21namespace hmap
22{
23
43void chop(Array &array, float vmin);
44
67void chop_max_smooth(Array &array, float vmax);
68
89void clamp(Array &array, float vmin = 0, float vmax = 1);
90
102void clamp_min(Array &array, float vmin);
103void clamp_min(Array &array, const Array &vmin);
104
116void clamp_min_smooth(Array &array, float vmin, float k = 0.2f);
117
118void clamp_min_smooth(Array &array,
119 const Array &vmin,
120 float k = 0.2f);
121
135float clamp_min_smooth(float x, float vmin, float k = 0.2f);
136
148void clamp_max(Array &array, float vmax);
149void clamp_max(Array &array, const Array &vmax);
150
162void clamp_max_smooth(Array &array, float vmax, float k = 0.2f);
163
164void clamp_max_smooth(Array &array,
165 const Array &vmax,
166 float k = 0.2f);
167
182void clamp_smooth(Array &array, float vmin, float vmax, float k = 0.2f);
183
195Array maximum(const Array &array1, const Array &array2);
196
208Array maximum(const Array &array1, const float value);
209
238Array maximum_smooth(const Array &array1, const Array &array2, float k = 0.2);
239
265float maximum_smooth(const float a,
266 const float b,
267 float k = 0.2);
268
280Array minimum(const Array &array1, const Array &array2);
281
293Array minimum(const Array &array1, const float value);
294
313Array minimum_smooth(const Array &array1, const Array &array2, float k = 0.2);
314
329float minimum_smooth(const float a, const float b, float k);
330
350void remap(Array &array,
351 float vmin,
352 float vmax,
353 float from_min,
354 float from_max);
355
368void remap(Array &array, float vmin = 0, float vmax = 1);
369
384void rescale(Array &array, float scaling, float vref = 0.f);
385
386} // namespace hmap
387
388namespace hmap::gpu
389{
390
392Array maximum_smooth(const Array &array1, const Array &array2, float k = 0.2f);
393
395Array minimum_smooth(const Array &array1, const Array &array2, float k = 0.2f);
396
397} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition blending.hpp:151
Array minimum_smooth(const Array &array1, const Array &array2, float k=0.2f)
See hmap::minimum_smooth.
Definition range_cpu.cpp:29
Array maximum_smooth(const Array &array1, const Array &array2, float k=0.2f)
See hmap::maximum_smooth.
Definition range_cpu.cpp:9
Definition algebra.hpp:28
void chop_max_smooth(Array &array, float vmax)
Set to zero any value lower than vmax and apply a linear decrease slope between vmax / 2 and vmax.
Definition range.cpp:26
void remap(Array &array, float vmin, float vmax, float from_min, float from_max)
Remap array elements from a starting range to a target range.
Definition range.cpp:374
void clamp(Array &array, float vmin=0, float vmax=1)
Clamp array elements to a target range.
Definition range.cpp:43
void clamp_min(Array &array, float vmin)
Clamp array values lower than a given bound.
Definition range.cpp:103
void clamp_min_smooth(Array &array, float vmin, float k=0.2f)
Clamp array values lower than a given bound with a smooth transition.
Definition range.cpp:124
Array minimum_smooth(const Array &array1, const Array &array2, float k=0.2)
Return the polynomial cubic smooth element-wise minimum of two arrays.
Definition range.cpp:326
void clamp_smooth(Array &array, float vmin, float vmax, float k=0.2f)
Clamp array values within a given interval with a smooth transition.
Definition range.cpp:159
void clamp_max_smooth(Array &array, float vmax, float k=0.2f)
Clamp array values larger than a given bound with a smooth transition.
Definition range.cpp:74
Array maximum_smooth(const Array &array1, const Array &array2, float k=0.2)
Return the polynomial cubic smooth element-wise maximum of two arrays.
Definition range.cpp:266
Array maximum(const Array &array1, const Array &array2)
Return the element-wise maximum of two arrays.
Definition range.cpp:179
void chop(Array &array, float vmin)
Set to zero any value lower than vmin.
Definition range.cpp:16
void rescale(Array &array, float scaling, float vref=0.f)
Remap array elements from a starting range to a target range.
Definition range.cpp:390
void clamp_max(Array &array, float vmax)
Clamp array values larger than a given bound.
Definition range.cpp:53
Array minimum(const Array &array1, const Array &array2)
Return the element-wise minimum of two arrays.
Definition range.cpp:295