Ocular Engine
Ocular::Math::MortonCode Class Reference

Static Public Member Functions

static uint64_t calculate (Vector3< float > vector)
 
static uint64_t calculate (float x, float y, float z)
 
static uint64_t calculate (uint32_t x, uint32_t y, uint32_t z)
 
static void calculate (std::vector< Vector3< float >> const &vectors, std::vector< uint64_t > &mortonCodes, bool areInRange=false, bool sortCodes=true)
 

Static Protected Member Functions

static void getTransformFactors (std::vector< Vector3< float >> const &vectors, float &scaleFactor, float &offsetFactor)
 

Member Function Documentation

uint64_t Ocular::Math::MortonCode::calculate ( Vector3< float >  vector)
static

Calculates the Morton Code index value from a vector.

The individual components are expected to be in the range of [0,1].

Parameters
[in]vector
uint64_t Ocular::Math::MortonCode::calculate ( float  x,
float  y,
float  z 
)
static

Calculates the Morton Code index value from a three-component point.

The values are expected to be in the range of [0,1].

Parameters
[in]x
[in]y
[in]z
uint64_t Ocular::Math::MortonCode::calculate ( uint32_t  x,
uint32_t  y,
uint32_t  z 
)
static

Calculates the Morton Code index value from a three-component integer point.

Only the first 21-bits (counting from the right) are used in calculating the Morton Code. This is due to the interleaving of the three integers resulting in a maximum accuracy of (3 * 21 = 63) bits being stored within the resulting 64-bit integer.

Parameters
[in]x
[in]y
[in]z
void Ocular::Math::MortonCode::calculate ( std::vector< Vector3< float >> const &  vectors,
std::vector< uint64_t > &  mortonCodes,
bool  areInRange = false,
bool  sortCodes = true 
)
static

Calculates a collection of Morton Codes for a number of vectors.

Using this method is advantageous to calling the individual calculation methods because:

- Less calls (obvious)
- Can perform range-setting if the input values are not already on the range [0,1]
- Automatically handles instances of duplicate Morton Codes
- Can automatically handle value sorting 
Parameters
[in]vectorsContainer will all input Vectors to calculate the Morton Codes of.
[out]mortonCodesOutput container filled will all of the Morton Codes.
[in]areInRangeIf true, the input values are already on the range [0,1].
[in]sortCodesIf true, the output codes will be sorted in ascending order.
void Ocular::Math::MortonCode::getTransformFactors ( std::vector< Vector3< float >> const &  vectors,
float &  scaleFactor,
float &  offsetFactor 
)
staticprotected

Calculates the transformation factors for the collection of vectors.

The offset factor is used to ensure that all values are positive.
The scale factor is used to map all values to the [0,1] range.

Parameters
[in]vectors
[out]scaleFactor
[out]offsetFactor

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