SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLRnd3fNormal Class Reference

Class for random generator for normal distributed 3D points. More...

#include <SLRnd3f.h>

Inheritance diagram for SLRnd3fNormal:
[legend]

Public Member Functions

 SLRnd3fNormal (SLVec3f mean, SLVec3f stddev)
 
 ~SLRnd3fNormal ()
 
SLVec3f generate ()
 

Private Attributes

std::normal_distribution< SLfloat > * _xDistribution
 
std::normal_distribution< SLfloat > * _yDistribution
 
std::normal_distribution< SLfloat > * _zDistribution
 

Additional Inherited Members

- Protected Attributes inherited from SLRnd3f
std::default_random_engine _generator
 

Detailed Description

Class for random generator for normal distributed 3D points.

Definition at line 27 of file SLRnd3f.h.

Constructor & Destructor Documentation

◆ SLRnd3fNormal()

SLRnd3fNormal::SLRnd3fNormal ( SLVec3f  mean,
SLVec3f  stddev 
)
inline

Definition at line 30 of file SLRnd3f.h.

31  {
32  _xDistribution = new std::normal_distribution<SLfloat>(mean.x, stddev.x);
33  _yDistribution = new std::normal_distribution<SLfloat>(mean.y, stddev.y);
34  _zDistribution = new std::normal_distribution<SLfloat>(mean.z, stddev.z);
35  }
std::normal_distribution< SLfloat > * _zDistribution
Definition: SLRnd3f.h:55
std::normal_distribution< SLfloat > * _xDistribution
Definition: SLRnd3f.h:53
std::normal_distribution< SLfloat > * _yDistribution
Definition: SLRnd3f.h:54
T y
Definition: SLVec3.h:43
T x
Definition: SLVec3.h:43
T z
Definition: SLVec3.h:43

◆ ~SLRnd3fNormal()

SLRnd3fNormal::~SLRnd3fNormal ( )
inline

Definition at line 37 of file SLRnd3f.h.

38  {
39  delete _xDistribution;
40  delete _yDistribution;
41  delete _zDistribution;
42  }

Member Function Documentation

◆ generate()

SLVec3f SLRnd3fNormal::generate ( )
inlinevirtual

Implements SLRnd3f.

Definition at line 44 of file SLRnd3f.h.

45  {
46  SLfloat x = _xDistribution->operator()(_generator);
47  SLfloat y = _yDistribution->operator()(_generator);
48  SLfloat z = _zDistribution->operator()(_generator);
49  return SLVec3f(x, y, z);
50  }
float SLfloat
Definition: SL.h:173
SLVec3< SLfloat > SLVec3f
Definition: SLVec3.h:318
std::default_random_engine _generator
Definition: SLRnd3f.h:23

Member Data Documentation

◆ _xDistribution

std::normal_distribution<SLfloat>* SLRnd3fNormal::_xDistribution
private

Definition at line 53 of file SLRnd3f.h.

◆ _yDistribution

std::normal_distribution<SLfloat>* SLRnd3fNormal::_yDistribution
private

Definition at line 54 of file SLRnd3f.h.

◆ _zDistribution

std::normal_distribution<SLfloat>* SLRnd3fNormal::_zDistribution
private

Definition at line 55 of file SLRnd3f.h.


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