97 float smoothing = 1.f,
98 glm::vec2 center = {0.5f, 0.5f},
99 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
116void rot180(Texture &texture);
133void rot270(Texture &texture);
149void rot90(Array &array);
156void rot90(Texture &texture);
181 bool zero_padding =
false);
237 bool periodic =
false,
238 const Array *p_noise_x =
nullptr,
239 const Array *p_noise_y =
nullptr,
240 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
260Texture
transpose(
const Texture &texture);
280void warp(Array &array,
const Array *p_dx,
const Array *p_dy);
306 float amount = 0.02f,
308 bool reverse =
false);
337 float amount = 0.02f,
339 bool reverse =
false);
363 float amount = 0.02f,
365 bool reverse =
false);
392 float amount = 0.02f,
394 bool reverse =
false);
441Array
zoom(
const Array &array,
443 bool periodic =
false,
444 glm::vec2 center = {0.5f, 0.5f},
445 const Array *p_noise_x =
nullptr,
446 const Array *p_noise_y =
nullptr,
447 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
498 const Array &advected_field,
502 bool reverse =
false,
503 bool post_filter =
true,
504 float post_filter_sigma = 0.125f,
505 float advection_length = 0.1f,
506 float value_persistence = 0.99f,
508 const Array *p_advection_mask =
nullptr,
509 const Array *p_mask =
nullptr);
512 const std::vector<Array> &advected_fields,
516 bool reverse =
false,
517 bool post_filter =
true,
518 float post_filter_sigma = 0.125f,
519 float advection_length = 0.1f,
520 float value_persistence = 0.99f,
522 const Array *p_advection_mask =
nullptr,
523 const Array *p_mask =
nullptr);
526 const Array &advected_field,
529 bool reverse =
false,
530 bool post_filter =
true,
531 float post_filter_sigma = 0.125f,
532 float advection_length = 0.1f,
533 float value_persistence = 0.99f,
535 const Array *p_advection_mask =
nullptr,
536 const Array *p_mask =
nullptr);
539 const std::vector<Array> &advected_fields,
542 bool reverse =
false,
543 bool post_filter =
true,
544 float post_filter_sigma = 0.125f,
545 float advection_length = 0.1f,
546 float value_persistence = 0.99f,
548 const Array *p_advection_mask =
nullptr,
549 const Array *p_mask =
nullptr);
553 const Array &advected_field,
556 bool reverse =
false,
557 bool post_filter =
true,
558 float post_filter_sigma = 0.125f,
559 float advection_length = 0.1f,
560 float value_persistence = 0.99f,
562 const Array *p_advection_mask =
nullptr,
563 const Array *p_mask =
nullptr);
567 const std::vector<Array> &advected_fields,
570 bool reverse =
false,
571 bool post_filter =
true,
572 float post_filter_sigma = 0.125f,
573 float advection_length = 0.1f,
574 float value_persistence = 0.99f,
576 const Array *p_advection_mask =
nullptr,
577 const Array *p_mask =
nullptr);
610 const Array &advected_field,
611 float advection_length = 0.1f,
612 float value_persistence = 0.9f,
613 const Array *p_mask =
nullptr);
616 const Array &advected_field,
619 float advection_length = 0.1f,
620 float value_persistence = 0.9f,
621 const Array *p_mask =
nullptr);
624void rotate(Array &array,
float angle,
bool zoom_in =
true);
627void warp(Array &array,
const Array *p_dx,
const Array *p_dy);
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition blending.hpp:225
Array advection_particle(const Array &z, const Array &advected_field, int iterations, int nparticles, std::uint32_t seed, bool reverse=false, bool post_filter=true, float post_filter_sigma=0.125f, float advection_length=0.1f, float value_persistence=0.99f, float inertia=0.f, const Array *p_advection_mask=nullptr, const Array *p_mask=nullptr)
Performs particle-based advection on a scalar field.
Definition advection_particle_gpu.cpp:22
Array advection_warp(const Array &z, const Array &advected_field, float advection_length=0.1f, float value_persistence=0.9f, const Array *p_mask=nullptr)
Performs 2D field advection based on the gradient of a heightmap using a warp-based technic (simplifi...
Definition advection_warp_gpu.cpp:58
void warp(Array &array, const Array *p_dx, const Array *p_dy)
See hmap::warp.
Definition warp_gpu.cpp:15
void rotate(Array &array, float angle, bool zoom_in=true)
See hmap::rotate.
Definition transform_gpu.cpp:15
Definition algebra.hpp:23
void warp(Array &array, const Array *p_dx, const Array *p_dy)
Apply a warping effect to the array.
Definition warp.cpp:17
void flip_lr(Array &array)
Flip the array horizontally (left/right).
Definition transform.cpp:21
Array zoom(const Array &array, float zoom_factor, bool periodic=false, 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})
Applies a zoom effect to a 2D array with an adjustable center.
Definition transform.cpp:196
void flip_ud(Array &array)
Flip the array vertically (up/down).
Definition transform.cpp:30
void rot180(Array &array)
Rotate the array by 180 degrees.
Definition transform.cpp:68
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:84
Array translate(const Array &array, float dx, float dy, bool periodic=false, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 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:145
void rot270(Array &array)
Rotate the array by 270 degrees.
Definition transform.cpp:76
void rotate(Array &array, float angle, bool zoom_in=true, bool zero_padding=false)
Rotate the array by a specified angle.
Definition transform.cpp:92
Array transpose(const Array &array)
Return the transposed array.
Definition transform.cpp:183
float angle(const Point &p1, const Point &p2)
Computes the angle between two points relative to the x-axis.
Definition points.cpp:52
void rot90(Array &array)
Rotate the array by 90 degrees.
Definition transform.cpp:84
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
void rotate_displacement(const Array &delta, float angle, Array &dx, Array &dy)
Rotates a scalar displacement field into directional X and Y components.
Definition transform.cpp:136
void radial_displacement_to_xy(const Array &dr, Array &dx, Array &dy, float smoothing=1.f, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Interpret the input array dr as a radial displacement and convert it to a pair of displacements dx an...
Definition transform.cpp:39