Nugget
Loading...
Searching...
No Matches
Enumerations | Functions
psyqo::SoftMath Namespace Reference

Enumerations

enum class  Axis { X , Y , Z }
 

Functions

void generateRotationMatrix33 (Matrix33 *m, Angle t, Axis a, const Trig<> &trig)
 Generate a rotation matrix for a given angle and axis.
 
Matrix33 generateRotationMatrix33 (Angle t, Axis a, const Trig<> &trig)
 Generate a rotation matrix for a given angle and axis.
 
void multiplyMatrix33 (const Matrix33 &m1, const Matrix33 &m2, Matrix33 *out)
 Multiply two 3x3 matrices.
 
Matrix33 multiplyMatrix33 (const Matrix33 &m1, const Matrix33 &m2)
 Multiply two 3x3 matrices.
 
void scaleMatrix33 (Matrix33 *m, FixedPoint<> s)
 Scale a 3x3 matrix by a scalar.
 
void matrixVecMul3 (const Matrix33 &m, const Vec3 &v, Vec3 *out)
 Multiply a 3x3 matrix by a 3D vector.
 
void matrixVecMul3xy (const Matrix33 &m, const Vec3 &v, Vec2 *out)
 Multiply a 3x3 matrix by a 3D vector, returning only the x and y components.
 
FixedPoint matrixVecMul3z (const Matrix33 &m, const Vec3 &v)
 Multiply a 3x3 matrix by a 3D vector, returning only the z component.
 
void crossProductVec3 (const Vec3 &v1, const Vec3 &v2, Vec3 *out)
 Compute the cross product of two 3D vectors.
 
Vec3 crossProductVec3 (const Vec3 &v1, const Vec3 &v2)
 Compute the cross product of two 3D vectors.
 
FixedPoint matrixDeterminant3 (const Matrix33 &m)
 Compute the determinant of a 3x3 matrix.
 
FixedPoint squareRoot (FixedPoint<> x, FixedPoint<> y)
 Computes the square root of a fixed point number, given an approximative hint.
 
FixedPoint inverseSquareRoot (FixedPoint<> x, FixedPoint<> y)
 Computes the inverse square root of a fixed point number, given an approximative hint.
 
FixedPoint normOfVec3 (const Vec3 &v)
 Computes the norm of a 3D vector.
 
void normalizeVec3 (Vec3 *v)
 Normalizes a 3D vector.
 
void fastNormalizeVec3 (Vec3 *v)
 Normalizes a 3D vector, using a faster but less accurate algorithm.
 
void project (const Vec3 *v, FixedPoint<> h, Vec2 *out)
 Projects a 3D point onto a 2D plane.
 

Enumeration Type Documentation

◆ Axis

enum class psyqo::SoftMath::Axis
strong
Enumerator

Function Documentation

◆ crossProductVec3() [1/2]

psyqo::Vec3 psyqo::SoftMath::crossProductVec3 ( const Vec3 v1,
const Vec3 v2 
)

Compute the cross product of two 3D vectors.

Parameters
v1The first vector.
v2The second vector.
Returns
Vec3 The cross product.

◆ crossProductVec3() [2/2]

void psyqo::SoftMath::crossProductVec3 ( const Vec3 v1,
const Vec3 v2,
Vec3 out 
)

Compute the cross product of two 3D vectors.

Parameters
v1The first vector.
v2The second vector.
outThe vector to store the result in. May be the same as v1 or v2.

◆ fastNormalizeVec3()

void psyqo::SoftMath::fastNormalizeVec3 ( Vec3 v)

Normalizes a 3D vector, using a faster but less accurate algorithm.

Parameters
vThe vector to normalize.

◆ generateRotationMatrix33() [1/2]

psyqo::Matrix33 psyqo::SoftMath::generateRotationMatrix33 ( Angle  t,
Axis  a,
const Trig<> &  trig 
)

Generate a rotation matrix for a given angle and axis.

Parameters
tThe angle to rotate by.
aThe axis to rotate around.
trigA trigonometry object to use for sine and cosine calculations.
Returns
Matrix33 The rotation matrix.

