FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
noise::FAlphaBranch Class Reference

Class responsible for generating fractional and integer noise components. More...

#include "falpha_branch.h"

Public Member Functions

 FAlphaBranch (std::mt19937 &rngEngine, RealType ffrac, unsigned fint, std::unique_ptr< FAlphaBranch > pre, bool last)
 Constructor for FAlphaBranch.
 
 ~FAlphaBranch ()=default
 
 FAlphaBranch (const FAlphaBranch &)=delete
 
FAlphaBranch & operator= (const FAlphaBranch &)=delete
 
 FAlphaBranch (FAlphaBranch &&)=delete
 
FAlphaBranch & operator= (FAlphaBranch &&)=delete
 
RealType getSample () noexcept
 Retrieves the current noise sample.
 
void flush (RealType scale)
 Flushes the branch with a new scaling factor.
 
FAlphaBranch * getPre () const noexcept
 Retrieves the previous branch in the chain.
 

Detailed Description

Class responsible for generating fractional and integer noise components.

The FAlphaBranch class generates noise by applying a fractional integrator filter. It uses a series of filters and upsamplers to process and shape the noise signal.

Definition at line 32 of file falpha_branch.h.

Constructor & Destructor Documentation

◆ FAlphaBranch() [1/3]

noise::FAlphaBranch::FAlphaBranch ( std::mt19937 &  rngEngine,
RealType  ffrac,
unsigned  fint,
std::unique_ptr< FAlphaBranch >  pre,
bool  last 
)

Constructor for FAlphaBranch.

Parameters
rngEngineThe random number generator engine to use.
ffracFractional part of the noise generation (e.g., 0.5 for 1/f noise).
fintInteger part of the noise generation (e.g., 1 for integration).
prePrevious stage of the FAlphaBranch for recursive noise processing.
lastSpecifies if this is the last branch in the chain of processing.

Definition at line 30 of file falpha_branch.cpp.

31 :
32 _rng_engine_ref(rngEngine), _normal_dist{0.0, 1.0}, _pre(std::move(pre)),
33 _upsample_scale(std::pow(10, ffrac + fint + 0.5)), _buffer(10), _ffrac(ffrac), _fint(fint), _last(last)
34 {
35 LOG(Level::TRACE, "Creating FAlphaBranch: ffrac={} fint={}", ffrac, fint);
36 init();
37
38 if (!_last)
39 {
40 refill();
41 }
42 }
#define LOG(level,...)
Definition logging.h:19
math::Vec3 max

References LOG, and max.

◆ ~FAlphaBranch()

noise::FAlphaBranch::~FAlphaBranch ( )
default

◆ FAlphaBranch() [2/3]

noise::FAlphaBranch::FAlphaBranch ( const FAlphaBranch &  )
delete

◆ FAlphaBranch() [3/3]

noise::FAlphaBranch::FAlphaBranch ( FAlphaBranch &&  )
delete

Member Function Documentation

◆ flush()

void noise::FAlphaBranch::flush ( RealType  scale)

Flushes the branch with a new scaling factor.

Parameters
scaleNew scale factor to apply to the previous stage.

Definition at line 167 of file falpha_branch.cpp.

168 {
169 init();
170 _pre_scale = scale;
171 }

References max.

◆ getPre()

FAlphaBranch * noise::FAlphaBranch::getPre ( ) const
noexcept

Retrieves the previous branch in the chain.

Returns
Pointer to the previous FAlphaBranch, or nullptr if none exists.

Definition at line 76 of file falpha_branch.h.

76{ return _pre.get(); }

◆ getSample()

RealType noise::FAlphaBranch::getSample ( )
noexcept

Retrieves the current noise sample.

Returns
The current noise sample.

Definition at line 108 of file falpha_branch.cpp.

109 {
110 if (!_last)
111 {
112 const RealType ret = _buffer[_buffer_samples++];
113 if (_buffer_samples == 10)
114 {
115 refill();
116 }
117 return ret;
118 }
119 return calcSample() + _offset_sample * _upsample_scale;
120 }
double RealType
Type for real numbers.
Definition config.h:27

References max.

◆ operator=() [1/2]

FAlphaBranch & noise::FAlphaBranch::operator= ( const FAlphaBranch &  )
delete

◆ operator=() [2/2]

FAlphaBranch & noise::FAlphaBranch::operator= ( FAlphaBranch &&  )
delete

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