#include <Random.h>
Static Public Member Functions | |
static MCORE_INLINE float | RandF () |
static MCORE_INLINE float | RandF (float minVal, float maxVal) |
static AZ::Vector3 | RandDirVecF () |
static MCORE_INLINE AZ::Vector3 | RandomVecF () |
static AZ::Vector3 | RandomDirVec (const AZ::Vector3 &dir, float coneAngle) |
static AZ::Vector3 | RandomDirVec (const AZ::Vector3 &dir, float coneAngle, uint32 gridSizeX, uint32 gridSizeY, uint32 xGridPos, uint32 yGridPos) |
static AZ::Vector3 | RandomDirVec (const AZ::Vector3 &dir, float startPhi, float endPhi, float startTheta, float endTheta, bool midPoint=false) |
static AZ::Vector3 | UVToVector (const AZ::Vector3 &dir, float coneAngle, float u, float v) |
static AZStd::vector< AZ::Vector3 > | RandomDirVectorsStratisfied (const AZ::Vector3 &dir, float coneAngle, uint32 numVectors) |
static AZStd::vector< AZ::Vector3 > | RandomDirVectorsHammersley (const AZ::Vector3 &dir, float coneAngle, uint32 numVectors) |
static AZStd::vector< AZ::Vector3 > | RandomDirVectorsHammersley2 (const AZ::Vector3 &dir, float coneAngle, uint32 numVectors, uint32 base) |
static AZStd::vector< AZ::Vector3 > | RandomDirVectorsHalton (const AZ::Vector3 &dir, float coneAngle, size_t numVectors, uint32 p2=3) |
static AZStd::vector< AZ::Vector3 > | RandomDirVectorsHalton2 (const AZ::Vector3 &dir, float coneAngle, size_t numVectors, uint32 baseA=2, uint32 baseB=3) |
static void | PlaneHalton (float *result, uint32 num, uint32 p2=3) |
static void | PlaneHalton2 (float *result, uint32 num, uint32 baseA=2, uint32 baseB=3) |
static void | PlaneHammersley (float *result, uint32 num) |
static void | PlaneHammersley2 (float *result, uint32 num, uint32 base) |
A random number generation class. This class can generate both random numbers and vectors using several different algorithms.
|
static |
Generates a set of Halton numbers, which are pseudo random numbers.
result | The array to store the resulting numbers in (this needs to be twice as large as the 'num' parameter, since it are two dimensions!) |
num | The number of pointSETS to generate (one set is 2 points). |
p2 | The base number of the set, which must be a prime value. |
|
static |
Generates a set of Halton numbers, which are pseudo random numbers.
result | The array to store the resulting numbers in (this needs to be twice as large as the 'num' parameter, since it are two dimensions!) |
num | The number of pointSETS to generate (one set is 2 points). |
baseA | The first base number of the set, which must be a prime value. |
baseB | The second base number of the set, which must be a prime value. |
|
static |
Generates a set of Hammersley numbers, which are pseudo random numbers.
result | The array to store the resulting numbers in (this needs to be twice as large as the 'num' parameter, since it are two dimensions!) |
num | The number of pointSETS to generate (one set is 2 points). |
|
static |
Generates a set of Hammersley numbers, which are pseudo random numbers.
result | The array to store the resulting numbers in (this needs to be twice as large as the 'num' parameter, since it are two dimensions!) |
num | The number of pointSETS to generate (one set is 2 points). |
base | The base number of the set, which must be a prime value (3 would be a good value). |
|
static |
Generates a uniform random normalized direction vector, using floats.
|
inlinestatic |
Generate a uniform random float in range of [0..1].
|
inlinestatic |
Generate a uniform random float in a range of a given minimum and maximum.
minVal | The minimum value of the range. |
maxVal | The maximum value of the range. |
|
static |
Generates a uniform random direction vector from a given direction and cone angle. This means that if you specify pi as cone angle, with a direction vector of (0,1,0) you will get a random vector on the upper hemisphere above the XZ plane.
dir | The base direction. |
coneAngle | The maximum spread angle in radians, which together with the base direction creates a cone, in which a random vector is generated and returned. |
|
static |
Generates a uniform random direction vector inside a patch on a cone. This can be used for stratisfied sampling, where you divide for example a hemisphere into equally sized sections (grid cells/patches) and you generate a random sample inside the given grid cells.
dir | The base direction. |
coneAngle | The cone angle, in radians, where pi is a hemisphere. |
gridSizeX | The number of grid cells for x (phi). |
gridSizeY | The number of grid cells for y (theta). |
xGridPos | The x (phi) grid number to create a sample in. |
yGridPos | The y (theta) grid number to create a sample in. |
|
static |
Generates a uniform random vector inside a given area on a cone.
dir | The base direction. |
startPhi | The start Phi value of the area to create a random sample in. |
endPhi | The end Phi value of the area to create a random sample in. |
startTheta | The start theta value of the area to create a random sample in. |
endTheta | The end theta value of the area to create a random sample in. |
midPoint | If set to true, the generated random direction will be made exactly in the center of the defined area, so not really random. If set to true, a random sample will be taken inside the specified area. |
|
static |
Generate a given amount of uniform direction vectors using Halton sequences.
dir | The base direction. |
coneAngle | The cone angle in radians, where pi would be a hemisphere. |
numVectors | The number of vectors to generate. |
p2 | The base of the halton sequence (must be a prime value). |
|
static |
Generate a given amount of uniform direction vectors using hammersley sets.
dir | The base direction. |
coneAngle | The cone angle in radians, where pi would be a hemisphere. |
numVectors | The number of vectors to generate. |
baseA | The first base value (must be a prime value). |
baseB | The second base value (must be a prime value). |
|
static |
Generate a given amount of uniform direction vectors using Hammersley sets.
dir | The base direction. |
coneAngle | The cone angle in radians, where pi would be a hemisphere. |
numVectors | The number of vectors to generate. |
|
static |
Generate a given amount of uniform direction vectors using Hammersley sets.
dir | The base direction. |
coneAngle | The cone angle in radians, where pi would be a hemisphere. |
numVectors | The number of vectors to generate. |
base | The base number of the sequence (values of 2 or 3 are nice (must be ap rime value)) |
|
static |
Generate a given number of stratisfied uniform random samples on a cone.
dir | The base direction. |
coneAngle | The angle of the cone in radians, where pi would be a hemisphere. |
numVectors | The number of direction vectors to generate. This might not be the number of vectors returned by this method! |
|
inlinestatic |
Generates a uniform random vector where (x,y,z) are in range of [-1..+1] using floats.
|
static |
Convert an u, v [0..1] to a uniform (so area corrected) direction vector on a specified cone.
dir | The base direction. |
coneAngle | The angle of the cone in radians, so pi would be a hemisphere. |
u | The value for phi, in range of [0..1]. |
v | The value for theta, in range of [0..1]. |