HighMap library (C++)
Loading...
Searching...
No Matches
transform.hpp File Reference

Header file for array transformation functions including rotation, flipping, symmetry, translation, transposition, and zooming. More...

Go to the source code of this file.

Namespaces

namespace  hmap
namespace  hmap::gpu

Enumerations

enum  hmap::SymmetryType : int {
  hmap::SYMMETRY_LEFT_TO_RIGHT , hmap::SYMMETRY_RIGHT_TO_LEFT , hmap::SYMMETRY_TOP_TO_BOTTOM , hmap::SYMMETRY_BOTTOM_TO_TOP ,
  hmap::SYMMETRY_X , hmap::SYMMETRY_Y , hmap::SYMMETRY_XY , hmap::SYMMETRY_ROT180
}
 Describes the symmetry operation to apply to an array. More...

Functions

void hmap::flip_lr (Array &array)
 Flip the array horizontally (left/right).
void hmap::flip_ud (Array &array)
 Flip the array vertically (up/down).
void hmap::radial_displacement_to_xy (const Array &dr, Array &dx, Array &dy, float smoothing=1.f, glm::vec2 center={0.5f, 0.5f}, const UvRect &uv_rect=UvRect::unit())
 Interpret the input array dr as a radial displacement and convert it to a pair of displacements dx and dy in cartesian coordinates.
void hmap::rot180 (Array &array)
 Rotate the array by 180 degrees.
void hmap::rot270 (Array &array)
 Rotate the array by 270 degrees.
void hmap::rot90 (Array &array)
 Rotate the array by 90 degrees.
void hmap::rotate (Array &array, float angle, bool zoom_in=true, bool zero_padding=false)
 Rotate the array by a specified angle.
void hmap::rotate_displacement (const Array &delta, float angle, Array &dx, Array &dy)
 Rotates a scalar displacement field into directional X and Y components.
void hmap::scale_uv (Array &array, glm::vec2 uv_scale)
 Scale the array in UV space with wrapping boundary.
Array hmap::symmetrize (const Array &array, SymmetryType symmetry_type=SymmetryType::SYMMETRY_LEFT_TO_RIGHT, bool flatten_center=false, float flatten_radius=0.05f)
 Enforces geometric symmetry on an array.
Array hmap::translate (const Array &array, float dx, float dy, bool periodic=false, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const UvRect &uv_rect=UvRect::unit())
 Translates a 2D array by a specified amount along the x and y axes.
Array hmap::transpose (const Array &array)
 Return the transposed array.
Array hmap::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, const UvRect &uv_rect=UvRect::unit())
 Applies a zoom effect to a 2D array with an adjustable center.
void hmap::gpu::rotate (Array &array, float angle, bool zoom_in=true)
 See hmap::rotate.

Detailed Description

Header file for array transformation functions including rotation, flipping, symmetry, translation, transposition, and zooming.

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)