HighMap library (C++)
Loading...
Searching...
No Matches
hmap::FbmSlopeFunction< BaseFn > Class Template Reference

Slope-weighted FBM layering function class. More...

#include <functions.hpp>

Inheritance diagram for hmap::FbmSlopeFunction< BaseFn >:
Collaboration diagram for hmap::FbmSlopeFunction< BaseFn >:

Public Member Functions

float operator() (float x, float y, float ctrl_param=0.f) const
 FbmSlopeFunction (BaseFn base, int octaves, float weight, float persistence, float lacunarity, float gradient_scale, float slope_power, float octave_blend, float bias_angle=0.f, float bias_strength=0.f)
 Construct a new Fbm Slope Function object.
void set_bias (float new_bias_angle, float new_bias_strength)
 Set the directional bias.
void set_gradient_scale (float new_gradient_scale)
 Set the gradient scale.
void set_slope_power (float new_slope_power)
 Set the slope power.
void set_octave_blend (float new_octave_blend)
 Set the octave blend rate.
Public Member Functions inherited from hmap::GenericFractalFunction< BaseFn >
 GenericFractalFunction (BaseFn base, int octaves, float weight, float persistence, float lacunarity)
 Construct a new GenericFractalFunction object.
void set_kw (glm::vec2 new_kw)
 Set the frequency scaling vector.
void set_lacunarity (float new_lacunarity)
 Set the lacunarity of the fractal noise.
void set_octaves (int new_octaves)
 Set the number of octaves in the fractal noise.
void set_persistence (float new_persistence)
 Set the persistence of the fractal noise.
void set_seed (std::uint32_t new_seed)
 Set a new random seed for the noise generation.
void scale_amp0 (float scale)
 Scale the initial amplitude of the fractal noise.
void set_stretch (float new_angle, float new_stretch, float new_stretch_decay=0.f)
 Configure directional stretching for the fractal noise.
float get_lacunarity () const
 Get the lacunarity of the fractal noise.
int get_octaves () const
 Get the number of octaves in the fractal noise.
float get_persistence () const
 Get the persistence of the fractal noise.
float get_weight () const
 Get the weight of the fractal noise.
Public Member Functions inherited from hmap::NoiseFunction
 NoiseFunction ()
 Default constructor. Initializes with default frequency scaling and seed.
 NoiseFunction (glm::vec2 kw)
 Constructor to initialize with specific frequency scaling.
 NoiseFunction (glm::vec2 kw, std::uint32_t seed)
 Constructor to initialize with specific frequency scaling and seed.
glm::vec2 get_kw () const
 Get the frequency scaling vector.
std::uint32_t get_seed () const
 Get the random seed.
void set_seed (std::uint32_t new_seed)
 Set a new random seed for noise generation.
void set_kw (glm::vec2 new_kw)
 Set a new frequency scaling vector.

Protected Attributes

float gradient_scale
 Gradient scale influence.
float slope_power
 Exponent controlling slope transition sharpness.
float octave_blend
 Rate at which higher octaves become slope-masked.
float bias_angle = 0.f
 Preferred slope direction angle in degrees.
float bias_strength = 0.f
 Directional bias strength in [0, 1].
float bias_cos = 1.f
 Cosine of directional bias angle.
float bias_sin = 0.f
 Sine of directional bias angle.
Protected Attributes inherited from hmap::GenericFractalFunction< BaseFn >
BaseFn base
 Unique pointer to the base noise function.
int octaves
 Number of octaves in the fractal noise.
float weight
 Weight of the base noise function.
float persistence
 Persistence of the fractal noise.
float lacunarity
 Lacunarity of the fractal noise.
float amp0
 Initial amplitude of the fractal noise.
float angle = 0.f
 Direction angle in degrees.
float stretch = 1.f
 Stretching factor along the direction.
float stretch_decay = 0.f
 Stretching decay across octaves.
float cos_a = 1.f
 Cosine of direction angle.
float sin_a = 0.f
 Sine of direction angle.
Protected Attributes inherited from hmap::NoiseFunction
glm::vec2 kw
 Frequency scaling vector.
std::uint32_t seed
 Random seed for noise generation.

Additional Inherited Members

Protected Member Functions inherited from hmap::GenericFractalFunction< BaseFn >
void update_amp0 ()
 Update the initial amplitude (amp0) based on the current octaves and persistence.
void apply_stretch (float &x, float &y, int octave) const
 Apply directional stretching to coordinates for a given octave.

Detailed Description

template<typename BaseFn>
class hmap::FbmSlopeFunction< BaseFn >

Slope-weighted FBM layering function class.

Modulates higher-octave amplitude by the accumulated low-frequency gradient norm so that flat areas remain smooth while steep slopes develop rugosity.

Constructor & Destructor Documentation

◆ FbmSlopeFunction()

template<typename BaseFn>
hmap::FbmSlopeFunction< BaseFn >::FbmSlopeFunction ( BaseFn base,
int octaves,
float weight,
float persistence,
float lacunarity,
float gradient_scale,
float slope_power,
float octave_blend,
float bias_angle = 0.f,
float bias_strength = 0.f )

Construct a new Fbm Slope Function object.

Parameters
baseBase noise function.
octavesNumber of octaves.
weightOctave weighting.
persistenceOctave persistence.
lacunarityDefines the wavenumber ratio between each octave.
gradient_scaleGradient scale influence.
slope_powerExponent controlling slope transition sharpness.
octave_blendRate at which higher octaves become slope-masked.
bias_anglePreferred slope direction angle in degrees.
bias_strengthDirectional bias strength in [0, 1].

Member Function Documentation

◆ operator()()

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::operator() ( float x,
float y,
float ctrl_param = 0.f ) const

◆ set_bias()

template<typename BaseFn>
void hmap::FbmSlopeFunction< BaseFn >::set_bias ( float new_bias_angle,
float new_bias_strength )
inline

Set the directional bias.

Parameters
new_bias_anglePreferred slope direction angle in degrees.
new_bias_strengthDirectional bias strength in [0, 1].

◆ set_gradient_scale()

template<typename BaseFn>
void hmap::FbmSlopeFunction< BaseFn >::set_gradient_scale ( float new_gradient_scale)
inline

Set the gradient scale.

Parameters
new_gradient_scaleNew gradient scale.

◆ set_slope_power()

template<typename BaseFn>
void hmap::FbmSlopeFunction< BaseFn >::set_slope_power ( float new_slope_power)
inline

Set the slope power.

Parameters
new_slope_powerNew slope power.

◆ set_octave_blend()

template<typename BaseFn>
void hmap::FbmSlopeFunction< BaseFn >::set_octave_blend ( float new_octave_blend)
inline

Set the octave blend rate.

Parameters
new_octave_blendNew octave blend rate.

Member Data Documentation

◆ gradient_scale

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::gradient_scale
protected

Gradient scale influence.

◆ slope_power

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::slope_power
protected

Exponent controlling slope transition sharpness.

◆ octave_blend

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::octave_blend
protected

Rate at which higher octaves become slope-masked.

◆ bias_angle

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::bias_angle = 0.f
protected

Preferred slope direction angle in degrees.

◆ bias_strength

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::bias_strength = 0.f
protected

Directional bias strength in [0, 1].

◆ bias_cos

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::bias_cos = 1.f
protected

Cosine of directional bias angle.

◆ bias_sin

template<typename BaseFn>
float hmap::FbmSlopeFunction< BaseFn >::bias_sin = 0.f
protected

Sine of directional bias angle.


The documentation for this class was generated from the following files: