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

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

#include <SLRnd3f.h>

Inheritance diagram for SLRnd3fUniform:
[legend]

Public Member Functions

 SLRnd3fUniform (SLVec3f min, SLVec3f max)
 
 ~SLRnd3fUniform ()
 
SLVec3f generate ()
 

Private Attributes

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

Additional Inherited Members

- Protected Attributes inherited from SLRnd3f
std::default_random_engine _generator
 

Detailed Description

Class for random generator for uniform distributed 3D points.

Definition at line 59 of file SLRnd3f.h.

Constructor & Destructor Documentation

◆ SLRnd3fUniform()

SLRnd3fUniform::SLRnd3fUniform ( SLVec3f  min,
SLVec3f  max 
)
inline

Definition at line 62 of file SLRnd3f.h.

63  {
64  _xDistribution = new std::uniform_real_distribution<SLfloat>(min.x, max.x);
65  _yDistribution = new std::uniform_real_distribution<SLfloat>(min.y, max.y);
66  _zDistribution = new std::uniform_real_distribution<SLfloat>(min.z, max.z);
67  }
std::uniform_real_distribution< SLfloat > * _xDistribution
Definition: SLRnd3f.h:85
std::uniform_real_distribution< SLfloat > * _zDistribution
Definition: SLRnd3f.h:87
std::uniform_real_distribution< SLfloat > * _yDistribution
Definition: SLRnd3f.h:86
T y
Definition: SLVec3.h:43
T x
Definition: SLVec3.h:43
T z
Definition: SLVec3.h:43

◆ ~SLRnd3fUniform()

SLRnd3fUniform::~SLRnd3fUniform ( )
inline

Definition at line 69 of file SLRnd3f.h.

70  {
71  delete _xDistribution;
72  delete _yDistribution;
73  delete _zDistribution;
74  }

Member Function Documentation

◆ generate()

SLVec3f SLRnd3fUniform::generate ( )
inlinevirtual

Implements SLRnd3f.

Definition at line 76 of file SLRnd3f.h.

77  {
78  SLfloat x = _xDistribution->operator()(_generator);
79  SLfloat y = _yDistribution->operator()(_generator);
80  SLfloat z = _zDistribution->operator()(_generator);
81  return SLVec3f(x, y, z);
82  }
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::uniform_real_distribution<SLfloat>* SLRnd3fUniform::_xDistribution
private

Definition at line 85 of file SLRnd3f.h.

◆ _yDistribution

std::uniform_real_distribution<SLfloat>* SLRnd3fUniform::_yDistribution
private

Definition at line 86 of file SLRnd3f.h.

◆ _zDistribution

std::uniform_real_distribution<SLfloat>* SLRnd3fUniform::_zDistribution
private

Definition at line 87 of file SLRnd3f.h.


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