Nebula
Loading...
Searching...
No Matches
Math Namespace Reference

Detailed Description

Different curves.

Half precision (16 bit) float implementation.

Based on https://github.com/acgessler/half_float

Classes

class  AngularPFeedbackLoop
 A proportional feedback loop with correct angular interpolation. More...
 
class  bbox
 Nebula's bounding box class. More...
 
struct  BezierCubic
 
struct  byte4
 
struct  byte4u
 
class  ClipStatus
 The result of a clip check (Inside, Outside or Clipped). More...
 
class  Extrapolator
 Extrapolator maintains state about updates for remote entities, and will generate smooth guesses about where those entities will be based on previously received data. More...
 
struct  float2
 
struct  float3
 
struct  float4
 
class  frustum
 Defines a clipping frustum made of 6 planes. More...
 
class  half
 
struct  int2
 
struct  int3
 
struct  int4
 
class  line
 A line in 3d space. More...
 
struct  mat4
 A 4x4 single point precision float matrix. More...
 
class  noise
 Perlin noise class. More...
 
class  PFeedbackLoop
 A P feedback loop (proportional feedback loop) is a simple object which moves a system's current state towards a goal, using the resulting error (difference between goal and state as feedback on the next run. More...
 
class  PIDFeedbackLoop
 A PID feedback loop (proportional integral derivative feedback loop) More...
 
class  plane
 A mathematical plane represented by a normal and a distance from origin. More...
 
struct  point
 Represents a 3D point in space. More...
 
class  polar
 A polar coordinate inline class, consisting of 2 angles theta (latitude) and rho (longitude). More...
 
class  quat
 A quaternion is usually used to represent an orientation in 3D space. More...
 
struct  randxorstate
 fast random generator based on xorshift+ More...
 
class  rectangle
 A 2d rectangle class. More...
 
class  sphere
 A 3-dimensional sphere. More...
 
class  transform
 Simple transform using position, quaternion, and scale. More...
 
class  transform44
 A 4x4 matrix which is described by translation, rotation and scale. More...
 
struct  uint2
 
struct  uint3
 
struct  uint4
 
struct  vec2
 A 2-component float vector class. More...
 
struct  vec3
 A 3D vector. More...
 
struct  vec4
 A 4D vector. More...
 
struct  vector
 A vector is a 3D direction in space. More...
 

Typedefs

typedef rectangle< float > floatRectangle
 
typedef rectangle< int > intRectangle
 
typedef float scalar
 
typedef float float32
 
typedef double float64
 

Functions

half operator+ (half one, half two)
 
half operator- (half one, half two)
 
half operator* (half one, half two)
 
half operator/ (half one, half two)
 
half operator+ (half one, float two)
 
half operator- (half one, float two)
 
half operator* (half one, float two)
 
half operator/ (half one, float two)
 
float operator+ (float one, half two)
 
float operator- (float one, half two)
 
float operator* (float one, half two)
 
float operator/ (float one, half two)
 
mat4 reflect (const vec4 &p)
 based on this http://www.opengl.org/discussion_boards/showthread.php/169605-reflection-matrix-how-to-derive
 
void decompose (const mat4 &mat, vec3 &outScale, quat &outRotation, vec3 &outTranslation)
 
mat4 affine (const vec3 &scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &translation)
 
mat4 affine (const vec3 &scale, const quat &rotation, const vec3 &translation)
 
mat4 affine (const vec3 &scale, const vec3 &rotation, const vec3 &translation)
 
mat4 affinetransformation (scalar scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &translation)
 
mat4 rotationquat (const quat &q)
 TODO: rewrite using SSE.
 
mat4 transformation (const vec3 &scalingCenter, const quat &scalingRotation, const vec3 &scale, const vec3 &rotationCenter, const quat &rotation, const vec3 &trans)
 
bool ispointinside (const vec4 &p, const mat4 &m)
 
mat4 fromeuler (const vec3 &v)
 
vec3 aseuler (const mat4 &m)
 
mat4 skewsymmetric (const vec3 &v)
 
__forceinline bool isidentity (const mat4 &m)
 
__forceinline scalar determinant (const mat4 &m)
 
__forceinline mat4 inverse (const mat4 &m)
 
__forceinline mat4 lookatlh (const point &eye, const point &at, const vector &up)
 
__forceinline mat4 lookatrh (const point &eye, const point &at, const vector &up)
 
__forceinline mat4 operator* (const mat4 &m0, const mat4 &m1)
 
__forceinline vec4 operator* (const mat4 &m, const vec4 &v)
 
__forceinline vec4 operator* (const mat4 &m, const vec3 &v)
 
__forceinline vec4 operator* (const mat4 &m, const point &p)
 
__forceinline vector operator* (const mat4 &m, const vector &v)
 
__forceinline mat4 ortholh (scalar w, scalar h, scalar zn, scalar zf)
 
__forceinline mat4 orthorh (scalar w, scalar h, scalar zn, scalar zf)
 
