WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. API
  4. Cubios::Math
Mission NodeSDK 6.1C++gfx engine

Cubios::Math

Cubios::Math Global Defines LN 2 Summary Coupling coefficient of binary and natural logarithm Synopsis define LN 2 0.693147180559945f PI Summary PI value Syn...

API / SDK 6.1 / C++ / gfx engine

Cubios::Math

Global Defines

LN_2

Summary

Coupling coefficient of binary and natural logarithm

Synopsis

Cubios::Math
CPP
1#define LN_2 0.693147180559945f
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

PI

Summary

PI value

Synopsis

Cubios::Math
CPP
1#define PI (3.141592653589f)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

PI_2

Summary

PI / 2 value Synopsis

Cubios::Math
CPP
1#define PI_2 (6.28318530718f)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

TINY

Summary

"Small" value used for thresholds

Synopsis

Cubios::Math
CPP
1#define TINY (0.0000001)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_max

Summary

Returns the largest value

Synopsis

Cubios::Math
CPP
1#define n_max(a,b) (((a) > (b)) ? (a) : (b))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_min

Summary

Returns the smallest value

Synopsis

Cubios::Math
CPP
1#define n_min(a,b) (((a) < (b)) ? (a) : (b))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_abs

Summary

Returns the absolute value

Synopsis

Cubios::Math
CPP
1#define n_abs(a) (((a)<0.0f) ? (-(a)) : (a))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_sgn

Summary

Returns the sign of a value

Synopsis

Cubios::Math
CPP
1#define n_sgn(a) (((a)<0.0f) ? (-1) : (1))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_deg2rad

Summary

Converts degrees to radians

Synopsis

Cubios::Math
CPP
1#define n_deg2rad(d) (((d)*PI)/180.0f)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_rad2deg

Summary

Converts radians to degrees

Synopsis

Cubios::Math
CPP
1#define n_rad2deg(r) (((r)*180.0f)/PI)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_sin

Summary

Caluclates sine value as float

Synopsis

Cubios::Math
CPP
1#define n_sin(x) (float(sin(x)))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_cos

Summary

Caluclates cosine value as float

Synopsis

Cubios::Math
CPP
1#define n_cos(x) (float(cos(x)))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_tan

Summary

Caluclates tangent value as float

Synopsis

Cubios::Math
CPP
1#define n_tan(x) (float(tan(x)))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

n_atan

Summary

Caluclates arctangent value as float

Synopsis

Cubios::Math
CPP
1#define n_atan(x) (float(atan(x)))
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Static functions

log2

Summary

Calculates base 2 logarithm

Arguments

  • f - input value

Synopsis

Cubios::Math
CPP
1static inline float log2(float f)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

iclamp

Summary

Performs integer clamping

Arguments

  • val - input value
  • minVal - minimum clamp value
  • maxVal - maximum clamp value

Synopsis

Cubios::Math
CPP
1static inline int iclamp(int val, int minVal, int maxVal)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

acos

Summary

Calculates arccosine with value clamping

Arguments

  • x - input value

Synopsis

Cubios::Math
CPP
1static inline float acos(float x)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

asin

Summary

Calculates arcsine with value clamping

Arguments

  • x - input value

Synopsis

Cubios::Math
CPP
1static inline float asin(float x)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

sqrt

Summary

Calculates safe square root

Arguments

  • x - input value

Synopsis

Cubios::Math
CPP
1static inline float sqrt(float x)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

fequal

Summary

Does fuzzy floating point equality check

Arguments

  • f0 - first value to check
  • f1 - second value to check
  • tol - comparison tolerance

Synopsis

Cubios::Math
CPP
1static inline bool fequal(float f0, float f1, float tol)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

fless

Summary

Does fuzzy floating point less-than check

Arguments

  • f0 - first value to check
  • f1 - second value to check
  • tol - comparison tolerance

Synopsis

Cubios::Math
CPP
1static inline bool fequal(float f0, float f1, float tol)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

fgreater

Summary

Does fuzzy floating point greter-than check

Arguments

  • f0 - first value to check
  • f1 - second value to check
  • tol - comparison tolerance

Synopsis

Cubios::Math
CPP
1static inline bool fgreater(float f0, float f1, float tol)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

ftol

Summary

Fast float to long int conversion with truncation

Arguments

  • val - input value

Synopsis

Cubios::Math
CPP
1static inline long ftol(float val)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

smooth

Summary

Smoothes a new value towards an old value using a change value

Arguments

  • newVal - new value
  • curVal - current value
  • maxChange - maximum change step

Synopsis

Cubios::Math
CPP
1static inline float smooth(float newVal, float curVal, float maxChange)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

clamp

Summary

Clamp a value against lower and upper boundary

Arguments

  • val - input value
  • lower - lower boundary
  • upper - upper boundary

Synopsis

Cubios::Math
CPP
1static inline float clamp(float val, float lower, float upper)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

lerp

Summary

Caluclate linear interpolation between two values as result = x + l * (y-x)

Arguments

  • x - input x value
  • y - input y value
  • l - interpolation factor

Synopsis

Cubios::Math
CPP
1static inline float lerp(float x, float y, float l)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

saturate

Summary

Saturates a value by clamping it between 0.0f and 1.0f

Arguments

  • val - input value

Synopsis

Cubios::Math
CPP
1static inline float saturate(float val)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

rand

Summary

Generates a pseudo-random integer number

Synopsis

Cubios::Math
CPP
1static inline unsigned long rand()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

rand2

Summary

Generates a pseudo-random number between 0.0f and 1.0f

Synopsis

Cubios::Math
CPP
1static inline float rand2()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

randGetSeed

Summary

Returns current randomizer seed

Synopsis

Cubios::Math
CPP
1static inline unsigned long randGetSeed()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

randSetSeed

Summary

Sets randomizer seed

Arguments

  • s - new randomizer seed value

Synopsis

Cubios::Math
CPP
1static inline void randSetSeed(unsigned long s)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

randInt

Summary

Returns random integer in range of [0,n]

Arguments

  • n - range upper boundary

Synopsis

Cubios::Math
CPP
1static inline int randInt(int n)
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

randReal

Summary

Returns random float in [0.0,1.0]

Synopsis

Cubios::Math
CPP
1sstatic inline float randReal()
2
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Jump Grid

On This Page

Global DefinesLN 2PIPI 2TINYn maxn minn absn sgnn deg2radn rad2degn sinn cosn tann atanStatic functionslog2iclampacosasinsqrtfequalflessfgreaterftolsmoothclamplerpsaturaterandrand2randGetSeedrandSetSeedrandIntrandReal
Context Rail

Related nodes

Cubios::Math::Vec2
API / SDK 6.1 / C++ / gfx engine
Cubios::Math::Transform
API / SDK 6.1 / C++ / gfx engine
Cubios::Math::Color
API / SDK 6.1 / C++ / gfx engine
Cubios::Gfx::Colors
API / SDK 6.1 / C++ / gfx engine
Previous Node
Logging
API / SDK 6.1 / C++ / API Reference
Next Node
Cubios::Math::Vec2
API / SDK 6.1 / C++ / gfx engine