DOTS Geometry
 
Loading...
Searching...
No Matches
MathUtil Class Reference

Static Public Member Functions

static uint CompactBitsBy2 (uint value)
 Converts a value [*x*x*x*x] -> [****xxxx].
 
static uint CompactBitsBy3 (uint value)
 Converts a value [*x**x**x] -> [*****xxx].
 
static float Mod (float k, float n)
 Same as the %-operator, but handles negative numbers (on either side of the operation)
 
static int Mod (int k, int n)
 Same as the %-operator, but handles negative numbers (on either side of the operation)
 
static Vector3Int OctreeCellToCoord (uint value)
 Decodes a binary value of form [zyxzyxzyx] to [zzzyyyxxx] and stores the result into a vector.
 
static uint PositionToMortonCode (Vector2Int value)
 Combines, then transforms the x- and y-coordinates from [yyyyxxxx] to [yxyxyxyx] (for 32 bits) (conceptually)
 
static uint PositionToMortonCode (Vector3Int value)
 Combines, then transforms the x-, y- and z-coordinates from [zzzyyyxxx] to [zyxzyxzyx] (for 32 bits) (conceptually)
 
static Vector2Int QuadtreeCellToCoord (uint value)
 Decodes a binary value of form [yxyxyxyx] to [yyyyxxxx] and stores the result into a vector.
 
static uint SplitBitsBy2 (uint value)
 Converts a value [****xxxx] -> [*x*x*x*x].
 
static uint SplitBitsBy3 (uint value)
 Converts a value [*****xxx] -> [*x**x**x].
 

Member Function Documentation

◆ CompactBitsBy2()

static uint CompactBitsBy2 ( uint value)
static

Converts a value [*x*x*x*x] -> [****xxxx].

Parameters
value
Returns

◆ CompactBitsBy3()

static uint CompactBitsBy3 ( uint value)
static

Converts a value [*x**x**x] -> [*****xxx].

Parameters
value
Returns

◆ Mod() [1/2]

static float Mod ( float k,
float n )
static

Same as the %-operator, but handles negative numbers (on either side of the operation)

Parameters
k
n
Returns

◆ Mod() [2/2]

static int Mod ( int k,
int n )
static

Same as the %-operator, but handles negative numbers (on either side of the operation)

Parameters
k
n
Returns

◆ OctreeCellToCoord()

static Vector3Int OctreeCellToCoord ( uint value)
static

Decodes a binary value of form [zyxzyxzyx] to [zzzyyyxxx] and stores the result into a vector.

Parameters
value
Returns

◆ PositionToMortonCode() [1/2]

static uint PositionToMortonCode ( Vector2Int value)
static

Combines, then transforms the x- and y-coordinates from [yyyyxxxx] to [yxyxyxyx] (for 32 bits) (conceptually)

Parameters
value
Returns

◆ PositionToMortonCode() [2/2]

static uint PositionToMortonCode ( Vector3Int value)
static

Combines, then transforms the x-, y- and z-coordinates from [zzzyyyxxx] to [zyxzyxzyx] (for 32 bits) (conceptually)

Parameters
value
Returns

◆ QuadtreeCellToCoord()

static Vector2Int QuadtreeCellToCoord ( uint value)
static

Decodes a binary value of form [yxyxyxyx] to [yyyyxxxx] and stores the result into a vector.

Parameters
value
Returns

◆ SplitBitsBy2()

static uint SplitBitsBy2 ( uint value)
static

Converts a value [****xxxx] -> [*x*x*x*x].

Parameters
value
Returns

◆ SplitBitsBy3()

static uint SplitBitsBy3 ( uint value)
static

Converts a value [*****xxx] -> [*x**x**x].

Parameters
value
Returns