This is the documentation for Enlighten.
module Scalars
Functions
Name | Description |
---|---|
Abs(float) | Return the absolute value of a number. |
Abs(double) | Return the absolute value of a number. |
Abs(s64) | Return the absolute value of a number. |
Abs(s32) | Return the absolute value of a number. |
Ceil(float) | Compute the next whole number greater than a. |
Clamp(T &, const T &, const T &) | Clamp a numeric type T to the given range. |
CountTrailingZeroBits(u32) | Returns the number of consecutive trailing zero bits. |
DivideAndRoundUp(T, T) | Perform an integer division that rounds the result to the next integer. |
EqualWithinEpsilon(float, float, float) | Returns true if Abs(a - b) is less than the epsilon. |
FastFloatToInt(float) | Converts a float into a signed integer using a faster method than the standard C truncation convention which requires a rounding mode change. |
Floor(float) | Compute the next whole number smaller than a. |
IsMultiplePower2(u64, u64) | Returns true if u is multiple of the specified power of 2. |
IsMultiplePower2(const void *, u64) | Returns true if p is multiple of the specified power of 2. |
IsPower2(u64) | Return true is unsignedInt is a power of 2 or not. |
Lerp(float, float, float) | Linearly interpolate between a and b with factor s. |
Log(float, float) | Calculate the logarithm with specified base of the given number;. |
Max(const T &, const T &) | Return the Max of a and b. |
Max3(const T &, const T &, const T &) | Return the Max of {a,b,c}. |
Min(const T &, const T &) | Return the Max of a and b. |
Min3(const T &, const T &, const T &) | Return the Min of {a,b,c}. |
Mod(float, float) | Return a modulo b. |
RoundToNextMultiplePower2(u32, u32) | This will round the number u to the next multiple of a power of 2 if the number isn't already a multiple of the power of 2. |
RoundToNextPower2(u64) | Round a 64bit unsigned int to the next power of 2. |
RoundToNextPower2(u32) | Round a 32bit unsigned int to the next power of 2. |
RoundToPrevMultiplePower2(u32, u32) | This will round the number u down to the previous multiple of a power of 2 if the number isn't already a multiple of the power of 2. |
float Geo::Abs
public: float Abs
(
float a
)
Return the absolute value of a number.
double Geo::Abs
public: double Abs
(
double a
)
Return the absolute value of a number.
s64 Geo::Abs
public: s64 Abs
(
s64 a
)
Return the absolute value of a number.
s32 Geo::Abs
public: s32 Abs
(
s32 a
)
Return the absolute value of a number.
float Geo::Ceil
public: float Ceil
(
float a
)
Compute the next whole number greater than a.
void Geo::Clamp
public: void Clamp
(
T & toClamp,
const T & lowerLimit,
const T & upperLimit
)
Clamp a numeric type T to the given range.
u32 Geo::CountTrailingZeroBits
public: u32 CountTrailingZeroBits
(
u32 v
)
Returns the number of consecutive trailing zero bits.
T Geo::DivideAndRoundUp
public: T DivideAndRoundUp
(
T Dividend,
T Divisor
)
Perform an integer division that rounds the result to the next integer.
bool Geo::EqualWithinEpsilon
public: bool EqualWithinEpsilon
(
float a,
float b,
float epsilon
)
Returns true if Abs(a - b) is less than the epsilon.
s32 Geo::FastFloatToInt
public: s32 FastFloatToInt
(
float a
)
Converts a float into a signed integer using a faster method than the standard C truncation convention which requires a rounding mode change.
float Geo::Floor
public: float Floor
(
float a
)
Compute the next whole number smaller than a.
bool Geo::IsMultiplePower2
public: bool IsMultiplePower2
(
u64 u,
u64 power2
)
Returns true if u is multiple of the specified power of 2.
NOTE - this function will incorrectly report 0 as a power of two. If this is important you will need to handle that case separately i.e. IsMultiplePower2(myInt) && myInt
bool Geo::IsMultiplePower2
public: bool IsMultiplePower2
(
const void * p,
u64 power2
)
Returns true if p is multiple of the specified power of 2.
NOTE - this function will incorrectly report 0 as a power of two. If this is important you will need to handle that case separately i.e. IsMultiplePower2(myPtr) && myPtr
bool Geo::IsPower2
public: bool IsPower2
(
u64 unsignedInt
)
Return true is unsignedInt is a power of 2 or not.
NOTE - this function will incorrectly report 0 as a power of two. If this is important you will need to handle that case separately i.e. IsPower2(myInt) && myInt
float Geo::Lerp
public: float Lerp
(
float a,
float b,
float s
)
Linearly interpolate between a and b with factor s.
float Geo::Log
public: float Log
(
float number,
float base
)
Calculate the logarithm with specified base of the given number;.
T Geo::Max
public: T Max
(
const T & a,
const T & b
)
Return the Max of a and b.
T Geo::Max3
public: T Max3
(
const T & a,
const T & b,
const T & c
)
Return the Max of {a,b,c}.
T Geo::Min
public: T Min
(
const T & a,
const T & b
)
Return the Max of a and b.
T Geo::Min3
public: T Min3
(
const T & a,
const T & b,
const T & c
)
Return the Min of {a,b,c}.
float Geo::Mod
public: float Mod
(
float a,
float b
)
Return a modulo b.
u32 Geo::RoundToNextMultiplePower2
public: u32 RoundToNextMultiplePower2
(
u32 u,
u32 power2
)
This will round the number u to the next multiple of a power of 2 if the number isn't already a multiple of the power of 2.
power2 must be a power2. This is asserted on but not verified.
u64 Geo::RoundToNextPower2
public: u64 RoundToNextPower2
(
u64 u
)
Round a 64bit unsigned int to the next power of 2.
NOTE - This function will round 0 to 0, which isn't a power of 2. If this is important you will need to handle that case separately.
u32 Geo::RoundToNextPower2
public: u32 RoundToNextPower2
(
u32 u
)
Round a 32bit unsigned int to the next power of 2.
NOTE - This function will round 0 to 0, which isn't a power of 2. If this is important you will need to handle that case separately.
u32 Geo::RoundToPrevMultiplePower2
public: u32 RoundToPrevMultiplePower2
(
u32 u,
u32 power2
)
This will round the number u down to the previous multiple of a power of 2 if the number isn't already a multiple of the power of 2.
power2 must be a power2. This is asserted on but not verified.