◆ generateRotationMatrix33() [2/2]

void psyqo::SoftMath::generateRotationMatrix33 ( Matrix33 m,
Angle  t,
Axis  a,
const Trig<> &  trig 
)

Generate a rotation matrix for a given angle and axis.

Parameters
mThe matrix to store the result in.
tThe angle to rotate by.
aThe axis to rotate around.
trigA trigonometry object to use for sine and cosine calculations.

◆ inverseSquareRoot()

FixedPoint psyqo::SoftMath::inverseSquareRoot ( FixedPoint<>  x,
FixedPoint<>  y 
)

Computes the inverse square root of a fixed point number, given an approximative hint.

Parameters
xThe number to compute the inverse square root of.
yThe approximative hint of the result.
Returns
psyqo::FixedPoint<> The inverse square root.

◆ matrixDeterminant3()

psyqo::FixedPoint psyqo::SoftMath::matrixDeterminant3 ( const Matrix33 m)

Compute the determinant of a 3x3 matrix.

Parameters
mThe matrix.
Returns
FixedPoint<> The determinant.

◆ matrixVecMul3()

void psyqo::SoftMath::matrixVecMul3 ( const Matrix33 m,
const Vec3 v,
Vec3 out 
)

Multiply a 3x3 matrix by a 3D vector.

Parameters
mThe matrix.
vThe vector.
outThe vector to store the result in. May be the same as v.

◆ matrixVecMul3xy()

void psyqo::SoftMath::matrixVecMul3xy ( const Matrix33 m,
const Vec3 v,
Vec2 out 
)

Multiply a 3x3 matrix by a 3D vector, returning only the x and y components.

Parameters
mThe matrix.
vThe vector.
outThe vector to store the result in.

◆ matrixVecMul3z()

psyqo::FixedPoint psyqo::SoftMath::matrixVecMul3z ( const Matrix33 m,
const Vec3 v 
)

Multiply a 3x3 matrix by a 3D vector, returning only the z component.

Parameters
mThe matrix.
vThe vector.
Returns
FixedPoint<> The z component of the result.

◆ multiplyMatrix33() [1/2]

psyqo::Matrix33 psyqo::SoftMath::multiplyMatrix33 ( const Matrix33 m1,
const Matrix33 m2 
)

Multiply two 3x3 matrices.

Parameters
m1The first matrix.
m2The second matrix.
Returns
Matrix33 The result of the multiplication.

◆ multiplyMatrix33() [2/2]

void psyqo::SoftMath::multiplyMatrix33 ( const Matrix33 m1,
const Matrix33 m2,
Matrix33 out 
)

Multiply two 3x3 matrices.

Parameters
m1The first matrix.
m2The second matrix.
outThe matrix to store the result in. May be the same as m1 or m2.

◆ normalizeVec3()

void psyqo::SoftMath::normalizeVec3 ( Vec3 v)

Normalizes a 3D vector.

Parameters
vThe vector to normalize.

◆ normOfVec3()

psyqo::FixedPoint psyqo::SoftMath::normOfVec3 ( const Vec3 v)

Computes the norm of a 3D vector.

Parameters
vThe vector.
Returns
psyqo::FixedPoint<> The norm.

◆ project()

void psyqo::SoftMath::project ( const Vec3 v,
FixedPoint<>  h,
Vec2 out 
)

Projects a 3D point onto a 2D plane.

Parameters
vThe vector to project.
hThe height of the plane.
outThe vector to store the result in.

◆ scaleMatrix33()

void psyqo::SoftMath::scaleMatrix33 ( Matrix33 m,
FixedPoint<>  s 
)

Scale a 3x3 matrix by a scalar.

Parameters
mThe matrix to scale.
sThe scalar to scale by.

◆ squareRoot()

FixedPoint psyqo::SoftMath::squareRoot ( FixedPoint<>  x,
FixedPoint<>  y 
)

Computes the square root of a fixed point number, given an approximative hint.

Parameters
xThe number to compute the square root of.
yThe approximative hint of the result.
Returns
psyqo::FixedPoint<> The square root.