__forceinline mat4 orthooffcenterlh (scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
 
__forceinline mat4 orthooffcenterrh (scalar l, scalar r, scalar t, scalar b, scalar zn, scalar zf)
 
__forceinline mat4 perspfovlh (scalar fovy, scalar aspect, scalar zn, scalar zf)
 
__forceinline mat4 perspfovrh (scalar fovy, scalar aspect, scalar zn, scalar zf)
 
__forceinline mat4 persplh (scalar w, scalar h, scalar zn, scalar zf)
 
__forceinline mat4 persprh (scalar w, scalar h, scalar zn, scalar zf)
 
__forceinline mat4 perspoffcenterlh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 
__forceinline mat4 perspoffcenterrh (scalar l, scalar r, scalar b, scalar t, scalar zn, scalar zf)
 
__forceinline mat4 rotationaxis (const vec3 &axis, scalar angle)
 
__forceinline mat4 rotationx (scalar angle)
 
__forceinline mat4 rotationy (scalar angle)
 
__forceinline mat4 rotationz (scalar angle)
 
__forceinline mat4 rotationyawpitchroll (scalar yaw, scalar pitch, scalar roll)
 
__forceinline mat4 scaling (scalar scale)
 
__forceinline mat4 scaling (scalar sx, scalar sy, scalar sz)
 
__forceinline mat4 scaling (const vec3 &s)
 
__forceinline mat4 translation (scalar x, scalar y, scalar z)
 
__forceinline mat4 translation (const vec3 &t)
 
__forceinline mat4 trs (const vec3 &position, const quat &rotation, const vec3 &scale)
 A short hand for creating a TRS (translation, rotation, scale) matrix from pos, rot and scale.
 
__forceinline mat4 transpose (const mat4 &m)
 
vector get_normal (const plane &plane)
 
point get_point (const plane &plane)
 
bool intersectline (const plane &plane, const point &startPoint, const point &endPoint, point &outIntersectPoint)
 
bool intersectplane (const plane &p1, const plane &p2, line &outLine)
 TODO: Test and make sure it produces correct intersection line.
 
ClipStatus::Type clip (const plane &plane, const line &l, line &outClippedLine)
 
__forceinline scalar dot (const plane &p, const vec4 &v1)
 
__forceinline plane normalize (const plane &p)
 
__forceinline plane operator* (const mat4 &m, const plane &p)
 
__forceinline point operator+ (const point &lhs, const vector &rhs)
 
__forceinline point operator- (const point &lhs, const vector &rhs)
 
__forceinline vector operator- (const point &lhs, const point &rhs)
 
__forceinline scalar dot (const point &p0, const point &p1)
 
__forceinline scalar dot (const vector &v, const point &p)
 
__forceinline scalar dot (const point &p, const vector &v)
 
__forceinline point maximize (const point &v0, const point &v1)
 
__forceinline point minimize (const point &v0, const point &v1)
 
__forceinline bool less_any (const point &v0, const point &v1)
 
__forceinline bool less_all (const point &v0, const point &v1)
 
__forceinline bool lessequal_any (const point &v0, const point &v1)
 
__forceinline bool lessequal_all (const point &v0, const point &v1)
 
__forceinline bool greater_any (const point &v0, const point &v1)
 
__forceinline bool greater_all (const point &v0, const point &v1)
 
__forceinline bool greaterequal_any (const point &v0, const point &v1)
 
__forceinline bool greaterequal_all (const point &v0, const point &v1)
 
__forceinline bool equal_any (const point &v0, const point &v1)
 
__forceinline bool nearequal (const point &v0, const point &v1, float epsilon)
 
__forceinline point less (const point &v0, const point &v1)
 
__forceinline point greater (const point &v0, const point &v1)
 
__forceinline point equal (const point &v0, const point &v1)
 
__forceinline vec3 xyz (const point &v)
 
quat rotationmatrix (const mat4 &m)
 
quat quatyawpitchroll (scalar y, scalar x, scalar z)
 
vec3 to_euler (const quat &q)
 
quat from_euler (const vec3 &v)
 
quat slerp (const quat &q1, const quat &q2, scalar t)
 quat slerp TODO: rewrite using sse/avx
 
vec3 rotate (quat const &q, vec3 const &v)
 Rotate a vector by a quaternion.
 
__forceinline bool isidentity (const quat &q)
 
__forceinline scalar length (const quat &q)
 
__forceinline scalar lengthsq (const quat &q)
 
__forceinline quat quatUndenormalize (const quat &q)
 
__forceinline quat barycentric (const quat &q0, const quat &q1, const quat &q2, scalar f, scalar g)
 
__forceinline quat conjugate (const quat &q)
 
__forceinline scalar dot (const quat &q0, const quat &q1)
 
__forceinline quat quatExp (const quat &q)
 
__forceinline quat identity ()
 
__forceinline quat inverse (const quat &q)
 
__forceinline quat ln (const quat &q)
 
__forceinline quat operator* (const quat &q0, const quat &q1)
 
__forceinline quat normalize (const quat &q)
 
__forceinline quat rotationquataxis (const vec3 &axis, scalar angle)
 quat from rotation axis + angle.
 
__forceinline void squadsetup (const quat &q0, const quat &q1, const quat &q2, const quat &q3, quat &aOut, quat &bOut, quat &cOut)
 
__forceinline quat squad (const quat &q1, const quat &a, const quat &b, const quat &c, scalar t)
 
__forceinline void to_axisangle (const quat &q, vec4 &outAxis, scalar &outAngle)
 
__forceinline scalar rand ()
 Return a pseudo random number between 0 and 1.
 
__forceinline scalar rand (scalar min, scalar max)
 Return a pseudo random number between min and max.
 
__forceinline scalar sin (scalar x)
 
__forceinline scalar cos (scalar x)
 
__forceinline scalar tan (scalar x)
 
__forceinline scalar asin (scalar x)
 
__forceinline scalar acos (scalar x)
 
__forceinline scalar atan (scalar x)
 
__forceinline scalar sqrt (scalar x)
 
__forceinline int fchop (scalar f)
 Chop float to int.
 
__forceinline scalar fmod (scalar x, scalar y)
 
__forceinline scalar modangle (scalar a)
 Normalize an angular value into the range rad(0) to rad(360).
 
__forceinline scalar log2 (scalar f)
 log2() function.
 
__forceinline scalar exp2 (scalar x)
 
__forceinline scalar log (scalar x)
 get logarithm of x
 
__forceinline scalar exp (scalar x)
 
__forceinline int frnd (scalar f)
 Round float to integer.
 
__forceinline scalar pow (scalar x, scalar y)
 
__forceinline bool fequal (scalar f0, scalar f1, scalar tol)
 A fuzzy floating point equality check.
 
template<typename TYPE >
__forceinline TYPE max (TYPE a, TYPE b)
 
template<typename TYPE0 , typename ... TYPEN>
__forceinline TYPE0 max (TYPE0 first, TYPE0 second, TYPEN... rest)
 
template<>
__forceinline unsigned int max (unsigned int a, unsigned int b)
 branchless max for uint32
 
template<typename TYPE >
__forceinline TYPE min (TYPE a, TYPE b)
 
template<>
__forceinline unsigned int min (unsigned int a, unsigned int b)
 branchless min for uints
 
template<>
__forceinline uint16_t min (uint16_t a, uint16_t b)
 branchless min for uints
 
template<typename TYPE0 , typename ... TYPEN>
__forceinline TYPE0 min (TYPE0 first, TYPE0 second, TYPEN... rest)
 
__forceinline scalar abs (scalar a)
 
__forceinline double abs (double a)
 
__forceinline int abs (int a)
 
__forceinline scalar sgn (scalar a)
 
__forceinline constexpr scalar deg2rad (scalar d)
 
__forceinline constexpr scalar rad2deg (scalar r)
 
__forceinline float clamp (float val, float minVal, float maxVal)
 Float clamping.
 
__forceinline int64_t clamp (int64_t val, int64_t minVal, int64_t maxVal)
 int clamping.
 
__forceinline int32_t clamp (int32_t val, int32_t minVal, int32_t maxVal)
 int clamping.
 
__forceinline float ceil (float val)
 Floating point ceiling.
 
__forceinline float floor (float val)
 Floating point flooring.
 
__forceinline float round (float val)
 Floating point rounding.
 
__forceinline bool fless (scalar f0, scalar f1, scalar tol)
 A fuzzy floating point less-then check.
 
__forceinline bool fgreater (scalar f0, scalar f1, scalar tol)
 A fuzzy floating point greater-then check.
 
__forceinline scalar saturate (scalar val)
 Saturate a value (clamps between 0.0f and 1.0f)
 
__forceinline double saturate (double val)
 Saturate a value (clamps between 0.0f and 1.0f)
 
__forceinline float lerp (float x, float y, float l)
 Linearly interpolate between 2 values: ret = x + l * (y - x)
 
__forceinline scalar angulardistance (scalar from, scalar to)
 Get angular distance.
 
__forceinline bool isdenormal (scalar s)
 Returns true if the input scalar is denormalized (#DEN)
 
__forceinline float undenormalize (scalar s)
 Returns 0 if scalar is denormal.
 
__forceinline bool nearequal (scalar a, scalar b, scalar epsilon)
 test of nearly equal given a tolerance (epsilon)
 
__forceinline scalar cot (scalar x)
 
__forceinline scalar smoothstep (scalar edge0, scalar edge1, scalar x)
 
__forceinline int irand (int min, int max)
 Return a pseudo integer random number between min and max.
 
__forceinline int mostsignificant (unsigned int val)
 Returns the position of the most significant bit of the number.
 
__forceinline unsigned int align (unsigned int alignant, unsigned int alignment)
 
__forceinline uintptr_t alignptr (uintptr_t alignant, uintptr_t alignment)
 
__forceinline unsigned int align_down (unsigned int alignant, unsigned int alignment)
 
__forceinline uintptr_t align_downptr (uintptr_t alignant, uintptr_t alignment)
 
__forceinline unsigned int divandroundup (unsigned int dividend, unsigned int divider)
 Integer division with rounding.
 
__forceinline unsigned int roundtopow2 (unsigned int val)
 Rounds up to next power of 2.
 
__forceinline uint64 randxor (randxorstate &state)
 
__forceinline uint32_t pointerhash (void *ptr)
 cheap pointer hash using modulo with a mersenne prime
 
__forceinline __m128 fmadd (__m128 a, __m128 b, __m128 c)
 Fused multiply-add operation, (a * b) + c.
 
__forceinline __m128 less (__m128 a, __m128 b)
 Constructs a vector of results where each element corresponds to a[i] < b[i] with either 0 or 1.
 
__forceinline __m128 greater (__m128 a, __m128 b)
 Constructs a vector of results where each element corresponds to a[i] > b[i] with either 0 or 1.
 
__forceinline __m128 recip (__m128 a)
 
__forceinline __m128 mul (__m128 a, __m128 b)
 
__forceinline __m128 div (__m128 a, __m128 b)
 
template<int x, int y, int z, int w>
__forceinline __m128 swizzle (__m128 v)
 
transform operator* (const transform &a, const transform &b)
 
transform lerp (const transform &a, const transform &b, float t)
 
point operator* (const transform &a, const point &b)
 transforms a position (applies scale, rotation and offset)
 
vector operator* (const transform &a, const vector &b)
 transforms a vector (ignores position)
 
__forceinline vec2 lerp (const vec2 &v0, const vec2 &v1, scalar s)
 
__forceinline vec3 operator- (const vec3 &lhs)
 
__forceinline vec3 operator* (const vec3 &lhs, scalar t)
 
__forceinline vec3 operator* (const vec3 &lhs, const vec3 &rhs)
 
__forceinline vec3 operator+ (const vec3 &lhs, const vec3 &rhs)
 
__forceinline vec3 operator- (const vec3 &lhs, const vec3 &rhs)
 
__forceinline scalar length (const vec3 &v)
 
__forceinline scalar lengthsq (const vec3 &v)
 
__forceinline vec3 reciprocal (const vec3 &v)
 
__forceinline vec3 reciprocalapprox (const vec3 &v)
 
__forceinline vec3 multiply (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 multiplyadd (const vec3 &v0, const vec3 &v1, const vec3 &v2)
 
__forceinline vec3 divide (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 abs (const vec3 &v)
 
__forceinline vec3 cross (const vec3 &v0, const vec3 &v1)
 
__forceinline scalar dot (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 barycentric (const vec3 &v0, const vec3 &v1, const vec3 &v2, scalar f, scalar g)
 calculates Result = v0 + f * (v1 - v0) + g * (v2 - v0)
 
__forceinline vec3 catmullrom (const vec3 &v0, const vec3 &v1, const vec3 &v2, const vec3 &v3, scalar s)
 
__forceinline vec3 hermite (const vec3 &v1, const vec3 &t1, const vec3 &v2, const vec3 &t2, scalar s)
 
__forceinline scalar angle (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 lerp (const vec3 &v0, const vec3 &v1, scalar s)
 
__forceinline vec3 maximize (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 minimize (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 clamp (const vec3 &clamp, const vec3 &min, const vec3 &max)
 
__forceinline vec3 normalize (const vec3 &v)
 
__forceinline vec3 normalizeapprox (const vec3 &v)
 
__forceinline vec3 reflect (const vec3 &normal, const vec3 &incident)
 
__forceinline bool less_any (const vec3 &v0, const vec3 &v1)
 
__forceinline bool less_all (const vec3 &v0, const vec3 &v1)
 
__forceinline bool lessequal_any (const vec3 &v0, const vec3 &v1)
 
__forceinline bool lessequal_all (const vec3 &v0, const vec3 &v1)
 
__forceinline bool greater_any (const vec3 &v0, const vec3 &v1)
 
__forceinline bool greater_all (const vec3 &v0, const vec3 &v1)
 
__forceinline bool greaterequal_any (const vec3 &v0, const vec3 &v1)
 
__forceinline bool greaterequal_all (const vec3 &v0, const vec3 &v1)
 
__forceinline bool equal_any (const vec3 &v0, const vec3 &v1)
 
__forceinline bool nearequal (const vec3 &v0, const vec3 &v1, float epsilon)
 
__forceinline bool nearequal (const vec3 &v0, const vec3 &v1, const vec3 &epsilon)
 
__forceinline vec3 less (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 greater (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 equal (const vec3 &v0, const vec3 &v1)
 
__forceinline vec3 splat (const vec3 &v, uint element)
 
__forceinline vec3 splat_x (const vec3 &v)
 
__forceinline vec3 splat_y (const vec3 &v)
 
__forceinline vec3 splat_z (const vec3 &v)
 
__forceinline vec3 permute (const vec3 &v0, const vec3 &v1, unsigned int i0, unsigned int i1, unsigned int i2)
 
__forceinline vec3 select (const vec3 &v0, const vec3 &v1, const uint i0, const uint i1, const uint i2)
 
__forceinline vec3 select (const vec3 &v0, const vec3 &v1, const vec3 &control)
 
__forceinline vec3 floor (const vec3 &v)
 
__forceinline vec3 ceiling (const vec3 &v)
 
__forceinline vec4 operator- (const vec4 &lhs)
 
__forceinline vec4 operator* (const vec4 &lhs, scalar t)
 
__forceinline vec4 operator* (const vec4 &lhs, const vec4 &rhs)
 
__forceinline vec4 operator+ (const vec4 &lhs, const vec4 &rhs)
 
__forceinline vec4 operator- (const vec4 &lhs, const vec4 &rhs)
 
__forceinline scalar length (const vec4 &v)
 
__forceinline scalar length3 (const vec4 &v)
 
__forceinline scalar lengthsq (const vec4 &v)
 
__forceinline scalar lengthsq3 (const vec4 &v)
 
__forceinline vec4 reciprocal (const vec4 &v)
 
__forceinline vec4 reciprocalapprox (const vec4 &v)
 
__forceinline vec4 multiply (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 multiplyadd (const vec4 &v0, const vec4 &v1, const vec4 &v2)
 
__forceinline vec4 divide (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 abs (const vec4 &v)
 
__forceinline vec4 cross3 (const vec4 &v0, const vec4 &v1)
 
__forceinline scalar dot (const vec4 &v0, const vec4 &v1)
 
__forceinline scalar dot3 (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 barycentric (const vec4 &v0, const vec4 &v1, const vec4 &v2, scalar f, scalar g)
 calculates Result = v0 + f * (v1 - v0) + g * (v2 - v0)
 
__forceinline vec4 catmullrom (const vec4 &v0, const vec4 &v1, const vec4 &v2, const vec4 &v3, scalar s)
 
__forceinline vec4 hermite (const vec4 &v1, const vec4 &t1, const vec4 &v2, const vec4 &t2, scalar s)
 
__forceinline scalar angle (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 lerp (const vec4 &v0, const vec4 &v1, scalar s)
 
__forceinline vec4 maximize (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 minimize (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 clamp (const vec4 &clamp, const vec4 &min, const vec4 &max)
 
__forceinline vec4 normalize (const vec4 &v)
 
__forceinline vec4 normalizeapprox (const vec4 &v)
 
__forceinline vec4 normalize3 (const vec4 &v)
 
__forceinline vec4 normalize3approx (const vec4 &v)
 
__forceinline vec4 reflect (const vec4 &normal, const vec4 &incident)
 
__forceinline vec4 perspective_div (const vec4 &v)
 
__forceinline bool less_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool less_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool lessequal_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool lessequal_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greater_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greater_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greaterequal_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greaterequal_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool equal_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool nearequal (const vec4 &v0, const vec4 &v1, const float epsilon)
 
__forceinline bool nearequal (const vec4 &v0, const vec4 &v1, const vec4 &epsilon)
 
__forceinline vec4 less (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 greater (const vec4 &v0, const vec4 &v1)
 
__forceinline vec4 equal (const vec4 &v0, const vec4 &v1)
 
__forceinline bool less3_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool less3_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool lessequal3_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool lessequal3_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greater3_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greater3_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greaterequal3_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool greaterequal3_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool equal3_any (const vec4 &v0, const vec4 &v1)
 
__forceinline bool equal3_all (const vec4 &v0, const vec4 &v1)
 
__forceinline bool nearequal3 (const vec4 &v0, const vec4 &v1, const vec4 &epsilon)
 
__forceinline vec4 splat (const vec4 &v, uint element)
 
__forceinline vec4 splat_x (const vec4 &v)
 
__forceinline vec4 splat_y (const vec4 &v)
 
__forceinline vec4 splat_z (const vec4 &v)
 
__forceinline vec4 splat_w (const vec4 &v)
 
__forceinline vec4 permute (const vec4 &v0, const vec4 &v1, unsigned int i0, unsigned int i1, unsigned int i2, unsigned int i3)
 
__forceinline vec4 select (const vec4 &v0, const vec4 &v1, const uint i0, const uint i1, const uint i2, const uint i3)
 
__forceinline vec4 select (const vec4 &v0, const vec4 &v1, const vec4 &control)
 
__forceinline vec4 floor (const vec4 &v)
 
__forceinline vec4 ceil (const vec4 &v)
 
__forceinline vec3 xyz (const vec4 &v)
 
__forceinline vector operator- (const vector &rhs)
 
__forceinline vector operator+ (const vector &lhs, const vector &rhs)
 
__forceinline vector operator- (const vector &lhs, const vector &rhs)
 
__forceinline vector operator* (const vector &lhs, scalar s)
 
__forceinline vector operator* (const vector &lhs, const vector &rhs)
 
__forceinline vector normalize (const vector &v)
 
__forceinline vector normalizeapprox (const vector &v)
 
__forceinline scalar dot (const vector &v0, const vector &v1)
 
__forceinline vector cross (const vector &v0, const vector &v1)
 
__forceinline scalar length (const vector &v)
 
__forceinline scalar lengthsq (const vector &v)
 

Variables

static const __m128i maskX = _mm_setr_epi32( -1,0,0,0 )
 
static const __m128i maskY = _mm_setr_epi32( 0,-1,0,0 )
 
static const __m128i maskZ = _mm_setr_epi32( 0,0,-1,0 )
 
static const __m128i maskW = _mm_setr_epi32( 0,0,0,-1 )
 
static const __m128 _id_x = _mm_setr_ps(1.0f, 0.0f, 0.0f, 0.0f)
 
static const __m128 _id_y = _mm_setr_ps(0.0f, 1.0f, 0.0f, 0.0f)
 
static const __m128 _id_z = _mm_setr_ps(0.0f, 0.0f, 1.0f, 0.0f)
 
static const __m128 _id_w = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f)
 
static const __m128 _minus1 = _mm_setr_ps(-1.0f, -1.0f, -1.0f, -1.0f)
 
static const __m128 _plus1 = _mm_setr_ps(1.0f, 1.0f, 1.0f, 1.0f)
 
static const __m128 _zero = _mm_setr_ps(0.0f, 0.0f, 0.0f, 0.0f)
 
static const __m128i _sign = _mm_setr_epi32(0x80000000, 0x80000000, 0x80000000, 0x80000000)
 
static const __m128 _mask_xyz = _mm_castsi128_ps(_mm_setr_epi32( 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0 ))
 
static const unsigned int PERMUTE_0X = 0
 
static const unsigned int PERMUTE_0Y = 1
 
static const unsigned int PERMUTE_0Z = 2
 
static const unsigned int PERMUTE_0W = 3
 
static const unsigned int PERMUTE_1X = 4
 
static const unsigned int PERMUTE_1Y = 5
 
static const unsigned int PERMUTE_1Z = 6
 
static const unsigned int PERMUTE_1W = 7
 

Typedef Documentation

◆ float32

typedef float Math::float32

◆ float64

typedef double Math::float64

◆ floatRectangle

◆ intRectangle

◆ scalar

typedef float Math::scalar

Function Documentation

◆ abs() [1/5]

__forceinline vec3 Math::abs ( const vec3 & v)

◆ abs() [2/5]

__forceinline vec4 Math::abs ( const vec4 & v)

◆ abs() [3/5]

__forceinline double Math::abs ( double a)

◆ abs() [4/5]

__forceinline int Math::abs ( int a)

◆ abs() [5/5]

__forceinline scalar Math::abs ( scalar a)

◆ acos()

__forceinline scalar Math::acos ( scalar x)

◆ affine() [1/3]

mat4 Math::affine ( const vec3 & scale,
const quat & rotation,
const vec3 & translation )

◆ affine() [2/3]

mat4 Math::affine ( const vec3 & scale,
const vec3 & rotation,
const vec3 & translation )

◆ affine() [3/3]

mat4 Math::affine ( const vec3 & scale,
const vec3 & rotationCenter,
const quat & rotation,
const vec3 & translation )

◆ affinetransformation()

mat4 Math::affinetransformation ( scalar scale,
const vec3 & rotationCenter,
const quat & rotation,
const vec3 & translation )

◆ align()

__forceinline unsigned int Math::align ( unsigned int alignant,
unsigned int alignment )

◆ align_down()

__forceinline unsigned int Math::align_down ( unsigned int alignant,
unsigned int alignment )

◆ align_downptr()

__forceinline uintptr_t Math::align_downptr ( uintptr_t alignant,
uintptr_t alignment )

◆ alignptr()

__forceinline uintptr_t Math::alignptr ( uintptr_t alignant,
uintptr_t alignment )

◆ angle() [1/2]

__forceinline scalar Math::angle ( const vec3 & v0,
const vec3 & v1 )

◆ angle() [2/2]

__forceinline scalar Math::angle ( const vec4 & v0,
const vec4 & v1 )

◆ angulardistance()

__forceinline scalar Math::angulardistance ( scalar from,
scalar to )

Get angular distance.

◆ aseuler()

vec3 Math::aseuler ( const mat4 & m)

◆ asin()

__forceinline scalar Math::asin ( scalar x)

◆ atan()

__forceinline scalar Math::atan ( scalar x)

◆ barycentric() [1/3]

__forceinline quat Math::barycentric ( const quat & q0,
const quat & q1,
const quat & q2,
scalar f,
scalar g )

◆ barycentric() [2/3]

__forceinline vec3 Math::barycentric ( const vec3 & v0,
const vec3 & v1,
const vec3 & v2,
scalar f,
scalar g )

calculates Result = v0 + f * (v1 - v0) + g * (v2 - v0)

◆ barycentric() [3/3]

__forceinline vec4 Math::barycentric ( const vec4 & v0,
const vec4 & v1,
const vec4 & v2,
scalar f,
scalar g )

calculates Result = v0 + f * (v1 - v0) + g * (v2 - v0)

◆ catmullrom() [1/2]

__forceinline vec3 Math::catmullrom ( const vec3 & v0,
const vec3 & v1,
const vec3 & v2,
const vec3 & v3,
scalar s )

◆ catmullrom() [2/2]

__forceinline vec4 Math::catmullrom ( const vec4 & v0,
const vec4 & v1,
const vec4 & v2,
const vec4 & v3,
scalar s )

◆ ceil() [1/2]

__forceinline vec4 Math::ceil ( const vec4 & v)

◆ ceil() [2/2]

__forceinline float Math::ceil ( float val)

Floating point ceiling.

◆ ceiling()

__forceinline vec3 Math::ceiling ( const vec3 & v)

◆ clamp() [1/5]

__forceinline vec3 Math::clamp ( const vec3 & clamp,
const vec3 & min,
const vec3 & max )

◆ clamp() [2/5]

__forceinline vec4 Math::clamp ( const vec4 & clamp,
const vec4 & min,
const vec4 & max )

◆ clamp() [3/5]

__forceinline float Math::clamp ( float val,
float minVal,
float maxVal )

Float clamping.

◆ clamp() [4/5]

__forceinline int32_t Math::clamp ( int32_t val,
int32_t minVal,
int32_t maxVal )

int clamping.

◆ clamp() [5/5]

__forceinline int64_t Math::clamp ( int64_t val,
int64_t minVal,
int64_t maxVal )

int clamping.

◆ clip()

ClipStatus::Type Math::clip ( const plane & plane,
const line & l,
line & outClippedLine )
inline

◆ conjugate()

__forceinline quat Math::conjugate ( const quat & q)

◆ cos()

__forceinline scalar Math::cos ( scalar x)

◆ cot()

__forceinline scalar Math::cot ( scalar x)

◆ cross() [1/2]

__forceinline vec3 Math::cross ( const vec3 & v0,
const vec3 & v1 )

◆ cross() [2/2]

__forceinline vector Math::cross ( const vector & v0,
const vector & v1 )

◆ cross3()

__forceinline vec4 Math::cross3 ( const vec4 & v0,
const vec4 & v1 )

◆ decompose()

void Math::decompose ( const mat4 & mat,
vec3 & outScale,
quat & outRotation,
vec3 & outTranslation )

◆ deg2rad()

__forceinline constexpr scalar Math::deg2rad ( scalar d)
constexpr

◆ determinant()

__forceinline scalar Math::determinant ( const mat4 & m)

◆ div()

__forceinline __m128 Math::div ( __m128 a,
__m128 b )

◆ divandroundup()

__forceinline unsigned int Math::divandroundup ( unsigned int dividend,
unsigned int divider )

Integer division with rounding.

◆ divide() [1/2]

__forceinline vec3 Math::divide ( const vec3 & v0,
const vec3 & v1 )

◆ divide() [2/2]

__forceinline vec4 Math::divide ( const vec4 & v0,
const vec4 & v1 )

◆ dot() [1/8]

__forceinline scalar Math::dot ( const plane & p,
const vec4 & v1 )

◆ dot() [2/8]

__forceinline scalar Math::dot ( const point & p,
const vector & v )

◆ dot() [3/8]

__forceinline scalar Math::dot ( const point & p0,
const point & p1 )

◆ dot() [4/8]

__forceinline scalar Math::dot ( const quat & q0,
const quat & q1 )

◆ dot() [5/8]

__forceinline scalar Math::dot ( const vec3 & v0,
const vec3 & v1 )

◆ dot() [6/8]

__forceinline scalar Math::dot ( const vec4 & v0,
const vec4 & v1 )

◆ dot() [7/8]

__forceinline scalar Math::dot ( const vector & v,
const point & p )

◆ dot() [8/8]

__forceinline scalar Math::dot ( const vector & v0,
const vector & v1 )

◆ dot3()

__forceinline scalar Math::dot3 ( const vec4 & v0,
const vec4 & v1 )

◆ equal() [1/3]

__forceinline point Math::equal ( const point & v0,
const point & v1 )

◆ equal() [2/3]

__forceinline vec3 Math::equal ( const vec3 & v0,
const vec3 & v1 )

◆ equal() [3/3]

__forceinline vec4 Math::equal ( const vec4 & v0,
const vec4 & v1 )

◆ equal3_all()

__forceinline bool Math::equal3_all ( const vec4 & v0,
const vec4 & v1 )

◆ equal3_any()

__forceinline bool Math::equal3_any ( const vec4 & v0,
const vec4 & v1 )

◆ equal_any() [1/3]

__forceinline bool Math::equal_any ( const point & v0,
const point & v1 )

◆ equal_any() [2/3]

__forceinline bool Math::equal_any ( const vec3 & v0,
const vec3 & v1 )

◆ equal_any() [3/3]

__forceinline bool Math::equal_any ( const vec4 & v0,
const vec4 & v1 )

◆ exp()

__forceinline scalar Math::exp ( scalar x)

◆ exp2()

__forceinline scalar Math::exp2 ( scalar x)

◆ fchop()

__forceinline int Math::fchop ( scalar f)

Chop float to int.

Todo
type cast to int is slow!

◆ fequal()

__forceinline bool Math::fequal ( scalar f0,
scalar f1,
scalar tol )

A fuzzy floating point equality check.

◆ fgreater()

__forceinline bool Math::fgreater ( scalar f0,
scalar f1,
scalar tol )

A fuzzy floating point greater-then check.

◆ fless()

__forceinline bool Math::fless ( scalar f0,
scalar f1,
scalar tol )

A fuzzy floating point less-then check.

◆ floor() [1/3]

__forceinline vec3 Math::floor ( const vec3 & v)

◆ floor() [2/3]

__forceinline vec4 Math::floor ( const vec4 & v)

◆ floor() [3/3]

__forceinline float Math::floor ( float val)

Floating point flooring.

◆ fmadd()

__forceinline __m128 Math::fmadd ( __m128 a,
__m128 b,
__m128 c )

Fused multiply-add operation, (a * b) + c.

◆ fmod()

__forceinline scalar Math::fmod ( scalar x,
scalar y )

◆ frnd()

__forceinline int Math::frnd ( scalar f)

Round float to integer.

◆ from_euler()

quat Math::from_euler ( const vec3 & v)

◆ fromeuler()

mat4 Math::fromeuler ( const vec3 & v)

◆ get_normal()

vector Math::get_normal ( const plane & plane)
inline

◆ get_point()

point Math::get_point ( const plane & plane)
inline

◆ greater() [1/4]

__forceinline __m128 Math::greater ( __m128 a,
__m128 b )

Constructs a vector of results where each element corresponds to a[i] > b[i] with either 0 or 1.

◆ greater() [2/4]

__forceinline point Math::greater ( const point & v0,
const point & v1 )

◆ greater() [3/4]

__forceinline vec3 Math::greater ( const vec3 & v0,
const vec3 & v1 )

◆ greater() [4/4]

__forceinline vec4 Math::greater ( const vec4 & v0,
const vec4 & v1 )

◆ greater3_all()

__forceinline bool Math::greater3_all ( const vec4 & v0,
const vec4 & v1 )

◆ greater3_any()

__forceinline bool Math::greater3_any ( const vec4 & v0,
const vec4 & v1 )

◆ greater_all() [1/3]

__forceinline bool Math::greater_all ( const point & v0,
const point & v1 )

◆ greater_all() [2/3]

__forceinline bool Math::greater_all ( const vec3 & v0,
const vec3 & v1 )

◆ greater_all() [3/3]

__forceinline bool Math::greater_all ( const vec4 & v0,
const vec4 & v1 )

◆ greater_any() [1/3]

__forceinline bool Math::greater_any ( const point & v0,
const point & v1 )

◆ greater_any() [2/3]

__forceinline bool Math::greater_any ( const vec3 & v0,
const vec3 & v1 )

◆ greater_any() [3/3]

__forceinline bool Math::greater_any ( const vec4 & v0,
const vec4 & v1 )

◆ greaterequal3_all()

__forceinline bool Math::greaterequal3_all ( const vec4 & v0,
const vec4 & v1 )

◆ greaterequal3_any()

__forceinline bool Math::greaterequal3_any ( const vec4 & v0,
const vec4 & v1 )

◆ greaterequal_all() [1/3]

__forceinline bool Math::greaterequal_all ( const point & v0,
const point & v1 )

◆ greaterequal_all() [2/3]

__forceinline bool Math::greaterequal_all ( const vec3 & v0,
const vec3 & v1 )

◆ greaterequal_all() [3/3]

__forceinline bool Math::greaterequal_all ( const vec4 & v0,
const vec4 & v1 )

◆ greaterequal_any() [1/3]

__forceinline bool Math::greaterequal_any ( const point & v0,
const point & v1 )

◆ greaterequal_any() [2/3]

__forceinline bool Math::greaterequal_any ( const vec3 & v0,
const vec3 & v1 )

◆ greaterequal_any() [3/3]

__forceinline bool Math::greaterequal_any ( const vec4 & v0,
const vec4 & v1 )

◆ hermite() [1/2]

__forceinline vec3 Math::hermite ( const vec3 & v1,
const vec3 & t1,
const vec3 & v2,
const vec3 & t2,
scalar s )

◆ hermite() [2/2]

__forceinline vec4 Math::hermite ( const vec4 & v1,
const vec4 & t1,
const vec4 & v2,
const vec4 & t2,
scalar s )

◆ identity()

__forceinline quat Math::identity ( )

◆ intersectline()

bool Math::intersectline ( const plane & plane,
const point & startPoint,
const point & endPoint,
point & outIntersectPoint )
inline

◆ intersectplane()

bool Math::intersectplane ( const plane & p1,
const plane & p2,
line & outLine )
inline

TODO: Test and make sure it produces correct intersection line.

◆ inverse() [1/2]

__forceinline mat4 Math::inverse ( const mat4 & m)

◆ inverse() [2/2]

__forceinline quat Math::inverse ( const quat & q)

◆ irand()

__forceinline int Math::irand ( int min,
int max )

Return a pseudo integer random number between min and max.

◆ isdenormal()

__forceinline bool Math::isdenormal ( scalar s)

Returns true if the input scalar is denormalized (#DEN)

◆ isidentity() [1/2]

__forceinline bool Math::isidentity ( const mat4 & m)

◆ isidentity() [2/2]

__forceinline bool Math::isidentity ( const quat & q)

◆ ispointinside()

bool Math::ispointinside ( const vec4 & p,
const mat4 & m )

◆ length() [1/4]

__forceinline scalar Math::length ( const quat & q)

◆ length() [2/4]

__forceinline scalar Math::length ( const vec3 & v)

◆ length() [3/4]

__forceinline scalar Math::length ( const vec4 & v)

◆ length() [4/4]

__forceinline scalar Math::length ( const vector & v)

◆ length3()

__forceinline scalar Math::length3 ( const vec4 & v)

◆ lengthsq() [1/4]

__forceinline scalar Math::lengthsq ( const quat & q)

◆ lengthsq() [2/4]

__forceinline scalar Math::lengthsq ( const vec3 & v)

◆ lengthsq() [3/4]

__forceinline scalar Math::lengthsq ( const vec4 & v)

◆ lengthsq() [4/4]

__forceinline scalar Math::lengthsq ( const vector & v)

◆ lengthsq3()

__forceinline scalar Math::lengthsq3 ( const vec4 & v)

◆ lerp() [1/5]

transform Math::lerp ( const transform & a,
const transform & b,
float t )
inline

◆ lerp() [2/5]

__forceinline vec2 Math::lerp ( const vec2 & v0,
const vec2 & v1,
scalar s )

◆ lerp() [3/5]

__forceinline vec3 Math::lerp ( const vec3 & v0,
const vec3 & v1,
scalar s )

◆ lerp() [4/5]

__forceinline vec4 Math::lerp ( const vec4 & v0,
const vec4 & v1,
scalar s )

◆ lerp() [5/5]

__forceinline float Math::lerp ( float x,
float y,
float l )

Linearly interpolate between 2 values: ret = x + l * (y - x)

◆ less() [1/4]

__forceinline __m128 Math::less ( __m128 a,
__m128 b )

Constructs a vector of results where each element corresponds to a[i] < b[i] with either 0 or 1.

◆ less() [2/4]

__forceinline point Math::less ( const point & v0,
const point & v1 )

◆ less() [3/4]

__forceinline vec3 Math::less ( const vec3 & v0,
const vec3 & v1 )

◆ less() [4/4]

__forceinline vec4 Math::less ( const vec4 & v0,
const vec4 & v1 )

◆ less3_all()

__forceinline bool Math::less3_all ( const vec4 & v0,
const vec4 & v1 )

◆ less3_any()

__forceinline bool Math::less3_any ( const vec4 & v0,
const vec4 & v1 )

◆ less_all() [1/3]

__forceinline bool Math::less_all ( const point & v0,
const point & v1 )

◆ less_all() [2/3]

__forceinline bool Math::less_all ( const vec3 & v0,
const vec3 & v1 )

◆ less_all() [3/3]

__forceinline bool Math::less_all ( const vec4 & v0,
const vec4 & v1 )

◆ less_any() [1/3]

__forceinline bool Math::less_any ( const point & v0,
const point & v1 )

◆ less_any() [2/3]

__forceinline bool Math::less_any ( const vec3 & v0,
const vec3 & v1 )

◆ less_any() [3/3]

__forceinline bool Math::less_any ( const vec4 & v0,
const vec4 & v1 )

◆ lessequal3_all()

__forceinline bool Math::lessequal3_all ( const vec4 & v0,
const vec4 & v1 )

◆ lessequal3_any()

__forceinline bool Math::lessequal3_any ( const vec4 & v0,
const vec4 & v1 )

◆ lessequal_all() [1/3]

__forceinline bool Math::lessequal_all ( const point & v0,
const point & v1 )

◆ lessequal_all() [2/3]

__forceinline bool Math::lessequal_all ( const vec3 & v0,
const vec3 & v1 )

◆ lessequal_all() [3/3]

__forceinline bool Math::lessequal_all ( const vec4 & v0,
const vec4 & v1 )

◆ lessequal_any() [1/3]

__forceinline bool Math::lessequal_any ( const point & v0,
const point & v1 )

◆ lessequal_any() [2/3]

__forceinline bool Math::lessequal_any ( const vec3 & v0,
const vec3 & v1 )

◆ lessequal_any() [3/3]

__forceinline bool Math::lessequal_any ( const vec4 & v0,
const vec4 & v1 )

◆ ln()

__forceinline quat Math::ln ( const quat & q)

◆ log()

__forceinline scalar Math::log ( scalar x)

get logarithm of x

◆ log2()

__forceinline scalar Math::log2 ( scalar f)

log2() function.

◆ lookatlh()

__forceinline mat4 Math::lookatlh ( const point & eye,
const point & at,
const vector & up )

◆ lookatrh()

__forceinline mat4 Math::lookatrh ( const point & eye,
const point & at,
const vector & up )

◆ max() [1/3]

template<typename TYPE >
__forceinline TYPE Math::max ( TYPE a,
TYPE b )

◆ max() [2/3]

template<typename TYPE0 , typename ... TYPEN>
__forceinline TYPE0 Math::max ( TYPE0 first,
TYPE0 second,
TYPEN... rest )

◆ max() [3/3]

template<>
__forceinline unsigned int Math::max ( unsigned int a,
unsigned int b )

branchless max for uint32

◆ maximize() [1/3]

__forceinline point Math::maximize ( const point & v0,
const point & v1 )

◆ maximize() [2/3]

__forceinline vec3 Math::maximize ( const vec3 & v0,
const vec3 & v1 )

◆ maximize() [3/3]

__forceinline vec4 Math::maximize ( const vec4 & v0,
const vec4 & v1 )

◆ min() [1/4]

template<typename TYPE >
__forceinline TYPE Math::min ( TYPE a,
TYPE b )

◆ min() [2/4]

template<typename TYPE0 , typename ... TYPEN>
__forceinline TYPE0 Math::min ( TYPE0 first,
TYPE0 second,
TYPEN... rest )

◆ min() [3/4]

template<>
__forceinline uint16_t Math::min ( uint16_t a,
uint16_t b )

branchless min for uints

◆ min() [4/4]

template<>
__forceinline unsigned int Math::min ( unsigned int a,
unsigned int b )

branchless min for uints

◆ minimize() [1/3]

__forceinline point Math::minimize ( const point & v0,
const point & v1 )

◆ minimize() [2/3]

__forceinline vec3 Math::minimize ( const vec3 & v0,
const vec3 & v1 )

◆ minimize() [3/3]

__forceinline vec4 Math::minimize ( const vec4 & v0,
const vec4 & v1 )

◆ modangle()

__forceinline scalar Math::modangle ( scalar a)

Normalize an angular value into the range rad(0) to rad(360).

FIXME : seems that the xna version limits from -pi to pi, not 0 .. 2pi. will copy behaviour despite what description says

◆ mostsignificant()

__forceinline int Math::mostsignificant ( unsigned int val)

Returns the position of the most significant bit of the number.

◆ mul()

__forceinline __m128 Math::mul ( __m128 a,
__m128 b )

◆ multiply() [1/2]

__forceinline vec3 Math::multiply ( const vec3 & v0,
const vec3 & v1 )

◆ multiply() [2/2]

__forceinline vec4 Math::multiply ( const vec4 & v0,
const vec4 & v1 )

◆ multiplyadd() [1/2]

__forceinline vec3 Math::multiplyadd ( const vec3 & v0,
const vec3 & v1,
const vec3 & v2 )

◆ multiplyadd() [2/2]

__forceinline vec4 Math::multiplyadd ( const vec4 & v0,
const vec4 & v1,
const vec4 & v2 )

◆ nearequal() [1/6]

__forceinline bool Math::nearequal ( const point & v0,
const point & v1,
float epsilon )

◆ nearequal() [2/6]

__forceinline bool Math::nearequal ( const vec3 & v0,
const vec3 & v1,
const vec3 & epsilon )

◆ nearequal() [3/6]

__forceinline bool Math::nearequal ( const vec3 & v0,
const vec3 & v1,
float epsilon )

◆ nearequal() [4/6]

__forceinline bool Math::nearequal ( const vec4 & v0,
const vec4 & v1,
const float epsilon )

◆ nearequal() [5/6]

__forceinline bool Math::nearequal ( const vec4 & v0,
const vec4 & v1,
const vec4 & epsilon )

◆ nearequal() [6/6]

__forceinline bool Math::nearequal ( scalar a,
scalar b,
scalar epsilon )

test of nearly equal given a tolerance (epsilon)

◆ nearequal3()

__forceinline bool Math::nearequal3 ( const vec4 & v0,
const vec4 & v1,
const vec4 & epsilon )

◆ normalize() [1/5]

__forceinline plane Math::normalize ( const plane & p)

◆ normalize() [2/5]

__forceinline quat Math::normalize ( const quat & q)

◆ normalize() [3/5]

__forceinline vec3 Math::normalize ( const vec3 & v)

◆ normalize() [4/5]

__forceinline vec4 Math::normalize ( const vec4 & v)

◆ normalize() [5/5]

__forceinline vector Math::normalize ( const vector & v)

◆ normalize3()

__forceinline vec4 Math::normalize3 ( const vec4 & v)

◆ normalize3approx()

__forceinline vec4 Math::normalize3approx ( const vec4 & v)

◆ normalizeapprox() [1/3]

__forceinline vec3 Math::normalizeapprox ( const vec3 & v)

◆ normalizeapprox() [2/3]

__forceinline vec4 Math::normalizeapprox ( const vec4 & v)

◆ normalizeapprox() [3/3]

__forceinline vector Math::normalizeapprox ( const vector & v)

◆ operator*() [1/19]

__forceinline plane Math::operator* ( const mat4 & m,
const plane & p )

◆ operator*() [2/19]

__forceinline vec4 Math::operator* ( const mat4 & m,
const point & p )

◆ operator*() [3/19]

__forceinline vec4 Math::operator* ( const mat4 & m,
const vec3 & v )

◆ operator*() [4/19]

__forceinline vec4 Math::operator* ( const mat4 & m,
const vec4 & v )

◆ operator*() [5/19]

__forceinline vector Math::operator* ( const mat4 & m,
const vector & v )

◆ operator*() [6/19]

__forceinline mat4 Math::operator* ( const mat4 & m0,
const mat4 & m1 )

◆ operator*() [7/19]

__forceinline quat Math::operator* ( const quat & q0,
const quat & q1 )

◆ operator*() [8/19]

point Math::operator* ( const transform & a,
const point & b )
inline

transforms a position (applies scale, rotation and offset)

◆ operator*() [9/19]

transform Math::operator* ( const transform & a,
const transform & b )
inline

◆ operator*() [10/19]

vector Math::operator* ( const transform & a,
const vector & b )
inline

transforms a vector (ignores position)

◆ operator*() [11/19]

__forceinline vec3 Math::operator* ( const vec3 & lhs,
const vec3 & rhs )

◆ operator*() [12/19]

__forceinline vec3 Math::operator* ( const vec3 & lhs,
scalar t )

◆ operator*() [13/19]

__forceinline vec4 Math::operator* ( const vec4 & lhs,
const vec4 & rhs )

◆ operator*() [14/19]

__forceinline vec4 Math::operator* ( const vec4 & lhs,
scalar t )

◆ operator*() [15/19]

__forceinline vector Math::operator* ( const vector & lhs,
const vector & rhs )

◆ operator*() [16/19]

__forceinline vector Math::operator* ( const vector & lhs,
scalar s )

◆ operator*() [17/19]

float Math::operator* ( float one,
half two )
inline

◆ operator*() [18/19]

half Math::operator* ( half one,
float two )
inline

◆ operator*() [19/19]

half Math::operator* ( half one,
half two )
inline

◆ operator+() [1/7]

__forceinline point Math::operator+ ( const point & lhs,
const vector & rhs )

◆ operator+() [2/7]

__forceinline vec3 Math::operator+ ( const vec3 & lhs,
const vec3 & rhs )

◆ operator+() [3/7]

__forceinline vec4 Math::operator+ ( const vec4 & lhs,
const vec4 & rhs )

◆ operator+() [4/7]

__forceinline vector Math::operator+ ( const vector & lhs,
const vector & rhs )

◆ operator+() [5/7]

float Math::operator+ ( float one,
half two )
inline

◆ operator+() [6/7]

half Math::operator+ ( half one,
float two )
inline

◆ operator+() [7/7]

half Math::operator+ ( half one,
half two )
inline

◆ operator-() [1/11]

__forceinline vector Math::operator- ( const point & lhs,
const point & rhs )

◆ operator-() [2/11]

__forceinline point Math::operator- ( const point & lhs,
const vector & rhs )

◆ operator-() [3/11]

__forceinline vec3 Math::operator- ( const vec3 & lhs)

◆ operator-() [4/11]

__forceinline vec3 Math::operator- ( const vec3 & lhs,
const vec3 & rhs )

◆ operator-() [5/11]

__forceinline vec4 Math::operator- ( const vec4 & lhs)

◆ operator-() [6/11]

__forceinline vec4 Math::operator- ( const vec4 & lhs,
const vec4 & rhs )

◆ operator-() [7/11]

__forceinline vector Math::operator- ( const vector & lhs,
const vector & rhs )

◆ operator-() [8/11]

__forceinline vector Math::operator- ( const vector & rhs)

◆ operator-() [9/11]

float Math::operator- ( float one,
half two )
inline

◆ operator-() [10/11]

half Math::operator- ( half one,
float two )
inline

◆ operator-() [11/11]

half Math::operator- ( half one,
half two )
inline

◆ operator/() [1/3]

float Math::operator/ ( float one,
half two )
inline

◆ operator/() [2/3]

half Math::operator/ ( half one,
float two )
inline

◆ operator/() [3/3]

half Math::operator/ ( half one,
half two )
inline

◆ ortholh()

__forceinline mat4 Math::ortholh ( scalar w,
scalar h,
scalar zn,
scalar zf )

◆ orthooffcenterlh()

__forceinline mat4 Math::orthooffcenterlh ( scalar l,
scalar r,
scalar t,
scalar b,
scalar zn,
scalar zf )

◆ orthooffcenterrh()

__forceinline mat4 Math::orthooffcenterrh ( scalar l,
scalar r,
scalar t,
scalar b,
scalar zn,
scalar zf )

◆ orthorh()

__forceinline mat4 Math::orthorh ( scalar w,
scalar h,
scalar zn,
scalar zf )

◆ permute() [1/2]

__forceinline vec3 Math::permute ( const vec3 & v0,
const vec3 & v1,
unsigned int i0,
unsigned int i1,
unsigned int i2 )

◆ permute() [2/2]

__forceinline vec4 Math::permute ( const vec4 & v0,
const vec4 & v1,
unsigned int i0,
unsigned int i1,
unsigned int i2,
unsigned int i3 )

◆ perspective_div()

__forceinline vec4 Math::perspective_div ( const vec4 & v)

◆ perspfovlh()

__forceinline mat4 Math::perspfovlh ( scalar fovy,
scalar aspect,
scalar zn,
scalar zf )

◆ perspfovrh()

__forceinline mat4 Math::perspfovrh ( scalar fovy,
scalar aspect,
scalar zn,
scalar zf )

◆ persplh()

__forceinline mat4 Math::persplh ( scalar w,
scalar h,
scalar zn,
scalar zf )

◆ perspoffcenterlh()

__forceinline mat4 Math::perspoffcenterlh ( scalar l,
scalar r,
scalar b,
scalar t,
scalar zn,
scalar zf )

◆ perspoffcenterrh()

__forceinline mat4 Math::perspoffcenterrh ( scalar l,
scalar r,
scalar b,
scalar t,
scalar zn,
scalar zf )

◆ persprh()

__forceinline mat4 Math::persprh ( scalar w,
scalar h,
scalar zn,
scalar zf )

◆ pointerhash()

__forceinline uint32_t Math::pointerhash ( void * ptr)

cheap pointer hash using modulo with a mersenne prime

◆ pow()

__forceinline scalar Math::pow ( scalar x,
scalar y )

◆ quatExp()

__forceinline quat Math::quatExp ( const quat & q)

◆ quatUndenormalize()

__forceinline quat Math::quatUndenormalize ( const quat & q)

◆ quatyawpitchroll()

quat Math::quatyawpitchroll ( scalar y,
scalar x,
scalar z )

◆ rad2deg()

__forceinline constexpr scalar Math::rad2deg ( scalar r)
constexpr

◆ rand() [1/2]

__forceinline scalar Math::rand ( )

Return a pseudo random number between 0 and 1.

◆ rand() [2/2]

__forceinline scalar Math::rand ( scalar min,
scalar max )

Return a pseudo random number between min and max.

◆ randxor()

__forceinline uint64 Math::randxor ( randxorstate & state)

◆ recip()

__forceinline __m128 Math::recip ( __m128 a)

◆ reciprocal() [1/2]

__forceinline vec3 Math::reciprocal ( const vec3 & v)

◆ reciprocal() [2/2]

__forceinline vec4 Math::reciprocal ( const vec4 & v)

◆ reciprocalapprox() [1/2]

__forceinline vec3 Math::reciprocalapprox ( const vec3 & v)

◆ reciprocalapprox() [2/2]

__forceinline vec4 Math::reciprocalapprox ( const vec4 & v)

◆ reflect() [1/3]

__forceinline vec3 Math::reflect ( const vec3 & normal,
const vec3 & incident )

◆ reflect() [2/3]

__forceinline vec4 Math::reflect ( const vec4 & normal,
const vec4 & incident )

◆ reflect() [3/3]

◆ rotate()

__forceinline vec3 Math::rotate ( quat const & q,
vec3 const & v )

◆ rotationaxis()

__forceinline mat4 Math::rotationaxis ( const vec3 & axis,
scalar angle )

◆ rotationmatrix()

quat Math::rotationmatrix ( const mat4 & m)

◆ rotationquat()

mat4 Math::rotationquat ( const quat & q)

TODO: rewrite using SSE.

◆ rotationquataxis()

__forceinline quat Math::rotationquataxis ( const vec3 & axis,
scalar angle )

quat from rotation axis + angle.

Axis has to be normalized

◆ rotationx()

__forceinline mat4 Math::rotationx ( scalar angle)

◆ rotationy()

__forceinline mat4 Math::rotationy ( scalar angle)

◆ rotationyawpitchroll()

__forceinline mat4 Math::rotationyawpitchroll ( scalar yaw,
scalar pitch,
scalar roll )

◆ rotationz()

__forceinline mat4 Math::rotationz ( scalar angle)

◆ round()

__forceinline float Math::round ( float val)

Floating point rounding.

◆ roundtopow2()

__forceinline unsigned int Math::roundtopow2 ( unsigned int val)

Rounds up to next power of 2.

◆ saturate() [1/2]

__forceinline double Math::saturate ( double val)

Saturate a value (clamps between 0.0f and 1.0f)

◆ saturate() [2/2]

__forceinline scalar Math::saturate ( scalar val)

Saturate a value (clamps between 0.0f and 1.0f)

◆ scaling() [1/3]

__forceinline mat4 Math::scaling ( const vec3 & s)

◆ scaling() [2/3]

__forceinline mat4 Math::scaling ( scalar scale)

◆ scaling() [3/3]

__forceinline mat4 Math::scaling ( scalar sx,
scalar sy,
scalar sz )

◆ select() [1/4]

__forceinline vec3 Math::select ( const vec3 & v0,
const vec3 & v1,
const uint i0,
const uint i1,
const uint i2 )

◆ select() [2/4]

__forceinline vec3 Math::select ( const vec3 & v0,
const vec3 & v1,
const vec3 & control )

◆ select() [3/4]

__forceinline vec4 Math::select ( const vec4 & v0,
const vec4 & v1,
const uint i0,
const uint i1,
const uint i2,
const uint i3 )

◆ select() [4/4]

__forceinline vec4 Math::select ( const vec4 & v0,
const vec4 & v1,
const vec4 & control )

◆ sgn()

__forceinline scalar Math::sgn ( scalar a)

◆ sin()

__forceinline scalar Math::sin ( scalar x)

◆ skewsymmetric()

__forceinline mat4 Math::skewsymmetric ( const vec3 & v)

◆ slerp()

__forceinline quat Math::slerp ( const quat & q1,
const quat & q2,
scalar t )

quat slerp TODO: rewrite using sse/avx

◆ smoothstep()

__forceinline scalar Math::smoothstep ( scalar edge0,
scalar edge1,
scalar x )

◆ splat() [1/2]

__forceinline vec3 Math::splat ( const vec3 & v,
uint element )

◆ splat() [2/2]

__forceinline vec4 Math::splat ( const vec4 & v,
uint element )

◆ splat_w()

__forceinline vec4 Math::splat_w ( const vec4 & v)

◆ splat_x() [1/2]

__forceinline vec3 Math::splat_x ( const vec3 & v)

◆ splat_x() [2/2]

__forceinline vec4 Math::splat_x ( const vec4 & v)

◆ splat_y() [1/2]

__forceinline vec3 Math::splat_y ( const vec3 & v)

◆ splat_y() [2/2]

__forceinline vec4 Math::splat_y ( const vec4 & v)

◆ splat_z() [1/2]

__forceinline vec3 Math::splat_z ( const vec3 & v)

◆ splat_z() [2/2]

__forceinline vec4 Math::splat_z ( const vec4 & v)

◆ sqrt()

__forceinline scalar Math::sqrt ( scalar x)

◆ squad()

__forceinline quat Math::squad ( const quat & q1,
const quat & a,
const quat & b,
const quat & c,
scalar t )

◆ squadsetup()

__forceinline void Math::squadsetup ( const quat & q0,
const quat & q1,
const quat & q2,
const quat & q3,
quat & aOut,
quat & bOut,
quat & cOut )

◆ swizzle()

template<int x, int y, int z, int w>
__forceinline __m128 Math::swizzle ( __m128 v)

◆ tan()

__forceinline scalar Math::tan ( scalar x)

◆ to_axisangle()

__forceinline void Math::to_axisangle ( const quat & q,
vec4 & outAxis,
scalar & outAngle )

◆ to_euler()

vec3 Math::to_euler ( const quat & q)

◆ transformation()

mat4 Math::transformation ( const vec3 & scalingCenter,
const quat & scalingRotation,
const vec3 & scale,
const vec3 & rotationCenter,
const quat & rotation,
const vec3 & trans )

◆ translation() [1/2]

__forceinline mat4 Math::translation ( const vec3 & t)

◆ translation() [2/2]

__forceinline mat4 Math::translation ( scalar x,
scalar y,
scalar z )

◆ transpose()

__forceinline mat4 Math::transpose ( const mat4 & m)

◆ trs()

__forceinline mat4 Math::trs ( const vec3 & position,
const quat & rotation,
const vec3 & scale )

A short hand for creating a TRS (translation, rotation, scale) matrix from pos, rot and scale.

◆ undenormalize()

__forceinline float Math::undenormalize ( scalar s)

Returns 0 if scalar is denormal.

◆ xyz() [1/2]

__forceinline vec3 Math::xyz ( const point & v)

◆ xyz() [2/2]

__forceinline vec3 Math::xyz ( const vec4 & v)

Variable Documentation

◆ _id_w

const __m128 Math::_id_w = _mm_setr_ps(0.0f, 0.0f, 0.0f, 1.0f)
static

◆ _id_x

const __m128 Math::_id_x = _mm_setr_ps(1.0f, 0.0f, 0.0f, 0.0f)
static

◆ _id_y

const __m128 Math::_id_y = _mm_setr_ps(0.0f, 1.0f, 0.0f, 0.0f)
static

◆ _id_z

const __m128 Math::_id_z = _mm_setr_ps(0.0f, 0.0f, 1.0f, 0.0f)
static

◆ _mask_xyz

const __m128 Math::_mask_xyz = _mm_castsi128_ps(_mm_setr_epi32( 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0 ))
static

◆ _minus1

const __m128 Math::_minus1 = _mm_setr_ps(-1.0f, -1.0f, -1.0f, -1.0f)
static

◆ _plus1

const __m128 Math::_plus1 = _mm_setr_ps(1.0f, 1.0f, 1.0f, 1.0f)
static

◆ _sign

const __m128i Math::_sign = _mm_setr_epi32(0x80000000, 0x80000000, 0x80000000, 0x80000000)
static

◆ _zero

const __m128 Math::_zero = _mm_setr_ps(0.0f, 0.0f, 0.0f, 0.0f)
static

◆ maskW

const __m128i Math::maskW = _mm_setr_epi32( 0,0,0,-1 )
static

◆ maskX

const __m128i Math::maskX = _mm_setr_epi32( -1,0,0,0 )
static

◆ maskY

const __m128i Math::maskY = _mm_setr_epi32( 0,-1,0,0 )
static

◆ maskZ

const __m128i Math::maskZ = _mm_setr_epi32( 0,0,-1,0 )
static

◆ PERMUTE_0W

const unsigned int Math::PERMUTE_0W = 3
static

◆ PERMUTE_0X

const unsigned int Math::PERMUTE_0X = 0
static

◆ PERMUTE_0Y

const unsigned int Math::PERMUTE_0Y = 1
static

◆ PERMUTE_0Z

const unsigned int Math::PERMUTE_0Z = 2
static

◆ PERMUTE_1W

const unsigned int Math::PERMUTE_1W = 7
static

◆ PERMUTE_1X

const unsigned int Math::PERMUTE_1X = 4
static

◆ PERMUTE_1Y

const unsigned int Math::PERMUTE_1Y = 5
static

◆ PERMUTE_1Z

const unsigned int Math::PERMUTE_1Z = 6
static