3. Math library
Floating point math in general is not bit-precise. Compiler can optimize permutations, replace divisions with multiplications, and some of functions are not bit-exact. If you need precise math use double precision type. All functions and symbols are in “math” module, use require to get access to it.
require math
3.1. Constants
- PI = 3.1415927f
The ratio of a circle’s circumference to its diameter. π
- DBL_PI = 3.141592653589793lf
The ratio of a circle’s circumference to its diameter. π
- FLT_EPSILON = 1.1920929e-07f
the difference between 1 and the smallest floating point number of type float that is greater than 1.
- DBL_EPSILON = 2.220446049250313e-16lf
the difference between 1 and the smallest double precision floating point number of type double that is greater than 1.
3.2. Handled structures
- float4x4
float4x4 fields are
| z | float4 | 
| w | float4 | 
| y | float4 | 
| x | float4 | 
floating point matrix with 4 rows and 4 columns
- float3x4
float3x4 fields are
| z | float3 | 
| w | float3 | 
| y | float3 | 
| x | float3 | 
floating point matrix with 4 rows and 3 columns
- float3x3
float3x3 fields are
| z | float3 | 
| y | float3 | 
| x | float3 | 
floating point matrix with 3 rows and 3 columns
3.3. all numerics (uint*, int*, float*, double)
- min(x: int const; y: int const)
min returns int const
| argument | argument type | 
|---|---|
| x | int const | 
| y | int const | 
returns the minimum of x and y
- max(x: int const; y: int const)
max returns int const
| argument | argument type | 
|---|---|
| x | int const | 
| y | int const | 
returns the maximum of x and y
- min(x: int2 const; y: int2 const)
min returns int2 const
| argument | argument type | 
|---|---|
| x | int2 const | 
| y | int2 const | 
returns the minimum of x and y
- max(x: int2 const; y: int2 const)
max returns int2 const
| argument | argument type | 
|---|---|
| x | int2 const | 
| y | int2 const | 
returns the maximum of x and y
- min(x: int3 const; y: int3 const)
min returns int3 const
| argument | argument type | 
|---|---|
| x | int3 const | 
| y | int3 const | 
returns the minimum of x and y
- max(x: int3 const; y: int3 const)
max returns int3 const
| argument | argument type | 
|---|---|
| x | int3 const | 
| y | int3 const | 
returns the maximum of x and y
- min(x: int4 const; y: int4 const)
min returns int4 const
| argument | argument type | 
|---|---|
| x | int4 const | 
| y | int4 const | 
returns the minimum of x and y
- max(x: int4 const; y: int4 const)
max returns int4 const
| argument | argument type | 
|---|---|
| x | int4 const | 
| y | int4 const | 
returns the maximum of x and y
- min(x: uint const; y: uint const)
min returns uint const
| argument | argument type | 
|---|---|
| x | uint const | 
| y | uint const | 
returns the minimum of x and y
- max(x: uint const; y: uint const)
max returns uint const
| argument | argument type | 
|---|---|
| x | uint const | 
| y | uint const | 
returns the maximum of x and y
- min(x: uint2 const; y: uint2 const)
min returns uint2 const
| argument | argument type | 
|---|---|
| x | uint2 const | 
| y | uint2 const | 
returns the minimum of x and y
- max(x: uint2 const; y: uint2 const)
max returns uint2 const
| argument | argument type | 
|---|---|
| x | uint2 const | 
| y | uint2 const | 
returns the maximum of x and y
- min(x: uint3 const; y: uint3 const)
min returns uint3 const
| argument | argument type | 
|---|---|
| x | uint3 const | 
| y | uint3 const | 
returns the minimum of x and y
- max(x: uint3 const; y: uint3 const)
max returns uint3 const
| argument | argument type | 
|---|---|
| x | uint3 const | 
| y | uint3 const | 
returns the maximum of x and y
- min(x: uint4 const; y: uint4 const)
min returns uint4 const
| argument | argument type | 
|---|---|
| x | uint4 const | 
| y | uint4 const | 
returns the minimum of x and y
- max(x: uint4 const; y: uint4 const)
max returns uint4 const
| argument | argument type | 
|---|---|
| x | uint4 const | 
| y | uint4 const | 
returns the maximum of x and y
- min(x: float const; y: float const)
min returns float const
| argument | argument type | 
|---|---|
| x | float const | 
| y | float const | 
returns the minimum of x and y
- max(x: float const; y: float const)
max returns float const
| argument | argument type | 
|---|---|
| x | float const | 
| y | float const | 
returns the maximum of x and y
- min(x: float2 const; y: float2 const)
min returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns the minimum of x and y
- max(x: float2 const; y: float2 const)
max returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns the maximum of x and y
- min(x: float3 const; y: float3 const)
min returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns the minimum of x and y
- max(x: float3 const; y: float3 const)
max returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns the maximum of x and y
- min(x: float4 const; y: float4 const)
min returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns the minimum of x and y
- max(x: float4 const; y: float4 const)
max returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns the maximum of x and y
- min(x: double const; y: double const)
min returns double const
| argument | argument type | 
|---|---|
| x | double const | 
| y | double const | 
returns the minimum of x and y
- max(x: double const; y: double const)
max returns double const
| argument | argument type | 
|---|---|
| x | double const | 
| y | double const | 
returns the maximum of x and y
- min(x: int64 const; y: int64 const)
min returns int64 const
| argument | argument type | 
|---|---|
| x | int64 const | 
| y | int64 const | 
returns the minimum of x and y
- max(x: int64 const; y: int64 const)
max returns int64 const
| argument | argument type | 
|---|---|
| x | int64 const | 
| y | int64 const | 
returns the maximum of x and y
- min(x: uint64 const; y: uint64 const)
min returns uint64 const
| argument | argument type | 
|---|---|
| x | uint64 const | 
| y | uint64 const | 
returns the minimum of x and y
- max(x: uint64 const; y: uint64 const)
max returns uint64 const
| argument | argument type | 
|---|---|
| x | uint64 const | 
| y | uint64 const | 
returns the maximum of x and y
3.4. float* and double
- sin(x: float const)
sin returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the sine of x
- cos(x: float const)
cos returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the cosine of x
- tan(x: float const)
tan returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the tangent of x
- sin(x: float2 const)
sin returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the sine of x
- cos(x: float2 const)
cos returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the cosine of x
- tan(x: float2 const)
tan returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the tangent of x
- sin(x: float3 const)
sin returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the sine of x
- cos(x: float3 const)
cos returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the cosine of x
- tan(x: float3 const)
tan returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the tangent of x
- sin(x: float4 const)
sin returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the sine of x
- cos(x: float4 const)
cos returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the cosine of x
- tan(x: float4 const)
tan returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the tangent of x
- exp(x: float const)
exp returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the e^x value of x
- log(x: float const)
log returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the natural logarithm of x
- exp2(x: float const)
exp2 returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the 2^x value of x
- log2(x: float const)
log2 returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the logarithm base-2 of x
- rcp(x: float const)
rcp returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the 1/x
- pow(x: float const; y: float const)
pow returns float const
| argument | argument type | 
|---|---|
| x | float const | 
| y | float const | 
returns x raised to the power of y
- exp(x: float2 const)
exp returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the e^x value of x
- log(x: float2 const)
log returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the natural logarithm of x
- exp2(x: float2 const)
exp2 returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the 2^x value of x
- log2(x: float2 const)
log2 returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the logarithm base-2 of x
- rcp(x: float2 const)
rcp returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the 1/x
- pow(x: float2 const; y: float2 const)
pow returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns x raised to the power of y
- exp(x: float3 const)
exp returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the e^x value of x
- log(x: float3 const)
log returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the natural logarithm of x
- exp2(x: float3 const)
exp2 returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the 2^x value of x
- log2(x: float3 const)
log2 returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the logarithm base-2 of x
- rcp(x: float3 const)
rcp returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the 1/x
- pow(x: float3 const; y: float3 const)
pow returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns x raised to the power of y
- exp(x: float4 const)
exp returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the e^x value of x
- log(x: float4 const)
log returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the natural logarithm of x
- exp2(x: float4 const)
exp2 returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the 2^x value of x
- log2(x: float4 const)
log2 returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the logarithm base-2 of x
- rcp(x: float4 const)
rcp returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the 1/x
- pow(x: float4 const; y: float4 const)
pow returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns x raised to the power of y
- floor(x: float const)
floor returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns a float value representing the largest integer that is less than or equal to x
- ceil(x: float const)
ceil returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns a float value representing the smallest integer (type is still float) that is greater than or equal to arg0
- sqrt(x: float const)
sqrt returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the square root of x
- saturate(x: float const)
saturate returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns a clamped to [0..1] inclusive range x
- floor(x: float2 const)
floor returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a float value representing the largest integer that is less than or equal to x
- ceil(x: float2 const)
ceil returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a float value representing the smallest integer (type is still float) that is greater than or equal to arg0
- sqrt(x: float2 const)
sqrt returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the square root of x
- saturate(x: float2 const)
saturate returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a clamped to [0..1] inclusive range x
- floor(x: float3 const)
floor returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a float value representing the largest integer that is less than or equal to x
- ceil(x: float3 const)
ceil returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a float value representing the smallest integer (type is still float) that is greater than or equal to arg0
- sqrt(x: float3 const)
sqrt returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the square root of x
- saturate(x: float3 const)
saturate returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a clamped to [0..1] inclusive range x
- floor(x: float4 const)
floor returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a float value representing the largest integer that is less than or equal to x
- ceil(x: float4 const)
ceil returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a float value representing the smallest integer (type is still float) that is greater than or equal to arg0
- sqrt(x: float4 const)
sqrt returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the square root of x
- saturate(x: float4 const)
saturate returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a clamped to [0..1] inclusive range x
- abs(x: int const)
abs returns int const
| argument | argument type | 
|---|---|
| x | int const | 
returns the absolute value of x
- sign(x: int const)
sign returns int const
| argument | argument type | 
|---|---|
| x | int const | 
returns sign of x, or 0 if x == 0
- abs(x: int2 const)
abs returns int2 const
| argument | argument type | 
|---|---|
| x | int2 const | 
returns the absolute value of x
- sign(x: int2 const)
sign returns int2 const
| argument | argument type | 
|---|---|
| x | int2 const | 
returns sign of x, or 0 if x == 0
- abs(x: int3 const)
abs returns int3 const
| argument | argument type | 
|---|---|
| x | int3 const | 
returns the absolute value of x
- sign(x: int3 const)
sign returns int3 const
| argument | argument type | 
|---|---|
| x | int3 const | 
returns sign of x, or 0 if x == 0
- abs(x: int4 const)
abs returns int4 const
| argument | argument type | 
|---|---|
| x | int4 const | 
returns the absolute value of x
- sign(x: int4 const)
sign returns int4 const
| argument | argument type | 
|---|---|
| x | int4 const | 
returns sign of x, or 0 if x == 0
- abs(x: uint const)
abs returns uint const
| argument | argument type | 
|---|---|
| x | uint const | 
returns the absolute value of x
- sign(x: uint const)
sign returns uint const
| argument | argument type | 
|---|---|
| x | uint const | 
returns sign of x, or 0 if x == 0
- abs(x: uint2 const)
abs returns uint2 const
| argument | argument type | 
|---|---|
| x | uint2 const | 
returns the absolute value of x
- sign(x: uint2 const)
sign returns uint2 const
| argument | argument type | 
|---|---|
| x | uint2 const | 
returns sign of x, or 0 if x == 0
- abs(x: uint3 const)
abs returns uint3 const
| argument | argument type | 
|---|---|
| x | uint3 const | 
returns the absolute value of x
- sign(x: uint3 const)
sign returns uint3 const
| argument | argument type | 
|---|---|
| x | uint3 const | 
returns sign of x, or 0 if x == 0
- abs(x: uint4 const)
abs returns uint4 const
| argument | argument type | 
|---|---|
| x | uint4 const | 
returns the absolute value of x
- sign(x: uint4 const)
sign returns uint4 const
| argument | argument type | 
|---|---|
| x | uint4 const | 
returns sign of x, or 0 if x == 0
- abs(x: float const)
abs returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the absolute value of x
- sign(x: float const)
sign returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns sign of x, or 0 if x == 0
- abs(x: float2 const)
abs returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the absolute value of x
- sign(x: float2 const)
sign returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns sign of x, or 0 if x == 0
- abs(x: float3 const)
abs returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the absolute value of x
- sign(x: float3 const)
sign returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns sign of x, or 0 if x == 0
- abs(x: float4 const)
abs returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the absolute value of x
- sign(x: float4 const)
sign returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns sign of x, or 0 if x == 0
- abs(x: double const)
abs returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the absolute value of x
- sign(x: double const)
sign returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns sign of x, or 0 if x == 0
- abs(x: int64 const)
abs returns int64 const
| argument | argument type | 
|---|---|
| x | int64 const | 
returns the absolute value of x
- sign(x: int64 const)
sign returns int64 const
| argument | argument type | 
|---|---|
| x | int64 const | 
returns sign of x, or 0 if x == 0
- abs(x: uint64 const)
abs returns uint64 const
| argument | argument type | 
|---|---|
| x | uint64 const | 
returns the absolute value of x
- sign(x: uint64 const)
sign returns uint64 const
| argument | argument type | 
|---|---|
| x | uint64 const | 
returns sign of x, or 0 if x == 0
- is_nan(x: float const)
is_nan returns bool const
| argument | argument type | 
|---|---|
| x | float const | 
Returns true if x is NaN (not a number)
- is_finite(x: float const)
is_finite returns bool const
| argument | argument type | 
|---|---|
| x | float const | 
Returns true if x is not a negative or positive infinity
- is_nan(x: double const)
is_nan returns bool const
| argument | argument type | 
|---|---|
| x | double const | 
Returns true if x is NaN (not a number)
- is_finite(x: double const)
is_finite returns bool const
| argument | argument type | 
|---|---|
| x | double const | 
Returns true if x is not a negative or positive infinity
- sqrt(x: double const)
sqrt returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the square root of x
- exp(x: double const)
exp returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the e^x value of x
- rcp(x: double const)
rcp returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the 1/x
- log(x: double const)
log returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the natural logarithm of x
- pow(x: double const; y: double const)
pow returns double const
| argument | argument type | 
|---|---|
| x | double const | 
| y | double const | 
returns x raised to the power of y
- exp2(x: double const)
exp2 returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the 2^x value of x
- log2(x: double const)
log2 returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the logarithm base-2 of x
- sin(x: double const)
sin returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the sine of x
- cos(x: double const)
cos returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the cosine of x
- asin(x: double const)
asin returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the arcsine of x
- acos(x: double const)
acos returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the arccosine of x
- safe_asin(x: double const)
safe_asin returns double const
| argument | argument type | 
|---|---|
| x | double const | 
Returns the arcsine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_acos(x: double const)
safe_acos returns double const
| argument | argument type | 
|---|---|
| x | double const | 
Returns the arccosine of x, clamping x to the [-1..1] range to avoid NaN results.
- tan(x: double const)
tan returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the tangent of x
- atan(x: double const)
atan returns double const
| argument | argument type | 
|---|---|
| x | double const | 
returns the arctangent of x
- atan2(y: double const; x: double const)
atan2 returns double const
| argument | argument type | 
|---|---|
| y | double const | 
| x | double const | 
returns the arctangent of y/x
- sincos(x: float const; s: float& implicit; c: float& implicit)
| argument | argument type | 
|---|---|
| x | float const | 
| s | float& implicit | 
| c | float& implicit | 
returns oth sine and cosine of x
- sincos(x: double const; s: double& implicit; c: double& implicit)
| argument | argument type | 
|---|---|
| x | double const | 
| s | double& implicit | 
| c | double& implicit | 
returns oth sine and cosine of x
- asin(x: float const)
asin returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the arcsine of x
- acos(x: float const)
acos returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the arccosine of x
- safe_asin(x: float const)
safe_asin returns float const
| argument | argument type | 
|---|---|
| x | float const | 
Returns the arcsine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_acos(x: float const)
safe_acos returns float const
| argument | argument type | 
|---|---|
| x | float const | 
Returns the arccosine of x, clamping x to the [-1..1] range to avoid NaN results.
- atan(x: float const)
atan returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the arctangent of x
- atan2(y: float const; x: float const)
atan2 returns float const
| argument | argument type | 
|---|---|
| y | float const | 
| x | float const | 
returns the arctangent of y/x
- asin(x: float2 const)
asin returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the arcsine of x
- asin(x: float3 const)
asin returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the arcsine of x
- asin(x: float4 const)
asin returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the arcsine of x
- acos(x: float2 const)
acos returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the arccosine of x
- acos(x: float3 const)
acos returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the arccosine of x
- acos(x: float4 const)
acos returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the arccosine of x
- safe_asin(x: float2 const)
safe_asin returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
Returns the arcsine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_asin(x: float3 const)
safe_asin returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
Returns the arcsine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_asin(x: float4 const)
safe_asin returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
Returns the arcsine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_acos(x: float2 const)
safe_acos returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
Returns the arccosine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_acos(x: float3 const)
safe_acos returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
Returns the arccosine of x, clamping x to the [-1..1] range to avoid NaN results.
- safe_acos(x: float4 const)
safe_acos returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
Returns the arccosine of x, clamping x to the [-1..1] range to avoid NaN results.
- atan(x: float2 const)
atan returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the arctangent of x
- atan(x: float3 const)
atan returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the arctangent of x
- atan(x: float4 const)
atan returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the arctangent of x
- atan2(y: float2 const; x: float2 const)
atan2 returns float2 const
| argument | argument type | 
|---|---|
| y | float2 const | 
| x | float2 const | 
returns the arctangent of y/x
- atan2(y: float3 const; x: float3 const)
atan2 returns float3 const
| argument | argument type | 
|---|---|
| y | float3 const | 
| x | float3 const | 
returns the arctangent of y/x
- atan2(y: float4 const; x: float4 const)
atan2 returns float4 const
| argument | argument type | 
|---|---|
| y | float4 const | 
| x | float4 const | 
returns the arctangent of y/x
3.5. float* only
- rcp_est(x: float const)
rcp_est returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the fast approximation 1/x
- rcp_est(x: float2 const)
rcp_est returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the fast approximation 1/x
- rcp_est(x: float3 const)
rcp_est returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the fast approximation 1/x
- rcp_est(x: float4 const)
rcp_est returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the fast approximation 1/x
- fract(x: float const)
fract returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns a fraction part of x
- round(x: float const)
round returns float const
| argument | argument type | 
|---|---|
| x | float const | 
Returns the nearest integer to x.
- rsqrt(x: float const)
rsqrt returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns 1/sqrt(x)
- rsqrt_est(x: float const)
rsqrt_est returns float const
| argument | argument type | 
|---|---|
| x | float const | 
returns the fast approximation 1/sqrt(x)
- fract(x: float2 const)
fract returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a fraction part of x
- round(x: float2 const)
round returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
Returns the nearest integer to x.
- rsqrt(x: float2 const)
rsqrt returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns 1/sqrt(x)
- rsqrt_est(x: float2 const)
rsqrt_est returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the fast approximation 1/sqrt(x)
- fract(x: float3 const)
fract returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a fraction part of x
- round(x: float3 const)
round returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
Returns the nearest integer to x.
- rsqrt(x: float3 const)
rsqrt returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns 1/sqrt(x)
- rsqrt_est(x: float3 const)
rsqrt_est returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the fast approximation 1/sqrt(x)
- fract(x: float4 const)
fract returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a fraction part of x
- round(x: float4 const)
round returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
Returns the nearest integer to x.
- rsqrt(x: float4 const)
rsqrt returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns 1/sqrt(x)
- rsqrt_est(x: float4 const)
rsqrt_est returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the fast approximation 1/sqrt(x)
- atan_est(x: float const)
atan_est returns float const
| argument | argument type | 
|---|---|
| x | float const | 
Fast estimation for the atan.
- atan2_est(y: float const; x: float const)
atan2_est returns float const
| argument | argument type | 
|---|---|
| y | float const | 
| x | float const | 
returns the fast approximation of arctangent of y/x
- atan_est(x: float2 const)
atan_est returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
Fast estimation for the atan.
- atan_est(x: float3 const)
atan_est returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
Fast estimation for the atan.
- atan_est(x: float4 const)
atan_est returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
Fast estimation for the atan.
- atan2_est(y: float2 const; x: float2 const)
atan2_est returns float2 const
| argument | argument type | 
|---|---|
| y | float2 const | 
| x | float2 const | 
returns the fast approximation of arctangent of y/x
- atan2_est(y: float3 const; x: float3 const)
atan2_est returns float3 const
| argument | argument type | 
|---|---|
| y | float3 const | 
| x | float3 const | 
returns the fast approximation of arctangent of y/x
- atan2_est(y: float4 const; x: float4 const)
atan2_est returns float4 const
| argument | argument type | 
|---|---|
| y | float4 const | 
| x | float4 const | 
returns the fast approximation of arctangent of y/x
- floori(x: float const)
floori returns int const
| argument | argument type | 
|---|---|
| x | float const | 
returns a integer value representing the largest integer that is less than or equal to x
- ceili(x: float const)
ceili returns int const
| argument | argument type | 
|---|---|
| x | float const | 
returns a value representing the smallest integer (integer type!) that is greater than or equal to arg0
- roundi(x: float const)
roundi returns int const
| argument | argument type | 
|---|---|
| x | float const | 
returns a integer value representing the integer that is closest to x
- trunci(x: float const)
trunci returns int const
| argument | argument type | 
|---|---|
| x | float const | 
returns a integer value representing the float without fraction part of x
- floori(x: double const)
floori returns int const
| argument | argument type | 
|---|---|
| x | double const | 
returns a integer value representing the largest integer that is less than or equal to x
- ceili(x: double const)
ceili returns int const
| argument | argument type | 
|---|---|
| x | double const | 
returns a value representing the smallest integer (integer type!) that is greater than or equal to arg0
- roundi(x: double const)
roundi returns int const
| argument | argument type | 
|---|---|
| x | double const | 
returns a integer value representing the integer that is closest to x
- trunci(x: double const)
trunci returns int const
| argument | argument type | 
|---|---|
| x | double const | 
returns a integer value representing the float without fraction part of x
- floori(x: float2 const)
floori returns int2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a integer value representing the largest integer that is less than or equal to x
- ceili(x: float2 const)
ceili returns int2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a value representing the smallest integer (integer type!) that is greater than or equal to arg0
- roundi(x: float2 const)
roundi returns int2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a integer value representing the integer that is closest to x
- trunci(x: float2 const)
trunci returns int2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a integer value representing the float without fraction part of x
- floori(x: float3 const)
floori returns int3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a integer value representing the largest integer that is less than or equal to x
- ceili(x: float3 const)
ceili returns int3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a value representing the smallest integer (integer type!) that is greater than or equal to arg0
- roundi(x: float3 const)
roundi returns int3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a integer value representing the integer that is closest to x
- trunci(x: float3 const)
trunci returns int3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a integer value representing the float without fraction part of x
- floori(x: float4 const)
floori returns int4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a integer value representing the largest integer that is less than or equal to x
- ceili(x: float4 const)
ceili returns int4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a value representing the smallest integer (integer type!) that is greater than or equal to arg0
- roundi(x: float4 const)
roundi returns int4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a integer value representing the integer that is closest to x
- trunci(x: float4 const)
trunci returns int4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a integer value representing the float without fraction part of x
- operator -(x: float4x4 const implicit)
- returns math::float4x4 
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
returns -x
- operator -(x: float3x4 const implicit)
- returns math::float3x4 
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
returns -x
- operator -(x: float3x3 const implicit)
- returns math::float3x3 
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
returns -x
3.6. float3 only
inv_distance_sq (x:float2 const;y:float2 const) : float const
inv_distance_sq (x:float3 const;y:float3 const) : float const
inv_distance_sq (x:float4 const;y:float4 const) : float const
refract (v:float3 const;n:float3 const;nint:float const) : float3 const
refract (v:float2 const;n:float2 const;nint:float const) : float2 const
- cross(x: float3 const; y: float3 const)
cross returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns vector representing cross product between x and y
- distance(x: float2 const; y: float2 const)
distance returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns a non-negative value representing distance between x and y
- distance_sq(x: float2 const; y: float2 const)
distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns a non-negative value representing squared distance between x and y
- inv_distance(x: float2 const; y: float2 const)
inv_distance returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns a non-negative value representing 1/distance between x and y
- inv_distance_sq(x: float2 const; y: float2 const)
inv_distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns a non-negative value representing 1/squared distance between x and y
- distance(x: float3 const; y: float3 const)
distance returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns a non-negative value representing distance between x and y
- distance_sq(x: float3 const; y: float3 const)
distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns a non-negative value representing squared distance between x and y
- inv_distance(x: float3 const; y: float3 const)
inv_distance returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns a non-negative value representing 1/distance between x and y
- inv_distance_sq(x: float3 const; y: float3 const)
inv_distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns a non-negative value representing 1/squared distance between x and y
- distance(x: float4 const; y: float4 const)
distance returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns a non-negative value representing distance between x and y
- distance_sq(x: float4 const; y: float4 const)
distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns a non-negative value representing squared distance between x and y
- inv_distance(x: float4 const; y: float4 const)
inv_distance returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns a non-negative value representing 1/distance between x and y
- inv_distance_sq(x: float4 const; y: float4 const)
inv_distance_sq returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns a non-negative value representing 1/squared distance between x and y
- reflect(v: float3 const; n: float3 const)
reflect returns float3 const
| argument | argument type | 
|---|---|
| v | float3 const | 
| n | float3 const | 
returns vector representing reflection of vector v from normal n same as
def reflect(v, n: float3)
    return v - 2. * dot(v, n) * n
