Helios++
Helios software for LiDAR simulations
NoiseSource< RealType > Class Template Referenceabstract

Class to handle a noise source. More...

#include <NoiseSource.h>

Inheritance diagram for NoiseSource< RealType >:

Public Member Functions

void build ()
 Common behavior for all NoiseSource constructors.
 
double getClipMin ()
 Obtain the clip min value. More...
 
NoiseSourcesetClipMin (RealType clipMin)
 Set the clip min value. More...
 
double getClipMax ()
 Obtain the clip max value. More...
 
NoiseSourcesetClipMax (RealType clipMax)
 Set the clip max value. More...
 
bool isClipEnabled ()
 Check if clipping is enabled or not. More...
 
NoiseSourcesetClipEnabled (bool clipEnabled)
 Enable clipping by setting it to true or disable it by setting to false. More...
 
bool isFixedValueEnabled ()
 Check if fixed value usage is enabled or not. More...
 
unsigned long getFixedLifespan ()
 Obtain the fixed value lifespan. More...
 
NoiseSourcesetFixedLifespan (unsigned long fixedLifespan)
 Set the fixed value lifespan. More...
 
unsigned long getFixedValueRemainingUses ()
 Obtain the remaining uses of current fixed value. More...
 
NoiseSourcesetFixedValueRemainingUses (unsigned long remainingUses)
 Update remaining uses count for current fixed value. More...
 
NoiseSourcefixedRenew ()
 Forces a renewal of fixed value and its remaining uses. More...
 
RealType next ()
 Obtain the next default noise value. More...
 
virtual RealType noiseFunction ()=0
 Function which computes noise values. More...
 

Protected Member Functions

RealType clip (RealType v)
 If clipping is enabled, it will clip received value. If clipping is not enabled, received value will not be clipped. More...
 

Protected Attributes

RealType clipMin = 0.0
 All noise values which are less than clipMin will be clipped to clipMin if clipping is enabled. More...
 
RealType clipMax = 1.0
 All noise values which are greater than clipMax will be clipped to clipMaxx if clipping is enabled.
 
bool clipEnabled = false
 True when clipping is enabled, False otherwise.
 
unsigned long fixedLifespan = 1L
 Specify the how many times a fixed value can be used before being renewed. More...
 
unsigned long fixedRemainingUses = 0L
 How many remaining uses the fixed value has. More...
 
RealType fixedValue = 0
 The fixed value. More...
 

Friends

template<typename _RealType >
std::ostream & operator<< (std::ostream &out, NoiseSource< _RealType > const &ns)
 Output stream behavior.
 

Detailed Description

template<typename RealType>
class NoiseSource< RealType >

Class to handle a noise source.

Author
Alberto M. Esmoris Pena
Version
1.0
Template Parameters
RealTypeType of the generated noise. For instance double or float.

Member Function Documentation

◆ clip()

template<typename RealType>
RealType NoiseSource< RealType >::clip ( RealType  v)
inlineprotected

If clipping is enabled, it will clip received value. If clipping is not enabled, received value will not be clipped.

Returns
Clipped or not clipped received value, depending on if clipping is enabled or not
See also
clipEnabled

◆ fixedRenew()

template<typename RealType >
NoiseSource< RealType > & NoiseSource< RealType >::fixedRenew ( )

Forces a renewal of fixed value and its remaining uses.

Returns
The NoiseSource in a fluent programming fashion
See also
fixedLifespan

◆ getClipMax()

template<typename RealType>
double NoiseSource< RealType >::getClipMax ( )
inline

Obtain the clip max value.

Returns
Clip max value
See also
clipMax

◆ getClipMin()

template<typename RealType>
double NoiseSource< RealType >::getClipMin ( )
inline

Obtain the clip min value.

Returns
Clip min value
See also
clipMin

◆ getFixedLifespan()

template<typename RealType>
unsigned long NoiseSource< RealType >::getFixedLifespan ( )
inline

Obtain the fixed value lifespan.

Returns
Fixed value lifespan
See also
fixedLifespan

◆ getFixedValueRemainingUses()

template<typename RealType>
unsigned long NoiseSource< RealType >::getFixedValueRemainingUses ( )
inline

