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

Provides functions for calculating gradients and related operations on arrays. This header file defines functions to compute various gradient operations including gradient norms, gradient angles, and Laplacians for 2D arrays. It supports different gradient filters such as Prewitt, Sobel, and Scharr. More...

Go to the source code of this file.

Namespaces

namespace  hmap
 
namespace  hmap::gpu
 

Functions

std::vector< float > hmap::gradient1d (const std::vector< float > &v)
 Compute the gradient of a 1D vector.
 
Array hmap::gradient_angle (const Array &array, bool downward=false)
 Compute the polar angle of the gradient of a 2D array.
 
Array hmap::gradient_norm (const Array &array, Array *p_dx=nullptr, Array *p_dy=nullptr)
 Compute the gradient norm of a 2D array.
 
Array hmap::gradient_norm_prewitt (const Array &array, Array *p_dx=nullptr, Array *p_dy=nullptr)
 Compute the gradient norm of a 2D array using the Prewitt filter.
 
Array hmap::gradient_norm_scharr (const Array &array, Array *p_dx=nullptr, Array *p_dy=nullptr)
 Compute the gradient norm of a 2D array using the Scharr filter.
 
Array hmap::gradient_norm_sobel (const Array &array, Array *p_dx=nullptr, Array *p_dy=nullptr)
 Compute the gradient norm of a 2D array using the Sobel filter.
 
Array hmap::gradient_talus (const Array &array)
 Compute the gradient talus slope of a 2D array.
 
void hmap::gradient_talus (const Array &array, Array &talus)
 Compute the gradient talus slope and store it in the provided array.
 
Array hmap::gradient_x (const Array &array)
 Compute the gradient in the x-direction of a 2D array.
 
void hmap::gradient_x (const Array &array, Array &dx)
 Compute the gradient in the x-direction of a 2D array and store it.
 
Array hmap::gradient_y (const Array &array)
 Compute the gradient in the y-direction of a 2D array.
 
void hmap::gradient_y (const Array &array, Array &dy)
 Compute the gradient in the y-direction of a 2D array and store it.
 
Array hmap::laplacian (const Array &array)
 Compute the Laplacian of a 2D array.
 
Tensor hmap::normal_map (const Array &array)
 Generates a normal map from a given 2D array.
 
Array hmap::normal_map_to_heightmap (const Tensor &nmap)
 Converts a normal map to a heightmap using direct summation of gradients.
 
Array hmap::phase_field (const Array &array, float kw, int width, uint seed, float noise_amp=0.f, int prefilter_ir=-1, float density_factor=1.f, bool rotate90=false, Array *p_gnoise_x=nullptr, Array *p_gnoise_y=nullptr)
 Computes a phase field using spatially varying Gabor noise based on the input heightmap.
 
Array hmap::unwrap_phase (const Array &alpha)
 Unwraps a 2D phase array to correct discontinuities in phase data.
 
Array hmap::gpu::gradient_norm (const Array &array)
 See hmap::gradient_norm.
 

Detailed Description

Provides functions for calculating gradients and related operations on arrays. This header file defines functions to compute various gradient operations including gradient norms, gradient angles, and Laplacians for 2D arrays. It supports different gradient filters such as Prewitt, Sobel, and Scharr.

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