- reflect(v: float2 const; n: float2 const)
reflect returns float2 const
| argument | argument type | 
|---|---|
| v | float2 const | 
| n | float2 const | 
returns vector representing reflection of vector v from normal n same as
def reflect(v, n: float3)
    return v - 2. * dot(v, n) * n
- refract(v: float3 const; n: float3 const; nint: float const)
refract returns float3 const
| argument | argument type | 
|---|---|
| v | float3 const | 
| n | float3 const | 
| nint | float const | 
returns vector representing refractoin of vector v from normal n same as
def refract(v, n: float3; nint: float; outRefracted: float3&)
    let dt = dot(v, n)
    let discr = 1. - nint * nint * (1. - dt * dt)
    if discr > 0.
        outRefracted = nint * (v - n * dt) - n * sqrt(discr)
        return true
    return false
- refract(v: float2 const; n: float2 const; nint: float const)
refract returns float2 const
| argument | argument type | 
|---|---|
| v | float2 const | 
| n | float2 const | 
| nint | float const | 
returns vector representing refractoin of vector v from normal n same as
def refract(v, n: float3; nint: float; outRefracted: float3&)
    let dt = dot(v, n)
    let discr = 1. - nint * nint * (1. - dt * dt)
    if discr > 0.
        outRefracted = nint * (v - n * dt) - n * sqrt(discr)
        return true
    return false
