HighMap library (C++)
Loading...
Searching...
No Matches
transform.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
20#pragma once
21
22#include "macrologger.h"
23
24#include "highmap/array.hpp"
25
26namespace hmap
27{
28
43void flip_lr(Array &array);
44
59void flip_ud(Array &array);
60
69void rot180(Array &array);
70
79void rot270(Array &array);
80
95void rot90(Array &array);
96
116void rotate(Array &array,
117 float angle,
118 bool zoom_in = true,
119 bool zero_padding = false);
120
131Array transpose(const Array &array);
132
168Array translate(const Array &array,
169 float dx,
170 float dy,
171 bool periodic = false,
172 const Array *p_noise_x = nullptr,
173 const Array *p_noise_y = nullptr,
174 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
175
194void warp(Array &array, const Array *p_dx, const Array *p_dy);
195
218void warp_directional(Array &array,
219 float angle,
220 float amount = 0.02f,
221 int ir = 4,
222 bool reverse = false);
223
248void warp_directional(Array &array,
249 float angle,
250 const Array *p_mask,
251 float amount = 0.02f,
252 int ir = 4,
253 bool reverse = false);
254
276void warp_downslope(Array &array,
277 float amount = 0.02f,
278 int ir = 4,
279 bool reverse = false);
280
304void warp_downslope(Array &array,
305 const Array *p_mask,
306 float amount = 0.02f,
307 int ir = 4,
308 bool reverse = false);
309
355Array zoom(const Array &array,
356 float zoom_factor,
357 bool periodic = false,
358 Vec2<float> center = {0.5f, 0.5f},
359 const Array *p_noise_x = nullptr,
360 const Array *p_noise_y = nullptr,
361 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
362
363} // namespace hmap
364
365namespace hmap::gpu
366{
367
369void rotate(Array &array, float angle, bool zoom_in = true);
370
372void warp(Array &array, const Array *p_dx, const Array *p_dy);
373
374} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition blending.hpp:151
void warp(Array &array, const Array *p_dx, const Array *p_dy)
See hmap::warp.
Definition warp_gpu.cpp:9
void rotate(Array &array, float angle, bool zoom_in=true)
See hmap::rotate.
Definition transform_gpu.cpp:9
Definition algebra.hpp:28
void warp(Array &array, const Array *p_dx, const Array *p_dy)
Apply a warping effect to the array.
Definition warp.cpp:19
void flip_lr(Array &array)
Flip the array horizontally (left/right).
Definition transform.cpp:18
void flip_ud(Array &array)
Flip the array vertically (up/down).
Definition transform.cpp:25
void rot180(Array &array)
Rotate the array by 180 degrees.
Definition transform.cpp:32
void warp_downslope(Array &array, float amount=0.02f, int ir=4, bool reverse=false)
Apply a warping effect following the downward local gradient direction (deflate/inflate effect).
Definition warp.cpp:79
Array translate(const Array &array, float dx, float dy, bool periodic=false, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Translates a 2D array by a specified amount along the x and y axes.
Definition transform.cpp:92
void rot270(Array &array)
Rotate the array by 270 degrees.
Definition transform.cpp:38
void rotate(Array &array, float angle, bool zoom_in=true, bool zero_padding=false)
Rotate the array by a specified angle.
Definition transform.cpp:50
Array transpose(const Array &array)
Return the transposed array.
Definition transform.cpp:124
Array zoom(const Array &array, float zoom_factor, bool periodic=false, Vec2< float > center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Applies a zoom effect to a 2D array with an adjustable center.
Definition transform.cpp:135
float angle(const Point &p1, const Point &p2)
Computes the angle between two points relative to the x-axis.
Definition points.cpp:42
void rot90(Array &array)
Rotate the array by 90 degrees.
Definition transform.cpp:44
void warp_directional(Array &array, float angle, float amount=0.02f, int ir=4, bool reverse=false)
Apply a warping effect following the downward local gradient direction (deflate/inflate effect).
Definition warp.cpp:34