Obtain the remaining uses of current fixed value.

NOTICE lifespan might be eternal (0L), in which case remaining uses count does not affect the behavior of the noise source

Returns
Remaining uses for current fixed value
See also
fixedRemainingUses

◆ isClipEnabled()

template<typename RealType>
bool NoiseSource< RealType >::isClipEnabled ( )
inline

Check if clipping is enabled or not.

Returns
True if clipping is enabled, false otherwise
See also
clipEnabled

◆ isFixedValueEnabled()

template<typename RealType>
bool NoiseSource< RealType >::isFixedValueEnabled ( )
inline

Check if fixed value usage is enabled or not.

Returns
True if fixed value usage is enabled, false otherwise

◆ next()

template<typename RealType >
RealType NoiseSource< RealType >::next ( )

Obtain the next default noise value.

NOTICE this function considers fixed values.

Returns
Next noise value for default noise
See also
defaultNoiseType
fixedLifespan

◆ noiseFunction()

template<typename RealType>
virtual RealType NoiseSource< RealType >::noiseFunction ( )
pure virtual

Function which computes noise values.

Returns
Computed noise value

Implemented in UniformNoiseSource< RealType >, UniformNoiseSource< double >, and NormalNoiseSource< RealType >.

◆ setClipEnabled()

template<typename RealType>
NoiseSource& NoiseSource< RealType >::setClipEnabled ( bool  clipEnabled)
inline

Enable clipping by setting it to true or disable it by setting to false.

Parameters
clipEnabledTrue to enable clipping, False to disable it
Returns
The NoiseSource reference in a fluent programming fashion
See also
clipEnabled

◆ setClipMax()

template<typename RealType>
NoiseSource& NoiseSource< RealType >::setClipMax ( RealType  clipMax)
inline

Set the clip max value.

Parameters
clipMaxNew clip max value
Returns
The NoiseSource reference in a fluent programming fashion
See also
clipMax

◆ setClipMin()

template<typename RealType>
NoiseSource& NoiseSource< RealType >::setClipMin ( RealType  clipMin)
inline

Set the clip min value.

Parameters
clipMinNew clip min value
Returns
The NoiseSource reference in a fluent programming fashion
See also
clipMin

◆ setFixedLifespan()

template<typename RealType>
NoiseSource& NoiseSource< RealType >::setFixedLifespan ( unsigned long  fixedLifespan)
inline

Set the fixed value lifespan.

NOTICE this does not update fixed value remaining uses

Parameters
fixedLifespanThe new lifespan for fixed values
Returns
The NoiseSource reference in a fluent programming fashion

◆ setFixedValueRemainingUses()

template<typename RealType>
NoiseSource& NoiseSource< RealType >::setFixedValueRemainingUses ( unsigned long  remainingUses)
inline

Update remaining uses count for current fixed value.

Parameters
remainingUsesNew remaining uses count
Returns
The NoiseSource reference in a fluent programming fashion

Member Data Documentation

◆ clipMin

template<typename RealType>
RealType NoiseSource< RealType >::clipMin = 0.0
protected

All noise values which are less than clipMin will be clipped to clipMin if clipping is enabled.

See also
clipEnabled

◆ fixedLifespan

template<typename RealType>
unsigned long NoiseSource< RealType >::fixedLifespan = 1L
protected

Specify the how many times a fixed value can be used before being renewed.



NOTICE a value of 0 means the fixed value will not be renewed, unless manually specified through fixedRenew function invocation.



A value of 1 means the fixed value will be renewed between each pair of consecutive uses, hence it behaves like if it was not a fixed value



Having fixed enabled (fixedLifespan != 1) means a noise value will be computed one time and always that a next noise value is requested the previously computed fixed value will be returned, as long as its lifespan has not expired yet



WARNING fixed value only is considered when obtaining noise through next function. Specific noise functions do not support fixed values.

◆ fixedRemainingUses

template<typename RealType>
unsigned long NoiseSource< RealType >::fixedRemainingUses = 0L
protected

How many remaining uses the fixed value has.

See also
fixedLifespan

◆ fixedValue

template<typename RealType>
RealType NoiseSource< RealType >::fixedValue = 0
protected

The fixed value.

See also
fixedLifespan

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