Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Friends | List of all members
Menge::Math::OBBUniformPosGenerator Class Reference

Generates a 2D float value uniformly distributed in an oriented box (OB). More...

#include <RandGenerator.h>

Inheritance diagram for Menge::Math::OBBUniformPosGenerator:
Menge::Math::Vec2DGenerator

Public Member Functions

 OBBUniformPosGenerator (const Vector2 &minPt, const Vector2 &size, float theta, int seed=0)
 Constructor. More...
 
 OBBUniformPosGenerator (const OBBUniformPosGenerator &obbGen)
 Copy constructor. More...
 
virtual Vector2 getValue () const
 Return a value based on the 2D float generation rules. More...
 
virtual Vector2 getValueConcurrent () const
 Return a value based on the 2D float generation rules - performed in a thread-safe manner. More...
 
virtual void print (Logger &out) const
 Function for converting the generator to a string on a output stream. More...
 
virtual Vec2DGeneratorcopy () const
 Create a copy of itself. More...
 
- Public Member Functions inherited from Menge::Math::Vec2DGenerator
 Vec2DGenerator ()
 Constructor.
 
virtual ~Vec2DGenerator ()
 Virtual destructor.
 

Protected Attributes

UniformFloatGenerator _xRand
 The random selector for the position of the return value along the width of the OB.
 
UniformFloatGenerator _yRand
 The random selector for the position of the return value along the height of the OB.
 
Vector2 _minPt
 The anchor point of the OB.
 
float _cosTheta
 The cosine of the OB's rotation.
 
float _sinTheta
 The sine of the OB's rotation.
 
SimpleLock _lock
 The lock for guaranteeing threadsafe random number generation.
 

Friends

Loggeroperator<< (Logger &out, const OBBUniformPosGenerator &gen)
 Friend function for writing string representation to an output stream. More...
 

Detailed Description

Generates a 2D float value uniformly distributed in an oriented box (OB).

Constructor & Destructor Documentation

Menge::Math::OBBUniformPosGenerator::OBBUniformPosGenerator ( const Vector2 minPt,
const Vector2 size,
float  theta,
int  seed = 0 
)

Constructor.

Parameters
minPtThe anchor point of the OB.
sizeThe size of the OB.
thetaThe rotation around the achor point (in degrees) of the OB.
seedIf the seed is zero, the global seed will be used otherwise the particular seed will be used.
Menge::Math::OBBUniformPosGenerator::OBBUniformPosGenerator ( const OBBUniformPosGenerator obbGen)

Copy constructor.

Parameters
obbGenThe generator to copy its values from.

Member Function Documentation

Vec2DGenerator * Menge::Math::OBBUniformPosGenerator::copy ( ) const
virtual

Create a copy of itself.

Returns
A pointer to a new generator which is a copy of this one. The caller of this function is responsible for freeing up the memory for the copy.

Implements Menge::Math::Vec2DGenerator.

Vector2 Menge::Math::OBBUniformPosGenerator::getValue ( ) const
virtual

Return a value based on the 2D float generation rules.

Returns
A constat position uniformly samples from an OB.

Implements Menge::Math::Vec2DGenerator.

Vector2 Menge::Math::OBBUniformPosGenerator::getValueConcurrent ( ) const
virtual

Return a value based on the 2D float generation rules - performed in a thread-safe manner.

This is the basic functionality that must be overwridden by derived classes.

Returns
A 2D float value.

Implements Menge::Math::Vec2DGenerator.

void Menge::Math::OBBUniformPosGenerator::print ( Logger out) const
virtual

Function for converting the generator to a string on a output stream.

Parameters
outThe output stream to write the string representation to.

Implements Menge::Math::Vec2DGenerator.

Friends And Related Function Documentation

Logger& operator<< ( Logger out,
const OBBUniformPosGenerator gen 
)
friend

Friend function for writing string representation to an output stream.

Parameters
outThe output stream.
genAn instance of the generator to represent as a string.
Returns
Reference to the input output stream.

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