HighMap library (C++)
Loading...
Searching...
No Matches
hmap::GenericFractalFunction Class Reference

A class for generating fractal noise functions based on an underlying noise function. More...

#include <functions.hpp>

Inheritance diagram for hmap::GenericFractalFunction:
Collaboration diagram for hmap::GenericFractalFunction:

Public Member Functions

 GenericFractalFunction (std::unique_ptr< NoiseFunction > p_base, int octaves, float weight, float persistence, float lacunarity)
 Construct a new GenericFractalFunction object.
 
void set_kw (Vec2< float > new_kw) override
 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 (uint new_seed) override
 Set a new random seed for the noise generation.
 
void scale_amp0 (float scale)
 Scale the initial amplitude of 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 (Vec2< float > kw)
 Constructor to initialize with specific frequency scaling.
 
 NoiseFunction (Vec2< float > kw, uint seed)
 Constructor to initialize with specific frequency scaling and seed.
 
Vec2< float > get_kw () const
 Get the frequency scaling vector.
 
uint get_seed () const
 Get the random seed.
 
- Public Member Functions inherited from hmap::Function
 Function ()
 Default constructor. Initializes the delegate function to a default that returns 0.
 
virtual ~Function ()=default
 Virtual destructor to ensure proper cleanup in derived classes.
 
 Function (HMAP_FCT_XY_TYPE delegate)
 Constructor to initialize with a specific delegate function.
 
HMAP_FCT_XY_TYPE get_delegate () const
 Get the current delegate function.
 
float get_value (float x, float y, float ctrl_param) const
 Call the delegate function with given arguments.
 
void set_delegate (HMAP_FCT_XY_TYPE new_delegate)
 Set a new delegate function.
 

Protected Member Functions

void update_amp0 ()
 Update the initial amplitude (amp0) based on the current octaves and persistence.
 

Protected Attributes

std::unique_ptr< NoiseFunctionp_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.
 
- Protected Attributes inherited from hmap::NoiseFunction
Vec2< float > kw
 Frequency scaling vector.
 
uint seed
 Random seed for noise generation.
 

Detailed Description

A class for generating fractal noise functions based on an underlying noise function.

The GenericFractalFunction class generates fractal noise using an underlying base noise function. It allows customization of the fractal properties such as octaves, weight, persistence, and lacunarity.

Constructor & Destructor Documentation

◆ GenericFractalFunction()

hmap::GenericFractalFunction::GenericFractalFunction ( std::unique_ptr< NoiseFunction p_base,
int  octaves,
float  weight,
float  persistence,
float  lacunarity 
)
explicit

Construct a new GenericFractalFunction object.

Parameters
p_baseUnique pointer to the base noise function.
octavesNumber of octaves in the fractal noise.
weightWeight of the base noise function.
persistencePersistence of the fractal noise.
lacunarityLacunarity of the fractal noise.

Member Function Documentation

◆ set_kw()

void hmap::GenericFractalFunction::set_kw ( Vec2< float >  new_kw)
inlineoverridevirtual

Set the frequency scaling vector.

Parameters
new_kwThe new frequency scaling vector.

Reimplemented from hmap::NoiseFunction.

◆ set_lacunarity()

void hmap::GenericFractalFunction::set_lacunarity ( float  new_lacunarity)
inline

Set the lacunarity of the fractal noise.

Parameters
new_lacunarityThe new lacunarity value.

◆ set_octaves()

void hmap::GenericFractalFunction::set_octaves ( int  new_octaves)
inline

Set the number of octaves in the fractal noise.

Parameters
new_octavesThe new number of octaves.

◆ set_persistence()

void hmap::GenericFractalFunction::set_persistence ( float  new_persistence)
inline

Set the persistence of the fractal noise.

Parameters
new_persistenceThe new persistence value.

◆ set_seed()

void hmap::GenericFractalFunction::set_seed ( uint  new_seed)
inlineoverridevirtual

Set a new random seed for the noise generation.

Parameters
new_seedThe new random seed.

Reimplemented from hmap::NoiseFunction.

◆ scale_amp0()

void hmap::GenericFractalFunction::scale_amp0 ( float  scale)
inline

Scale the initial amplitude of the fractal noise.

Parameters
scaleThe scale factor for the initial amplitude.

◆ get_lacunarity()

float hmap::GenericFractalFunction::get_lacunarity ( ) const
inline

Get the lacunarity of the fractal noise.

Returns
The current lacunarity value.

◆ get_octaves()

int hmap::GenericFractalFunction::get_octaves ( ) const
inline

Get the number of octaves in the fractal noise.

Returns
The current number of octaves.

◆ get_persistence()

float hmap::GenericFractalFunction::get_persistence ( ) const
inline

Get the persistence of the fractal noise.

Returns
The current persistence value.

◆ get_weight()

float hmap::GenericFractalFunction::get_weight ( ) const
inline

Get the weight of the fractal noise.

Returns
The current weight value.

◆ update_amp0()

void hmap::GenericFractalFunction::update_amp0 ( )
protected

Update the initial amplitude (amp0) based on the current octaves and persistence.

Member Data Documentation

◆ p_base

std::unique_ptr<NoiseFunction> hmap::GenericFractalFunction::p_base
protected

Unique pointer to the base noise function.

◆ octaves

int hmap::GenericFractalFunction::octaves
protected

Number of octaves in the fractal noise.

◆ weight

float hmap::GenericFractalFunction::weight
protected

Weight of the base noise function.

◆ persistence

float hmap::GenericFractalFunction::persistence
protected

Persistence of the fractal noise.

◆ lacunarity

float hmap::GenericFractalFunction::lacunarity
protected

Lacunarity of the fractal noise.

◆ amp0

float hmap::GenericFractalFunction::amp0
protected

Initial amplitude of the fractal noise.


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