3.7. float2, float3, float4
- dot(x: float2 const; y: float2 const)
dot returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
| y | float2 const | 
returns scalar representing dot product between x and y
- dot(x: float3 const; y: float3 const)
dot returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
| y | float3 const | 
returns scalar representing dot product between x and y
- dot(x: float4 const; y: float4 const)
dot returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
| y | float4 const | 
returns scalar representing dot product between x and y
- fast_normalize(x: float2 const)
fast_normalize returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns the fast approximation of normalized x, or nan if length(x) is 0
- fast_normalize(x: float3 const)
fast_normalize returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns the fast approximation of normalized x, or nan if length(x) is 0
- fast_normalize(x: float4 const)
fast_normalize returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns the fast approximation of normalized x, or nan if length(x) is 0
- normalize(x: float2 const)
normalize returns float2 const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns normalized x, or nan if length(x) is 0
- normalize(x: float3 const)
normalize returns float3 const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns normalized x, or nan if length(x) is 0
- normalize(x: float4 const)
normalize returns float4 const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns normalized x, or nan if length(x) is 0
- length(x: float2 const)
length returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a non-negative value representing magnitude of x
- length(x: float3 const)
length returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a non-negative value representing magnitude of x
- length(x: float4 const)
length returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a non-negative value representing magnitude of x
- inv_length(x: float2 const)
inv_length returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a non-negative value representing 1/magnitude of x
- inv_length(x: float3 const)
inv_length returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a non-negative value representing 1/magnitude of x
- inv_length(x: float4 const)
inv_length returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a non-negative value representing 1/magnitude of x
- inv_length_sq(x: float2 const)
inv_length_sq returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a non-negative value representing 1/squared magnitude of x
- inv_length_sq(x: float3 const)
inv_length_sq returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a non-negative value representing 1/squared magnitude of x
- inv_length_sq(x: float4 const)
inv_length_sq returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a non-negative value representing 1/squared magnitude of x
- length_sq(x: float2 const)
length_sq returns float const
| argument | argument type | 
|---|---|
| x | float2 const | 
returns a non-negative value representing squared magnitude of x
- length_sq(x: float3 const)
length_sq returns float const
| argument | argument type | 
|---|---|
| x | float3 const | 
returns a non-negative value representing squared magnitude of x
- length_sq(x: float4 const)
length_sq returns float const
| argument | argument type | 
|---|---|
| x | float4 const | 
returns a non-negative value representing squared magnitude of x
3.8. Noise functions
- uint32_hash(seed: uint const)
uint32_hash returns uint const
| argument | argument type | 
|---|---|
| seed | uint const | 
returns hashed value of seed
- uint_noise_1D(position: int const; seed: uint const)
uint_noise_1D returns uint const
| argument | argument type | 
|---|---|
| position | int const | 
| seed | uint const | 
returns noise value of position in the seeded sequence
- uint_noise_2D(position: int2 const; seed: uint const)
uint_noise_2D returns uint const
| argument | argument type | 
|---|---|
| position | int2 const | 
| seed | uint const | 
returns noise value of position in the seeded sequence
- uint_noise_3D(position: int3 const; seed: uint const)
uint_noise_3D returns uint const
| argument | argument type | 
|---|---|
| position | int3 const | 
| seed | uint const | 
returns noise value of position in the seeded sequence
3.9. lerp/mad/clamp
mad (a:float const;b:float const;c:float const) : float const
lerp (a:float const;b:float const;t:float const) : float const
mad (a:float2 const;b:float2 const;c:float2 const) : float2 const
lerp (a:float2 const;b:float2 const;t:float2 const) : float2 const
mad (a:float3 const;b:float3 const;c:float3 const) : float3 const
lerp (a:float3 const;b:float3 const;t:float3 const) : float3 const
mad (a:float4 const;b:float4 const;c:float4 const) : float4 const
lerp (a:float4 const;b:float4 const;t:float4 const) : float4 const
mad (a:float2 const;b:float const;c:float2 const) : float2 const
mad (a:float3 const;b:float const;c:float3 const) : float3 const
mad (a:float4 const;b:float const;c:float4 const) : float4 const
mad (a:uint2 const;b:uint2 const;c:uint2 const) : uint2 const
mad (a:uint3 const;b:uint3 const;c:uint3 const) : uint3 const
mad (a:uint4 const;b:uint4 const;c:uint4 const) : uint4 const
mad (a:uint2 const;b:uint const;c:uint2 const) : uint2 const
mad (a:uint3 const;b:uint const;c:uint3 const) : uint3 const
mad (a:uint4 const;b:uint const;c:uint4 const) : uint4 const
mad (a:double const;b:double const;c:double const) : double const
lerp (a:double const;b:double const;t:double const) : double const
clamp (t:uint2 const;a:uint2 const;b:uint2 const) : uint2 const
clamp (t:uint3 const;a:uint3 const;b:uint3 const) : uint3 const
clamp (t:uint4 const;a:uint4 const;b:uint4 const) : uint4 const
clamp (t:float const;a:float const;b:float const) : float const
clamp (t:float2 const;a:float2 const;b:float2 const) : float2 const
clamp (t:float3 const;a:float3 const;b:float3 const) : float3 const
clamp (t:float4 const;a:float4 const;b:float4 const) : float4 const
clamp (t:double const;a:double const;b:double const) : double const
clamp (t:int64 const;a:int64 const;b:int64 const) : int64 const
clamp (t:uint64 const;a:uint64 const;b:uint64 const) : uint64 const
lerp (a:float2 const;b:float2 const;t:float const) : float2 const
lerp (a:float3 const;b:float3 const;t:float const) : float3 const
lerp (a:float4 const;b:float4 const;t:float const) : float4 const
- mad(a: float const; b: float const; c: float const)
mad returns float const
| argument | argument type | 
|---|---|
| a | float const | 
| b | float const | 
| c | float const | 
returns vector or scalar representing a * b + c
- lerp(a: float const; b: float const; t: float const)
lerp returns float const
| argument | argument type | 
|---|---|
| a | float const | 
| b | float const | 
| t | float const | 
returns vector or scalar representing a + (b - a) * t
- mad(a: float2 const; b: float2 const; c: float2 const)
mad returns float2 const
| argument | argument type | 
|---|---|
| a | float2 const | 
| b | float2 const | 
| c | float2 const | 
returns vector or scalar representing a * b + c
- lerp(a: float2 const; b: float2 const; t: float2 const)
lerp returns float2 const
| argument | argument type | 
|---|---|
| a | float2 const | 
| b | float2 const | 
| t | float2 const | 
returns vector or scalar representing a + (b - a) * t
- mad(a: float3 const; b: float3 const; c: float3 const)
mad returns float3 const
| argument | argument type | 
|---|---|
| a | float3 const | 
| b | float3 const | 
| c | float3 const | 
returns vector or scalar representing a * b + c
- lerp(a: float3 const; b: float3 const; t: float3 const)
lerp returns float3 const
| argument | argument type | 
|---|---|
| a | float3 const | 
| b | float3 const | 
| t | float3 const | 
returns vector or scalar representing a + (b - a) * t
- mad(a: float4 const; b: float4 const; c: float4 const)
mad returns float4 const
| argument | argument type | 
|---|---|
| a | float4 const | 
| b | float4 const | 
| c | float4 const | 
returns vector or scalar representing a * b + c
- lerp(a: float4 const; b: float4 const; t: float4 const)
lerp returns float4 const
| argument | argument type | 
|---|---|
| a | float4 const | 
| b | float4 const | 
| t | float4 const | 
returns vector or scalar representing a + (b - a) * t
- mad(a: float2 const; b: float const; c: float2 const)
mad returns float2 const
| argument | argument type | 
|---|---|
| a | float2 const | 
| b | float const | 
| c | float2 const | 
returns vector or scalar representing a * b + c
- mad(a: float3 const; b: float const; c: float3 const)
mad returns float3 const
| argument | argument type | 
|---|---|
| a | float3 const | 
| b | float const | 
| c | float3 const | 
returns vector or scalar representing a * b + c
- mad(a: float4 const; b: float const; c: float4 const)
mad returns float4 const
| argument | argument type | 
|---|---|
| a | float4 const | 
| b | float const | 
| c | float4 const | 
returns vector or scalar representing a * b + c
- mad(a: int const; b: int const; c: int const)
mad returns int const
| argument | argument type | 
|---|---|
| a | int const | 
| b | int const | 
| c | int const | 
returns vector or scalar representing a * b + c
- mad(a: int2 const; b: int2 const; c: int2 const)
mad returns int2 const
| argument | argument type | 
|---|---|
| a | int2 const | 
| b | int2 const | 
| c | int2 const | 
returns vector or scalar representing a * b + c
- mad(a: int3 const; b: int3 const; c: int3 const)
mad returns int3 const
| argument | argument type | 
|---|---|
| a | int3 const | 
| b | int3 const | 
| c | int3 const | 
returns vector or scalar representing a * b + c
- mad(a: int4 const; b: int4 const; c: int4 const)
mad returns int4 const
| argument | argument type | 
|---|---|
| a | int4 const | 
| b | int4 const | 
| c | int4 const | 
returns vector or scalar representing a * b + c
- mad(a: int2 const; b: int const; c: int2 const)
mad returns int2 const
| argument | argument type | 
|---|---|
| a | int2 const | 
| b | int const | 
| c | int2 const | 
returns vector or scalar representing a * b + c
- mad(a: int3 const; b: int const; c: int3 const)
mad returns int3 const
| argument | argument type | 
|---|---|
| a | int3 const | 
| b | int const | 
| c | int3 const | 
returns vector or scalar representing a * b + c
- mad(a: int4 const; b: int const; c: int4 const)
mad returns int4 const
| argument | argument type | 
|---|---|
| a | int4 const | 
| b | int const | 
| c | int4 const | 
returns vector or scalar representing a * b + c
- mad(a: uint const; b: uint const; c: uint const)
mad returns uint const
| argument | argument type | 
|---|---|
| a | uint const | 
| b | uint const | 
| c | uint const | 
returns vector or scalar representing a * b + c
- mad(a: uint2 const; b: uint2 const; c: uint2 const)
mad returns uint2 const
| argument | argument type | 
|---|---|
| a | uint2 const | 
| b | uint2 const | 
| c | uint2 const | 
returns vector or scalar representing a * b + c
- mad(a: uint3 const; b: uint3 const; c: uint3 const)
mad returns uint3 const
| argument | argument type | 
|---|---|
| a | uint3 const | 
| b | uint3 const | 
| c | uint3 const | 
returns vector or scalar representing a * b + c
- mad(a: uint4 const; b: uint4 const; c: uint4 const)
mad returns uint4 const
| argument | argument type | 
|---|---|
| a | uint4 const | 
| b | uint4 const | 
| c | uint4 const | 
returns vector or scalar representing a * b + c
- mad(a: uint2 const; b: uint const; c: uint2 const)
mad returns uint2 const
| argument | argument type | 
|---|---|
| a | uint2 const | 
| b | uint const | 
| c | uint2 const | 
returns vector or scalar representing a * b + c
- mad(a: uint3 const; b: uint const; c: uint3 const)
mad returns uint3 const
| argument | argument type | 
|---|---|
| a | uint3 const | 
| b | uint const | 
| c | uint3 const | 
returns vector or scalar representing a * b + c
- mad(a: uint4 const; b: uint const; c: uint4 const)
mad returns uint4 const
| argument | argument type | 
|---|---|
| a | uint4 const | 
| b | uint const | 
| c | uint4 const | 
returns vector or scalar representing a * b + c
- mad(a: double const; b: double const; c: double const)
mad returns double const
| argument | argument type | 
|---|---|
| a | double const | 
| b | double const | 
| c | double const | 
returns vector or scalar representing a * b + c
- lerp(a: double const; b: double const; t: double const)
lerp returns double const
| argument | argument type | 
|---|---|
| a | double const | 
| b | double const | 
| t | double const | 
returns vector or scalar representing a + (b - a) * t
- clamp(t: int const; a: int const; b: int const)
clamp returns int const
| argument | argument type | 
|---|---|
| t | int const | 
| a | int const | 
| b | int const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: int2 const; a: int2 const; b: int2 const)
clamp returns int2 const
| argument | argument type | 
|---|---|
| t | int2 const | 
| a | int2 const | 
| b | int2 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: int3 const; a: int3 const; b: int3 const)
clamp returns int3 const
| argument | argument type | 
|---|---|
| t | int3 const | 
| a | int3 const | 
| b | int3 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: int4 const; a: int4 const; b: int4 const)
clamp returns int4 const
| argument | argument type | 
|---|---|
| t | int4 const | 
| a | int4 const | 
| b | int4 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: uint const; a: uint const; b: uint const)
clamp returns uint const
| argument | argument type | 
|---|---|
| t | uint const | 
| a | uint const | 
| b | uint const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: uint2 const; a: uint2 const; b: uint2 const)
clamp returns uint2 const
| argument | argument type | 
|---|---|
| t | uint2 const | 
| a | uint2 const | 
| b | uint2 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: uint3 const; a: uint3 const; b: uint3 const)
clamp returns uint3 const
| argument | argument type | 
|---|---|
| t | uint3 const | 
| a | uint3 const | 
| b | uint3 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: uint4 const; a: uint4 const; b: uint4 const)
clamp returns uint4 const
| argument | argument type | 
|---|---|
| t | uint4 const | 
| a | uint4 const | 
| b | uint4 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: float const; a: float const; b: float const)
clamp returns float const
| argument | argument type | 
|---|---|
| t | float const | 
| a | float const | 
| b | float const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: float2 const; a: float2 const; b: float2 const)
clamp returns float2 const
| argument | argument type | 
|---|---|
| t | float2 const | 
| a | float2 const | 
| b | float2 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: float3 const; a: float3 const; b: float3 const)
clamp returns float3 const
| argument | argument type | 
|---|---|
| t | float3 const | 
| a | float3 const | 
| b | float3 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: float4 const; a: float4 const; b: float4 const)
clamp returns float4 const
| argument | argument type | 
|---|---|
| t | float4 const | 
| a | float4 const | 
| b | float4 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: double const; a: double const; b: double const)
clamp returns double const
| argument | argument type | 
|---|---|
| t | double const | 
| a | double const | 
| b | double const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: int64 const; a: int64 const; b: int64 const)
clamp returns int64 const
| argument | argument type | 
|---|---|
| t | int64 const | 
| a | int64 const | 
| b | int64 const | 
returns vector or scalar representing min(max(t, a), b)
- clamp(t: uint64 const; a: uint64 const; b: uint64 const)
clamp returns uint64 const
| argument | argument type | 
|---|---|
| t | uint64 const | 
| a | uint64 const | 
| b | uint64 const | 
returns vector or scalar representing min(max(t, a), b)
- lerp(a: float2 const; b: float2 const; t: float const)
lerp returns float2 const
| argument | argument type | 
|---|---|
| a | float2 const | 
| b | float2 const | 
| t | float const | 
returns vector or scalar representing a + (b - a) * t
- lerp(a: float3 const; b: float3 const; t: float const)
lerp returns float3 const
| argument | argument type | 
|---|---|
| a | float3 const | 
| b | float3 const | 
| t | float const | 
returns vector or scalar representing a + (b - a) * t
- lerp(a: float4 const; b: float4 const; t: float const)
lerp returns float4 const
| argument | argument type | 
|---|---|
| a | float4 const | 
| b | float4 const | 
| t | float const | 
returns vector or scalar representing a + (b - a) * t
3.10. Matrix operations
* (x:math::float4x4 const implicit;y:math::float4x4 const implicit) : math::float4x4
== (x:math::float4x4 const implicit;y:math::float4x4 const implicit) : bool const
!= (x:math::float4x4 const implicit;y:math::float4x4 const implicit) : bool const
* (x:math::float3x4 const implicit;y:math::float3x4 const implicit) : math::float3x4
* (x:math::float3x4 const implicit;y:float3 const) : float3 const
* (x:math::float4x4 const implicit;y:float4 const) : float4 const
== (x:math::float3x4 const implicit;y:math::float3x4 const implicit) : bool const
!= (x:math::float3x4 const implicit;y:math::float3x4 const implicit) : bool const
* (x:math::float3x3 const implicit;y:math::float3x3 const implicit) : math::float3x3
* (x:math::float3x3 const implicit;y:float3 const) : float3 const
== (x:math::float3x3 const implicit;y:math::float3x3 const implicit) : bool const
!= (x:math::float3x3 const implicit;y:math::float3x3 const implicit) : bool const
- operator *(x: float4x4 const implicit; y: float4x4 const implicit)
- returns math::float4x4 
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
| y | math::float4x4 const implicit | 
Multiplies x by y.
- operator ==(x: float4x4 const implicit; y: float4x4 const implicit)
== returns bool const
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
| y | math::float4x4 const implicit | 
Compares x and y per component. Returns false if at least one component does not match.
- operator !=(x: float4x4 const implicit; y: float4x4 const implicit)
!= returns bool const
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
| y | math::float4x4 const implicit | 
Compares x and y per component. Returns true if at least one component does not match.
- operator *(x: float3x4 const implicit; y: float3x4 const implicit)
- returns math::float3x4 
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
| y | math::float3x4 const implicit | 
Multiplies x by y.
- operator *(x: float3x4 const implicit; y: float3 const)
- returns float3 const 
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
| y | float3 const | 
Multiplies x by y.
- operator *(x: float4x4 const implicit; y: float4 const)
- returns float4 const 
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
| y | float4 const | 
Multiplies x by y.
- operator ==(x: float3x4 const implicit; y: float3x4 const implicit)
== returns bool const
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
| y | math::float3x4 const implicit | 
Compares x and y per component. Returns false if at least one component does not match.
- operator !=(x: float3x4 const implicit; y: float3x4 const implicit)
!= returns bool const
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
| y | math::float3x4 const implicit | 
Compares x and y per component. Returns true if at least one component does not match.
- operator *(x: float3x3 const implicit; y: float3x3 const implicit)
- returns math::float3x3 
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
| y | math::float3x3 const implicit | 
Multiplies x by y.
- operator *(x: float3x3 const implicit; y: float3 const)
- returns float3 const 
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
| y | float3 const | 
Multiplies x by y.
- operator ==(x: float3x3 const implicit; y: float3x3 const implicit)
== returns bool const
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
| y | math::float3x3 const implicit | 
Compares x and y per component. Returns false if at least one component does not match.
- operator !=(x: float3x3 const implicit; y: float3x3 const implicit)
!= returns bool const
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
| y | math::float3x3 const implicit | 
Compares x and y per component. Returns true if at least one component does not match.
3.11. Matrix initializers
- float3x3()
float3x3 returns math::float3x3
Returns empty matrix, where each component is 0.
- float3x4()
float3x4 returns math::float3x4
Returns empty matrix, where each component is 0.
- float4x4()
float4x4 returns math::float4x4
Returns empty matrix, where each component is 0.
- float4x4(arg0: float3x4 const implicit)
float4x4 returns math::float4x4
| argument | argument type | 
|---|---|
| arg0 | math::float3x4 const implicit | 
Returns empty matrix, where each component is 0.
- identity4x4()
identity4x4 returns math::float4x4
Returns identity matrix, where diagonal is 1 and every other component is 0.
- float3x4(arg0: float4x4 const implicit)
float3x4 returns math::float3x4
| argument | argument type | 
|---|---|
| arg0 | math::float4x4 const implicit | 
Returns empty matrix, where each component is 0.
- identity3x4()
identity3x4 returns math::float3x4
Returns identity matrix, where diagonal is 1 and every other component is 0.
- float3x3(arg0: float4x4 const implicit)
float3x3 returns math::float3x3
| argument | argument type | 
|---|---|
| arg0 | math::float4x4 const implicit | 
Returns empty matrix, where each component is 0.
- float3x3(arg0: float3x4 const implicit)
float3x3 returns math::float3x3
| argument | argument type | 
|---|---|
| arg0 | math::float3x4 const implicit | 
Returns empty matrix, where each component is 0.
- identity3x3()
identity3x3 returns math::float3x3
Returns identity matrix, where diagonal is 1 and every other component is 0.
3.12. Matrix manipulation
transpose (x:math::float4x4 const implicit) : math::float4x4
persp_forward (wk:float const;hk:float const;zn:float const;zf:float const) : math::float4x4
persp_reverse (wk:float const;hk:float const;zn:float const;zf:float const) : math::float4x4
look_at (eye:float3 const;at:float3 const;up:float3 const) : math::float4x4
compose (pos:float3 const;rot:float4 const;scale:float3 const) : math::float4x4
orthonormal_inverse (m:math::float3x3 const implicit) : math::float3x3
orthonormal_inverse (m:math::float3x4 const implicit) : math::float3x4
rotate (x:math::float3x4 const implicit;y:float3 const) : float3 const
- identity(x: float4x4 implicit)
| argument | argument type | 
|---|---|
| x | math::float4x4 implicit | 
Returns identity matrix, where diagonal is 1 and every other component is 0.
- translation(xyz: float3 const)
translation returns math::float4x4
| argument | argument type | 
|---|---|
| xyz | float3 const | 
produces a translation by xyz
1
0
0
0
0
1
0
0
0
0
1
0
x
y
z
1
- transpose(x: float4x4 const implicit)
transpose returns math::float4x4
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
Transposes the specified input matrix x.
- persp_forward(wk: float const; hk: float const; zn: float const; zf: float const)
persp_forward returns math::float4x4
| argument | argument type | 
|---|---|
| wk | float const | 
| hk | float const | 
| zn | float const | 
| zf | float const | 
Perspective matrix, zn - 0, zf - 1
- persp_reverse(wk: float const; hk: float const; zn: float const; zf: float const)
persp_reverse returns math::float4x4
| argument | argument type | 
|---|---|
| wk | float const | 
| hk | float const | 
| zn | float const | 
| zf | float const | 
Perspective matrix, zn - 1, zf - 0
- look_at(eye: float3 const; at: float3 const; up: float3 const)
look_at returns math::float4x4
| argument | argument type | 
|---|---|
| eye | float3 const | 
| at | float3 const | 
| up | float3 const | 
Look-at matrix with the origin at eye, looking at at, with up as up direction.
- compose(pos: float3 const; rot: float4 const; scale: float3 const)
compose returns math::float4x4
| argument | argument type | 
|---|---|
| pos | float3 const | 
| rot | float4 const | 
| scale | float3 const | 
Compose transformation out of translation, rotation and scale.
- decompose(mat: float4x4 const implicit; pos: float3& implicit; rot: float4& implicit; scale: float3& implicit)
| argument | argument type | 
|---|---|
| mat | math::float4x4 const implicit | 
| pos | float3& implicit | 
| rot | float4& implicit | 
| scale | float3& implicit | 
Decompose transformation into translation, rotation and scale.
- identity(x: float3x4 implicit)
| argument | argument type | 
|---|---|
| x | math::float3x4 implicit | 
Returns identity matrix, where diagonal is 1 and every other component is 0.
- inverse(x: float3x4 const implicit)
inverse returns math::float3x4
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
Returns the inverse of the matrix x.
- inverse(m: float4x4 const implicit)
inverse returns math::float4x4
| argument | argument type | 
|---|---|
| m | math::float4x4 const implicit | 
Returns the inverse of the matrix x.
- orthonormal_inverse(m: float3x3 const implicit)
orthonormal_inverse returns math::float3x3
| argument | argument type | 
|---|---|
| m | math::float3x3 const implicit | 
Fast inverse for the orthonormal matrix.
- orthonormal_inverse(m: float3x4 const implicit)
orthonormal_inverse returns math::float3x4
| argument | argument type | 
|---|---|
| m | math::float3x4 const implicit | 
Fast inverse for the orthonormal matrix.
- rotate(x: float3x4 const implicit; y: float3 const)
rotate returns float3 const
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
| y | float3 const | 
Rotates vector y by 3x4 matrix x. Only 3x3 portion of x is multiplied by y.
- identity(x: float3x3 implicit)
| argument | argument type | 
|---|---|
| x | math::float3x3 implicit | 
Returns identity matrix, where diagonal is 1 and every other component is 0.
3.13. Quaternion operations
- quat_from_unit_arc(v0: float3 const; v1: float3 const)
quat_from_unit_arc returns float4 const
| argument | argument type | 
|---|---|
| v0 | float3 const | 
| v1 | float3 const | 
Quaternion which represents rotation from v0 to v1, both arguments need to be normalized
- quat_from_unit_vec_ang(v: float3 const; ang: float const)
quat_from_unit_vec_ang returns float4 const
| argument | argument type | 
|---|---|
| v | float3 const | 
| ang | float const | 
Quaternion which represents rotation for ang radians around vector v. v needs to be normalized
- quat_mul(q1: float4 const; q2: float4 const)
quat_mul returns float4 const
| argument | argument type | 
|---|---|
| q1 | float4 const | 
| q2 | float4 const | 
Quaternion which is multiplication of q1 and q2
- quat_mul_vec(q: float4 const; v: float3 const)
quat_mul_vec returns float3 const
| argument | argument type | 
|---|---|
| q | float4 const | 
| v | float3 const | 
Transform vector v by quaternion q
- quat_conjugate(q: float4 const)
quat_conjugate returns float4 const
| argument | argument type | 
|---|---|
| q | float4 const | 
Quaternion which is conjugate of q
3.14. Packing and unpacking
- pack_float_to_byte(x: float4 const)
pack_float_to_byte returns uint const
| argument | argument type | 
|---|---|
| x | float4 const | 
Packs float4 vector v to byte4 vector and returns it as uint. Each component is clamped to [0..255] range.
- unpack_byte_to_float(x: uint const)
unpack_byte_to_float returns float4 const
| argument | argument type | 
|---|---|
| x | uint const | 
Unpacks byte4 vector to float4 vector.
3.15. Uncategorized
- operator [](m: float4x4 implicit ==const; i: int const)
[] returns float4&
| argument | argument type | 
|---|---|
| m | math::float4x4 implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float4x4 const implicit ==const; i: int const)
[] returns float4 const&
| argument | argument type | 
|---|---|
| m | math::float4x4 const implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float4x4 implicit ==const; i: uint const)
[] returns float4&
| argument | argument type | 
|---|---|
| m | math::float4x4 implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float4x4 const implicit ==const; i: uint const)
[] returns float4 const&
| argument | argument type | 
|---|---|
| m | math::float4x4 const implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.
- determinant(x: float4x4 const implicit)
determinant returns float const
| argument | argument type | 
|---|---|
| x | math::float4x4 const implicit | 
Returns the determinant of the matrix m.
- determinant(x: float3x4 const implicit)
determinant returns float const
| argument | argument type | 
|---|---|
| x | math::float3x4 const implicit | 
Returns the determinant of the matrix m.
- operator [](m: float3x4 implicit ==const; i: int const)
[] returns float3&
| argument | argument type | 
|---|---|
| m | math::float3x4 implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x4 const implicit ==const; i: int const)
[] returns float3 const&
| argument | argument type | 
|---|---|
| m | math::float3x4 const implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x4 implicit ==const; i: uint const)
[] returns float3&
| argument | argument type | 
|---|---|
| m | math::float3x4 implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x4 const implicit ==const; i: uint const)
[] returns float3 const&
| argument | argument type | 
|---|---|
| m | math::float3x4 const implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.
- quat_from_euler(angles: float3 const)
quat_from_euler returns float4 const
| argument | argument type | 
|---|---|
| angles | float3 const | 
Construct quaternion from euler angles.
- quat_from_euler(x: float const; y: float const; z: float const)
quat_from_euler returns float4 const
| argument | argument type | 
|---|---|
| x | float const | 
| y | float const | 
| z | float const | 
Construct quaternion from euler angles.
- euler_from_quat(angles: float4 const)
euler_from_quat returns float3 const
| argument | argument type | 
|---|---|
| angles | float4 const | 
Construct euler angles from quaternion.
- quat(m: float3x3 const implicit)
quat returns float4 const
| argument | argument type | 
|---|---|
| m | math::float3x3 const implicit | 
Construct quaternion from matrix.
- quat(m: float3x4 const implicit)
quat returns float4 const
| argument | argument type | 
|---|---|
| m | math::float3x4 const implicit | 
Construct quaternion from matrix.
- quat(m: float4x4 const implicit)
quat returns float4 const
| argument | argument type | 
|---|---|
| m | math::float4x4 const implicit | 
Construct quaternion from matrix.
- quat_slerp(t: float const; a: float4 const; b: float4 const)
quat_slerp returns float4 const
| argument | argument type | 
|---|---|
| t | float const | 
| a | float4 const | 
| b | float4 const | 
Spherical linear interpolation between a and b by t.
- determinant(x: float3x3 const implicit)
determinant returns float const
| argument | argument type | 
|---|---|
| x | math::float3x3 const implicit | 
Returns the determinant of the matrix m.
- operator [](m: float3x3 implicit ==const; i: int const)
[] returns float3&
| argument | argument type | 
|---|---|
| m | math::float3x3 implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x3 const implicit ==const; i: int const)
[] returns float3 const&
| argument | argument type | 
|---|---|
| m | math::float3x3 const implicit! | 
| i | int const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x3 implicit ==const; i: uint const)
[] returns float3&
| argument | argument type | 
|---|---|
| m | math::float3x3 implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.
- operator [](m: float3x3 const implicit ==const; i: uint const)
[] returns float3 const&
| argument | argument type | 
|---|---|
| m | math::float3x3 const implicit! | 
| i | uint const | 
Returns the component of the matrix m at the specified row.