Contains objects and functions for dealing with Vector and Matrix math. More...
Classes | |
| class | TypedAngle |
| class | BezierCurve |
| class | TypedVector3 |
| class | TypedVector4 |
| class | TypedMatrix3 |
| class | TypedMatrix4 |
| class | TypedQuaternion |
| class | TypedVector2 |
Typedefs | |
| typedef TypedAngle< float > | Angle |
| typedef TypedMatrix3< float > | Matrix3 |
| typedef TypedMatrix4< float > | Matrix4 |
| typedef TypedQuaternion< float > | Quaternion |
| typedef TypedVector2< float > | Vector2 |
| typedef TypedVector3< float > | Vector3 |
| typedef TypedVector4< float > | Vector4 |
Enumerations | |
| enum class | AngleUnit { Degrees , Radians } |
| enum | ColumnMajorMatrix { ColumnMajor = 1 } |
| enum | SkipInitialization { kSkipInitialization = 0 } |
| enum | VectorComponent { kComponentX = 0 , kComponentY , kComponentZ , kComponentW } |
Functions | |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedAngle< Type > &angle) |
| template<typename Type > | |
| constexpr Type | Pi (void) |
| template<typename Type > | |
| constexpr Type | TwoPi (void) |
| static const float | kTolerance (0.00001f) |
| const float | kPoundsToKilograms (0.45359237f) |
| A constant for the conversion of 1 pound (lb) to 1 kilogram (kg). | |
| const float | kKilogramsToPounds (1.0f/kPoundsToKilograms) |
| A constant for the conversion of 1 kilogram (kg) to 1 pound (lb). | |
| const float | kInchesToMeters (0.0254f) |
| A constant for the distance conversion of 1 inch to 1 meter. | |
| const float | kMetersToInches (1.0f/kInchesToMeters) |
| A constant for the distance conversion of 1 meter to 1 inch. | |
| const float | kFeetToMeters (0.3048f) |
| A constant for the distance conversion from 1 foot to 1 meter. | |
| const float | kMetersToFeet (1.0f/kFeetToMeters) |
| A constant for the distance conversion from 1 meter to 1 foot. | |
| const float | kMilesToKilometers (1.609344f) |
| A constant for the distance conversion from 1 mile to 1 kilometer. | |
| const float | kKilometersToMiles (1.0f/kMilesToKilometers) |
| A constant for the distance conversion from 1 kilometer to 1 mile. | |
| const float | kFootPoundsToNewtonMeters (0.73756214837f) |
| A constant for the torque in ft-lbs to Nm. | |
| const float | kNewtonMetersToFootPounds (1.0f/kFootPoundsToNewtonMeters) |
| A constant for the torque conversion from Nm to ft-lbs. | |
| template<typename Type > | |
| constexpr const Type & | Maximum (const Type &leftValue, const Type &rightValue) noexcept |
| template<typename Type > | |
| constexpr const Type & | Minimum (const Type &leftValue, const Type &rightValue) noexcept |
| template<typename Type > | |
| bool | IsEqual (const Type &leftValue, const Type &rightValue, const Type tolerance=tbMath::kTolerance) |
| template<typename Type > | |
| bool | IsZero (const Type &value, const Type tolerance=tbMath::kTolerance) |
| template<typename Type > | |
| constexpr const Type & | Clamp (const Type &value, const Type &minimumValue, const Type &maximumValue) noexcept |
| template<typename Type > | |
| Type | Sign (const Type &value) noexcept |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3MatrixMultiply (TypedVector3< Type > *result, const TypedVector3< Type > *inputVector, const TypedMatrix3< Type > *inputMatrix) |
| template<typename Type > | |
| TypedVector3< Type > * | MatrixVector3Multiply (TypedVector3< Type > *result, const TypedMatrix3< Type > *inputMatrix, const TypedVector3< Type > *inputVector) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixMultiply (TypedMatrix3< Type > *result, const TypedMatrix3< Type > *input, const Type &scalar) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixMultiply (TypedMatrix4< Type > *result, const TypedMatrix4< Type > *input, const Type &scalar) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixMultiply (TypedMatrix3< Type > *result, const TypedMatrix3< Type > *leftSide, const TypedMatrix3< Type > *rightSide) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixMultiply (TypedMatrix4< Type > *result, const TypedMatrix4< Type > *leftSide, const TypedMatrix4< Type > *rightSide) |
| template<typename Type > | |
| TypedVector4< Type > * | MatrixVector4Multiply (TypedVector4< Type > *result, const TypedMatrix4< Type > *inputMatrix, const TypedVector4< Type > *inputVector) |
| template<typename Type > | |
| TypedVector4< Type > * | Vector4MatrixMultiply (TypedVector4< Type > *result, const TypedVector4< Type > *inputVector, const TypedMatrix4< Type > *inputMatrix) |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3TransformCoordinate (TypedVector3< Type > *result, const TypedVector3< Type > *inputVector, const TypedMatrix4< Type > *inputMatrix) |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3TransformNormal (TypedVector3< Type > *result, const TypedVector3< Type > *inputVector, const TypedMatrix4< Type > *inputMatrix) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixComputeInverse (TypedMatrix3< Type > *result, const TypedMatrix3< Type > *input) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixComputeInverse (TypedMatrix4< Type > *result, const TypedMatrix4< Type > *input) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixFastInverse (TypedMatrix3< Type > *result, const TypedMatrix3< Type > *input) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixFastInverse (TypedMatrix4< Type > *result, const TypedMatrix4< Type > *input) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateTranslation (TypedMatrix4< Type > *result, const TypedVector3< Type > *translation) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateTranslation (TypedMatrix4< Type > *result, const Type translationX, const Type translationY, const Type translationZ) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateScale (TypedMatrix3< Type > *result, const TypedVector3< Type > *scale) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateScale (TypedMatrix4< Type > *result, const TypedVector3< Type > *scale) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateScale (TypedMatrix3< Type > *result, const Type scaleX, const Type scaleY, const Type scaleZ) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateScale (TypedMatrix4< Type > *result, const Type scaleX, const Type scaleY, const Type scaleZ) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateRotationX (TypedMatrix3< Type > *result, const TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateRotationX (TypedMatrix4< Type > *result, const tbMath::TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateRotationY (TypedMatrix3< Type > *result, const TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateRotationY (TypedMatrix4< Type > *result, const tbMath::TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateRotationZ (TypedMatrix3< Type > *result, const TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateRotationZ (TypedMatrix4< Type > *result, const tbMath::TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateRotationA (TypedMatrix3< Type > *result, const TypedVector3< Type > *rotationAxis, const TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateRotationA (TypedMatrix4< Type > *result, const TypedVector3< Type > *rotationAxis, const tbMath::TypedAngle< Type > rotation) |
| template<typename Type > | |
| TypedMatrix3< Type > * | MatrixCreateIdentity (TypedMatrix3< Type > *result) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateIdentity (TypedMatrix4< Type > *result) |
| template<typename Type > | |
| TypedMatrix4< Type > * | MatrixCreateLookAt (TypedMatrix4< Type > *result, const TypedVector3< Type > &eyePosition, const TypedVector3< Type > &targetPosition, const TypedVector3< Type > &unitUp) |
| Matrix4 * | MatrixCreatePerspectiveRH (Matrix4 *result, const float fieldOfView, const float aspectRatio, const float nearPlane, const float farPlane) |
| Matrix4 * | MatrixCreatePerspectiveLH (Matrix4 *result, const float fieldOfView, const float aspectRatio, const float nearPlane, const float farPlane) |
| Matrix4 * | MatrixCreateOrthoRH (Matrix4 *result, const float left, const float right, const float top, const float bottom, const float nearPlane, const float farPlane) |
| Matrix4 * | MatrixCreateOrthoLH (Matrix4 *result, const float left, const float right, const float top, const float bottom, const float nearPlane, const float farPlane) |
| Matrix3 * | MatrixAdd (Matrix3 *result, const Matrix3 *leftSide, const Matrix3 *rightSide) |
| Matrix4 * | MatrixAdd (Matrix4 *result, const Matrix4 *leftSide, const Matrix4 *rightSide) |
| Matrix3 * | MatrixSubtract (Matrix3 *result, const Matrix3 *leftSide, const Matrix3 *rightSide) |
| Matrix4 * | MatrixSubtract (Matrix4 *result, const Matrix4 *leftSide, const Matrix4 *rightSide) |
| Matrix3 * | MatrixTranspose (Matrix3 *result, const Matrix3 *input) |
| Matrix4 * | MatrixTranspose (Matrix4 *result, const Matrix4 *input) |
| template<typename Type > | |
| Type | Matrix2x2Determinant (const Type f11, const Type f12, const Type f21, const Type f22) |
| template<typename Type > | |
| Type | Matrix3x3Determinant (const Type f11, const Type f12, const Type f13, const Type f21, const Type f22, const Type f23, const Type f31, const Type f32, const Type f33) |
| template<typename Type > | |
| Type | MatrixDeterminant (const TypedMatrix3< Type > *input) |
| template<typename Type > | |
| Type | MatrixDeterminant (const TypedMatrix4< Type > *input) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedMatrix3< Type > &data) |
| template<typename Type > | |
| std::istream & | operator>> (std::istream &input, tbMath::TypedMatrix3< Type > &data) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedMatrix4< Type > &data) |
| template<typename Type > | |
| std::istream & | operator>> (std::istream &input, tbMath::TypedMatrix4< Type > &data) |
| template<typename Type > | |
| TypedVector3< Type > | MultiplyVector3Quaternion (const TypedVector3< Type > &left, const TypedQuaternion< Type > &right) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionMultiply (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *left, const TypedQuaternion< Type > *right) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionAdd (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *left, const TypedQuaternion< Type > *right) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionSubtract (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *left, const TypedQuaternion< Type > *right) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionScale (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input, const Type scalar) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionScaleDivide (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input, const Type scalar) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionNegate (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input) |
| template<typename Type > | |
| Type | QuaternionMagnitude (const TypedQuaternion< Type > *input) |
| template<typename Type > | |
| Type | QuaternionMagnitudeSquared (const TypedQuaternion< Type > *input) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionNormalize (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionNormalizeMagnitude (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input, Type &magnitude) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionInverse (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *input) |
| template<typename Type > | |
| Type | QuaternionDotProduct (const TypedQuaternion< Type > *leftSide, const TypedQuaternion< Type > *rightSide) |
| template<typename Type > | |
| TypedQuaternion< Type > * | QuaternionLerp (TypedQuaternion< Type > *result, const TypedQuaternion< Type > *start, const TypedQuaternion< Type > *final, const Type time) |
| template<typename Type > | |
| TypedQuaternion< Type > | QuaternionSlerp (const TypedQuaternion< Type > &start, const TypedQuaternion< Type > &final, const Type time) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedQuaternion< Type > &data) |
| unsigned int | SeedRandomGenerator (void) |
| unsigned int | SeedRandomGenerator (const String &seed) |
| void | SeedRandomGenerator (unsigned int seed) |
| int | RandomInt (void) |
| int | RandomInt (const int minimumValue, const int maximumValue) |
| float | RandomFloat (void) |
| float | RandomFloat (const float minimumValue, const float maximumValue) |
| template<typename Type > | |
| Type | Vector2DotProduct (const TypedVector2< Type > *leftSide, const TypedVector2< Type > *rightSide) |
| template<typename Type > | |
| Type | Vector3DotProduct (const TypedVector3< Type > *leftSide, const TypedVector3< Type > *rightSide) |
| template<typename Type > | |
| Type | Vector4DotProduct (const TypedVector4< Type > *leftSide, const TypedVector4< Type > *rightSide) |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3CrossProduct (TypedVector3< Type > *result, const TypedVector3< Type > *leftSide, const TypedVector3< Type > *rightSide) |
| template<typename Type > | |
| TypedVector2< Type > * | Vector2Normalize (TypedVector2< Type > *result, const TypedVector2< Type > *value) |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3Normalize (TypedVector3< Type > *result, const TypedVector3< Type > *input) |
| template<typename Type > | |
| TypedVector4< Type > * | Vector4Normalize (TypedVector4< Type > *result, const TypedVector4< Type > *input) |
| template<typename Type > | |
| TypedVector2< Type > * | Vector2NormalizeMagnitude (TypedVector2< Type > *result, const TypedVector2< Type > *value, Type &magnitude) |
| template<typename Type > | |
| TypedVector3< Type > * | Vector3NormalizeMagnitude (TypedVector3< Type > *result, const TypedVector3< Type > *input, Type &magnitude) |
| template<typename Type > | |
| TypedVector4< Type > * | Vector4NormalizeMagnitude (TypedVector4< Type > *result, const TypedVector4< Type > *input, Type &magnitude) |
| Vector2 * | Vector2Add (Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide) |
| Vector3 * | Vector3Add (Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide) |
| Vector4 * | Vector4Add (Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide) |
| Vector2 * | Vector2Subtract (Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide) |
| Vector3 * | Vector3Subtract (Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide) |
| Vector4 * | Vector4Subtract (Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide) |
| Vector2 * | Vector2Scale (Vector2 *result, const Vector2 *input, const float scalar) |
| Vector3 * | Vector3Scale (Vector3 *result, const Vector3 *input, const float scalar) |
| Vector4 * | Vector4Scale (Vector4 *result, const Vector4 *input, const float scalar) |
| Vector2 * | Vector2ScaleDivide (Vector2 *result, const Vector2 *input, const float scalar) |
| Vector3 * | Vector3ScaleDivide (Vector3 *result, const Vector3 *input, const float scalar) |
| Vector4 * | Vector4ScaleDivide (Vector4 *result, const Vector4 *input, const float scalar) |
| Vector2 * | Vector2Negate (Vector2 *result, const Vector2 *input) |
| Vector3 * | Vector3Negate (Vector3 *result, const Vector3 *input) |
| Vector4 * | Vector4Negate (Vector4 *result, const Vector4 *input) |
| template<typename Type > | |
| Type | Vector2Magnitude (const TypedVector2< Type > *input) |
| template<typename Type > | |
| Type | Vector3Magnitude (const TypedVector3< Type > *input) |
| template<typename Type > | |
| Type | Vector4Magnitude (const TypedVector4< Type > *input) |
| template<typename Type > | |
| Type | Vector2MagnitudeSquared (const TypedVector2< Type > *input) |
| template<typename Type > | |
| Type | Vector3MagnitudeSquared (const TypedVector3< Type > *input) |
| template<typename Type > | |
| Type | Vector4MagnitudeSquared (const TypedVector4< Type > *input) |
| template<typename Type > | |
| TypedAngle< Type > | Vector3AngleBetween (const TypedVector3< Type > *left, const TypedVector3< Type > *right) |
| static Vector3 & | RotationXZToForwardVector3 (Vector3 &result, const Angle &orientation) |
| static Vector2 & | RotationToForwardVector2 (Vector2 &result, const Angle &orientation) |
| static Angle | ForwardVector3ToRotationXZ (const Vector3 &forward) |
| static Angle | ForwardVector2ToRotation (const Vector2 &forward) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedVector2< Type > &data) |
| template<typename Type > | |
| std::istream & | operator>> (std::istream &input, const tbMath::TypedVector2< Type > &data) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedVector3< Type > &data) |
| template<typename Type > | |
| std::istream & | operator>> (std::istream &input, const tbMath::TypedVector3< Type > &data) |
| template<typename Type > | |
| std::ostream & | operator<< (std::ostream &output, const tbMath::TypedVector4< Type > &data) |
| template<typename Type > | |
| std::istream & | operator>> (std::istream &input, const tbMath::TypedVector4< Type > &data) |
Variables | |
| static const float | kPi = Pi<float>() |
| A constant for the mathematical concept of Pi stored in a float. | |
| static const float | kTwoPi = TwoPi<float>() |
| A constant for Pi * 2 stored in a float. | |
Also known as tbMath, the objects and functions within the namespace TurtleBrains::Math are aimed to help reduce the burden with math by providing 2, 3 and 4 component Vector, 4x4 Matrix for transforms and a variety of helper functions for general purpose, converting values or interpolating.
| typedef TypedAngle<float> TurtleBrains::Math::Angle |
Specialization of the most common use of Angle, as a float.
|
strong |
The SkipInitialization type is used to provide a non-constructor to a few objects, essentially TypedVector2, TypedVector3, TypedVector4 objects. The non-constructor essentially leaves the members of the object uninitialized. This is unsafe but allows for slightly faster creation of the object with the premise that the values will be set immediately after.
Provides constant values for each component of the TypedVector2, TypedVector3 and TypedVector4 objects to get the component values by index using operator[].
| Enumerator | |
|---|---|
| kComponentX | The index of the x component of the TypedVector2, TypedVector3 and TypedVector4 objects. |
| kComponentY | The index of the y component of the TypedVector2, TypedVector3 and TypedVector4 objects. |
| kComponentZ | The index of the z component of the TypedVector3, TypedVector4 objects. |
| kComponentW | The index of the w component of the TypedVector4 object. |
|
constexprnoexcept |
Returns a value that falls within the given range of minimumValue to maximumValue using only the less-than operator for the type.
| value | The value that will be returned if it is within the range provided. |
| minimumValue | The lower end of the range to clamp the value at, will be returned if the value is less-than the range. |
| maximumValue | The upper end of the range to clamp the value at, will be returned if the value is greater-than the range. |
Converts a normalized 'forward' vector to an orientation value for 2D games. The orientation returned will be the radians in a clockwise (in normal 2D TurtleBrains with +X being to screen right, and +Y being to screen down) from the negative Y-Axis, meaning that something pointing up the screen (-Y) will return 0.
| forward | should be a normalized vector. |
Converts a normalized 'forward' vector to an orientation value for 2D games. The orientation returned will be an Angle object clockwise (TODO: TIM: Double check this directional comment) from the ZAxis, meaning the input vector should be something like forwardX, 0, forwardZ instead of the forwardX, forwardY.
| forward | should be a vector on the XZ plane. |
| bool TurtleBrains::Math::IsEqual | ( | const Type & | leftValue, |
| const Type & | rightValue, | ||
| const Type | tolerance = tbMath::kTolerance |
||
| ) |
Compares two floating point values returning true if the difference between the two values is less-than or equal to the tolerance allowed.
| leftValue | The value that would be on the left side of the comparison operator. |
| rightValue | The value that would be on the right side of the comparison operator. |
| tolerance | An optional value to change the tolerance of the comparison, smaller value means the floats need to be closer together, defaults to kTolerance. |
| bool TurtleBrains::Math::IsZero | ( | const Type & | value, |
| const Type | tolerance = tbMath::kTolerance |
||
| ) |
Compares a floating point values returning true if the difference between the value and zero is less-than or equal to the tolerance allowed.
| value | The value to check if it is within the tolerance range of zero. |
| tolerance | An optional value to change the tolerance of the comparison, smaller value means the floats need to be closer together, defaults to kTolerance. |
|
static |
When comparing a float for equality or to zero, this is the default tolerance used. When the difference is less than the tolerance, the values are considered the same.
| Type TurtleBrains::Math::Matrix3x3Determinant | ( | const Type | f11, |
| const Type | f12, | ||
| const Type | f13, | ||
| const Type | f21, | ||
| const Type | f22, | ||
| const Type | f23, | ||
| const Type | f31, | ||
| const Type | f32, | ||
| const Type | f33 | ||
| ) |
Computes the determinant of the 3x3 matrix components and returns the result. Essentially a supporting function for MatrixDeterminant and ComputeInverse below for the 4x4 matrix.
|
inline |
Adds two Matrix objects together into matrixResult and then the results matrix is returned.
| result | The matrix to fill out and return with the result of the two matrices added together. |
| leftSide | The matrix on the left side of the addition operator. |
| rightSide | The matrix on the right side of the addition operator. |
|
inline |
Adds two Matrix objects together into matrixResult and then the results matrix is returned.
| result | The matrix to fill out and return with the result of the two matrices added together. |
| leftSide | The matrix on the left side of the addition operator. |
| rightSide | The matrix on the right side of the addition operator. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixComputeInverse | ( | TypedMatrix3< Type > * | result, |
| const TypedMatrix3< Type > * | input | ||
| ) |
TODO: TurtleBrains: Math: This is not documented or implemented or tested... (Why does it exist at all?)
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixComputeInverse | ( | TypedMatrix4< Type > * | result, |
| const TypedMatrix4< Type > * | input | ||
| ) |
Computes the inverse matrix that when multiplied against the initial input would result in an identity matrix.
| result | The matrix to store and return the computed inverse matrix of input. This cannot be the same matrix as the input matrix or an error condition will be triggered. |
| input | The matrix to compute the inverse of, cannot be the same as the result matrix or an error condition will be triggered. |
| TypedMatrix3<Type>* TurtleBrains::Math::MatrixCreateIdentity | ( | TypedMatrix3< Type > * | result | ) |
---------------------------------------------------------------------------------------------------------------—/// ---------------------------------------------------------------------------------------------------------------—/// ---------------------------------------------------------------------------------------------------------------—///
Fills the matrix with the values from the identity matrix and returns the result.
| result | The matrix to fill out and return. |
| TypedMatrix4<Type>* TurtleBrains::Math::MatrixCreateIdentity | ( | TypedMatrix4< Type > * | result | ) |
| TypedMatrix4<Type>* TurtleBrains::Math::MatrixCreateLookAt | ( | TypedMatrix4< Type > * | result, |
| const TypedVector3< Type > & | eyePosition, | ||
| const TypedVector3< Type > & | targetPosition, | ||
| const TypedVector3< Type > & | unitUp | ||
| ) |
Creates a transform Matrix from a forward vector and up vector, similar to creating a LookAt.
| result | The matrix to fill out with the resulting LookAt matrix. |
| forward | The direction the transform matrix will be pointing at, must be a unit vector of the direction. |
| up | A unit vector representing the up vector, this is expected to be normalized / length of 1.0. |
|
inline |
Creates a right-handed orthographic matrix for 2D rendering given a few setup parameters. The Matrix will look something like the following once returned:
2 / (r - l), 0, 0, -(r + l) / (r - l), 0, 2 / (t - b), 0, -(t + b) / (t - b), 0, 0, 2 / (f - n), -(f + n) / (f - n), 0, 0, 0 1
| result | Where to store the resulting matrix and return. |
| width | The width of the screen/window/surface available for the 2D rendering. |
| height | The height of the screen/window/surface available for the 2D rendering. |
| nearPlane | The distance to the near plane of the orthographic matrix. (closest Z value). |
| farPlane | The distance to the far plane of the orthographic matrix. (farthest Z value). |
|
inline |
Creates a right-handed orthographic matrix for 2D rendering given a few setup parameters. The Matrix will look something like the following once returned:
2 / (r - l), 0, 0, -(r + l) / (r - l), 0, 2 / (t - b), 0, -(t + b) / (t - b), 0, 0, -2 / (f - n), -(f + n) / (f - n), 0, 0, 0 1
| result | Where to store the resulting matrix and return. |
| width | The width of the screen/window/surface available for the 2D rendering. |
| height | The height of the screen/window/surface available for the 2D rendering. |
| nearPlane | The distance to the near plane of the orthographic matrix. (closest Z value). |
| farPlane | The distance to the far plane of the orthographic matrix. (farthest Z value). |
|
inline |
Creates a left-handed projection matrix for 3D rendering given a few setup parameters.
| result | Where to store the resulting matrix and return. |
| fieldOfView | The angle (in radians) of the vertical field of vision for the projection matrix. To use horizontal field of view, just use verticalFOV / aspectRatio when calling. |
| aspectRatio | The aspect ratio of the window/screen or target render. |
| nearPlane | The distance to the near plane of the projection matrix. |
| farPlane | The distance to the far plane of the projection matrix. |
|
inline |
Creates a right-handed projection matrix for 3D rendering given a few setup parameters.
| result | Where to store the resulting matrix and return. |
| fieldOfView | The angle (in radians) of the vertical field of vision for the projection matrix. To use horizontal field of view, just use verticalFOV / aspectRatio when calling. |
| aspectRatio | The aspect ratio of the window/screen or target render. |
| nearPlane | The distance to the near plane of the projection matrix. |
| farPlane | The distance to the far plane of the projection matrix. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateRotationA | ( | TypedMatrix3< Type > * | result, |
| const TypedVector3< Type > * | rotationAxis, | ||
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the specied rotationAxis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationAxis | The axis to rotate around, should be a unit vector, can be an arbitrary direction. |
| rotationInDegrees | The amount to rotate around the Z-axis in degrees. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateRotationA | ( | TypedMatrix4< Type > * | result, |
| const TypedVector3< Type > * | rotationAxis, | ||
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the specied rotationAxis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationAxis | The axis to rotate around, should be a unit vector, can be an arbitrary direction. |
| rotationInDegrees | The amount to rotate around the Z-axis in degrees. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateRotationX | ( | TypedMatrix3< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the X-axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the X-axis in degrees. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateRotationX | ( | TypedMatrix4< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the X-axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the X-axis in degrees. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateRotationY | ( | TypedMatrix3< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the Y axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the Y-axis in degrees. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateRotationY | ( | TypedMatrix4< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the Y axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the Y-axis in degrees. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateRotationZ | ( | TypedMatrix3< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the X-axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the Z-axis in degrees. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateRotationZ | ( | TypedMatrix4< Type > * | result, |
| const tbMath::TypedAngle< Type > | rotation | ||
| ) |
Creates a rotation transform Matrix object with no translation or scaling that will rotate around the X-axis by the amount specified by the rotation parameter.
| result | The matrix to hold the result and be returned. |
| rotationInDegrees | The amount to rotate around the Z-axis in degrees. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateScale | ( | TypedMatrix3< Type > * | result, |
| const Type | scaleX, | ||
| const Type | scaleY, | ||
| const Type | scaleZ | ||
| ) |
Creates a scale transform Matrix object with no translation or rotation set to the position specified by the x, y, z parameter values.
| result | The matrix to hold the result and be returned. |
| scaleX | The amount of scaling for the transform matrix in the X-axis. |
| scaleY | The amount of scaling for the transform matrix in the Y-axis. |
| scaleZ | The amount of scaling for the transform matrix in the Z-axis. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixCreateScale | ( | TypedMatrix3< Type > * | result, |
| const TypedVector3< Type > * | scale | ||
| ) |
Creates a scale transform Matrix object with no translation or rotation set to the position specified by the Vector object.
| result | The matrix to hold the result and be returned. |
| scale | The amount of scaling of each axis represented by the vector components. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateScale | ( | TypedMatrix4< Type > * | result, |
| const Type | scaleX, | ||
| const Type | scaleY, | ||
| const Type | scaleZ | ||
| ) |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateScale | ( | TypedMatrix4< Type > * | result, |
| const TypedVector3< Type > * | scale | ||
| ) |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateTranslation | ( | TypedMatrix4< Type > * | result, |
| const Type | translationX, | ||
| const Type | translationY, | ||
| const Type | translationZ | ||
| ) |
Creates a translation transform Matrix object with no rotation set to the position specified by the x, y, z parameter values.
| result | The matrix to hold the result and be returned. |
| translationX | The amount of translation to add to the transform matrix in the X-axis. |
| translationY | The amount of translation to add to the transform matrix in the Y-axis. |
| translationZ | The amount of translation to add to the transform matrix in the Z-axis. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixCreateTranslation | ( | TypedMatrix4< Type > * | result, |
| const TypedVector3< Type > * | translation | ||
| ) |
Creates a translation transform Matrix object with no rotation set to the position specified by the Vector.
| result | The matrix to hold the result and be returned. |
| translation | The amount of translation to add in each axis represented by the vector components. |
| Type TurtleBrains::Math::MatrixDeterminant | ( | const TypedMatrix3< Type > * | input | ) |
Computes the determinant of the 3x3 matrix by breaking it down into 2x2 determinants and returns the resulting scalar determinant.
| Type TurtleBrains::Math::MatrixDeterminant | ( | const TypedMatrix4< Type > * | input | ) |
Computes the determinant of the 4x4 matrix by breaking it down into 3x3 determinants and returns the resulting scalar determinant.
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixFastInverse | ( | TypedMatrix3< Type > * | result, |
| const TypedMatrix3< Type > * | input | ||
| ) |
Creates the inverse matrix for a special, ortho-normalized matrix by transposing the 3x3.
| result | The matrix to store and return the computed inverse matrix of input. This cannot be the same matrix as the input matrix or an error condition will be triggered. |
| input | The matrix to compute the inverse of, cannot be the same as the result matrix or an error condition will be triggered. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixFastInverse | ( | TypedMatrix4< Type > * | result, |
| const TypedMatrix4< Type > * | input | ||
| ) |
Creates the inverse matrix for a special, ortho-normalized matrix by transposing the 3x3 in the top-left, negating the translation and multiplying it by that new 3x3 and keeping the diagonal equal.
A = [ M b ] [ 0 1 ] where, M is 3x3, b is 1x3, and bottom is 0, 0, 0, 1 inv(A) = [ inv(M) -inv(M) * b ] [ 0 1 ]
| result | The matrix to store and return the computed inverse matrix of input. This cannot be the same matrix as the input matrix or an error condition will be triggered. |
| input | The matrix to compute the inverse of, cannot be the same as the result matrix or an error condition will be triggered. |
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixMultiply | ( | TypedMatrix3< Type > * | result, |
| const TypedMatrix3< Type > * | input, | ||
| const Type & | scalar | ||
| ) |
Scales/multiplies each component of the matrix by the given scalar value.
| result | The result matrix which will be the product of input * scalar when finished. |
| input | The original matrix that should be scaled / multiplied with the scalar. |
| scalar | How much to multiply each component of the matrix by. |
TODO: TurtleBrains: Math: This will need some simple unit testing, though really it is easy enough.
| TypedMatrix3< Type > * TurtleBrains::Math::MatrixMultiply | ( | TypedMatrix3< Type > * | result, |
| const TypedMatrix3< Type > * | leftSide, | ||
| const TypedMatrix3< Type > * | rightSide | ||
| ) |
Multiplies two matrices together and stores the resulting matrix to be returned.
| result | The result matrix which will be the product of leftSide * rightSide when finished. This matrix cannot be the same as leftSide or rightSide or an error condition will be triggered. |
| leftSide | The matrix on the left side of the multiplication operation. This cannot be the same as the result matrix or an error condition will be triggered. |
| rightSide | The matrix on the right side of the multiplication operation. This cannot be the same as the result matrix or an error condition will be trtiggered. |
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixMultiply | ( | TypedMatrix4< Type > * | result, |
| const TypedMatrix4< Type > * | input, | ||
| const Type & | scalar | ||
| ) |
Scales/multiplies each component of the matrix by the given scalar value.
| result | The result matrix which will be the product of input * scalar when finished. |
| input | The original matrix that should be scaled / multiplied with the scalar. |
| scalar | How much to multiply each component of the matrix by. |
TODO: TurtleBrains: Math: This will need some simple unit testing, though really it is easy enough.
| TypedMatrix4< Type > * TurtleBrains::Math::MatrixMultiply | ( | TypedMatrix4< Type > * | result, |
| const TypedMatrix4< Type > * | leftSide, | ||
| const TypedMatrix4< Type > * | rightSide | ||
| ) |
|
inline |
Subtracts rightSide matrix from the leftSide matrix and stores the result into result before returning.
| result | The matrix to fill out and return with the result of: leftSide - rightSide. |
| leftSide | The matrix on the left side of the subtration operator. |
| rightSide | The matrix on the right side of the subtraction operator. |
|
inline |
Subtracts rightSide matrix from the leftSide matrix and stores the result into result before returning.
| result | The matrix to fill out and return with the result of: leftSide - rightSide. |
| leftSide | The matrix on the left side of the subtration operator. |
| rightSide | The matrix on the right side of the subtraction operator. |
Fills the compoments of result Matrix3 object so it would be the transposed of the input Matrix.
| result | The resulting matrix of the transposed operation on input, cannot be the same as the input matrix. |
| input | The matrix to get the transposed result of, cannot be the same as the result matrix. |
Fills the compoments of result Matrix4 object so it would be the transposed of the input Matrix.
| result | The resulting matrix of the transposed operation on input, cannot be the same as the input matrix. |
| input | The matrix to get the transposed result of, cannot be the same as the result matrix. |
| TypedVector3< Type > * TurtleBrains::Math::MatrixVector3Multiply | ( | TypedVector3< Type > * | result, |
| const TypedMatrix3< Type > * | inputMatrix, | ||
| const TypedVector3< Type > * | inputVector | ||
| ) |
Multiplies a matrix and a vector together treating the vector as a 3(row) 1(column) matrix.
| result | The vector to hold the result of the transformed inputVector), must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix, must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
| TypedVector4< Type > * TurtleBrains::Math::MatrixVector4Multiply | ( | TypedVector4< Type > * | result, |
| const TypedMatrix4< Type > * | inputMatrix, | ||
| const TypedVector4< Type > * | inputVector | ||
| ) |
Multiplies a matrix and a vector together treating the vector as a 4(row) 1(column) matrix.
| result | The vector to hold the result of the transformed inputVector), must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix), must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
|
constexprnoexcept |
Compares the value of two similar types using the less-than operator returning the greater of the values.
| leftValue | The value that would be on the left side of the comparison operator. |
| rightValue | The value that would be on the right side of the comparison operator. |
|
constexprnoexcept |
Compares the value of two similar types using the less-than operator returning the lesser of the values.
| leftValue | The value that would be on the left side of the comparison operator. |
| rightValue | The value that would be on the right side of the comparison operator. |
| std::ostream& TurtleBrains::Math::operator<< | ( | std::ostream & | output, |
| const tbMath::TypedAngle< Type > & | angle | ||
| ) |
Stream operator for logging an angle, as of 2023-11-28 written will always log in degrees.
| std::ostream& TurtleBrains::Math::operator<< | ( | std::ostream & | output, |
| const tbMath::TypedVector2< Type > & | data | ||
| ) |
I remember doing this about 300 times and then removing it, so, here we go again!
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionAdd | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | left, | ||
| const TypedQuaternion< Type > * | right | ||
| ) |
Add two the components of one TypedQuaternion to another TypedQuaternion and returns the resulting TypedQuaternion. Behavior is the same as TypedQuaternion::operator+ though no temporary is created in the process.
| result | is the result of leftSide + rightSide. |
| leftSide | The TypedQuaternion object to take the left hand side of the addition operation. |
| rightSide | The TypedQuaternion object to take the right hand side of the addition operation. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionInverse | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input | ||
| ) |
Inverses the quaternion, by negating the necessary components to do so and returns the resulting TypedQuaternion.
| result | The result of the inverse quaternion. |
| input | The TypedQuaternion object to inverse. |
| Type TurtleBrains::Math::QuaternionMagnitude | ( | const TypedQuaternion< Type > * | input | ) |
Computes the length / magnitude of the TypedQuaternion object and returns the result.
| Type TurtleBrains::Math::QuaternionMagnitudeSquared | ( | const TypedQuaternion< Type > * | input | ) |
Computes the length / magnitude of the TypedQuaternion object left squared so the square root is not taken, then returns the resulting scalar value.
| TypedQuaternion< Type > * TurtleBrains::Math::QuaternionMultiply | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | left, | ||
| const TypedQuaternion< Type > * | right | ||
| ) |
Multiples two Quaternions together and returns the resulting TypedQuaternion.
| result | is the result of leftSide * rightSide. |
| leftSide | The TypedQuaternion object to take the left hand side of the multiplication operation. |
| rightSide | The TypedQuaternion object to take the right hand side of the multiplication operation. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionNegate | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input | ||
| ) |
Negates each of the components of a TypedQuaternion and returns the resulting TypedQuaternion. This is the same as operator-(void) except it doesn't create the temporary.
| result | The result of negating each component in input. |
| input | The Vector object to negate. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionNormalize | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input | ||
| ) |
Calculates the unit-length Quaternion of the input Quaternion and returns the resulting unit-Quaternion.
| input | The TypedQuaternion object to get the unit-length of. |
| result | The unit length TypedQuaternion from the input, or a Identity TypedQuaternion if the input had no length. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionNormalizeMagnitude | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input, | ||
| Type & | magnitude | ||
| ) |
Calculates the unit-length TypedQuaternion of the input TypedQuaternion and returns the resulting unit-TypedQuaternion and to save computing the magnitude elsewhere, this will return the value in the magnitudee parameter.
| input | The TypedQuaternion object to get the unit-length of. |
| result | The unit length TypedQuaternion from the input, or a Identity TypedQuaternion if the input had no length. |
| magnitude | The length of the input TypedQuaternion as it must be computed to normalize anyway. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionScale | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input, | ||
| const Type | scalar | ||
| ) |
Multiples a TypedQuaternion together with a scalar and returns the resulting TypedQuaternion.
| result | is the result of leftSide * rightSide. |
| input | The TypedQuaternion object to take the left hand side of the multiplication operation. |
| scalar | The amount to scale the input Vector by. 2.0f would double the Vectors magnitude. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionScaleDivide | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | input, | ||
| const Type | scalar | ||
| ) |
Divides the components of one TypedQuaternion by the scalar and returns the resulting TypedQuaternion.
| result | The result of input / scalar. |
| input | The TypedQuaternion object to divide components by the scalar value. |
| scalar | The amount to inverse scale the input TypedQuaternion by. 2.0f would half the TypedQuaternion magnitude. |
| TypedQuaternion<Type>* TurtleBrains::Math::QuaternionSubtract | ( | TypedQuaternion< Type > * | result, |
| const TypedQuaternion< Type > * | left, | ||
| const TypedQuaternion< Type > * | right | ||
| ) |
Subtracts the components of one TypedQuaternion from the other TypedQuaternion and returns the resulting TypedQuaternion. Behavior is the same as TypedQuaternion::operator- though no temporary is created in the process.
| result | is the result of leftSide - rightSide. |
| leftSide | The TypedQuaternion object to take the left hand side of the subtraction operation. |
| rightSide | The TypedQuaternion object to take the right hand side of the subtraction operation. |
| float TurtleBrains::Math::RandomFloat | ( | const float | minimumValue, |
| const float | maximumValue | ||
| ) |
Returns a random float value between minimumValue and maximumValue inclusively.
| minimumValue | The smallest possible random value desired, must be less than maximumValue. |
| maximumValue | The largest possible random value desired, must be greater than minimumValue. |
| float TurtleBrains::Math::RandomFloat | ( | void | ) |
Create a random float in the range of: 0.0f <= value <= 1.0f
| int TurtleBrains::Math::RandomInt | ( | const int | minimumValue, |
| const int | maximumValue | ||
| ) |
Returns a random integer between minimumValue and maximumValue inclusively.
| minimumValue | The smallest possible random value desired, must be less than maximumValue. |
| maximumValue | The largest possible random value desired, must be greater than minimumValue. |
| int TurtleBrains::Math::RandomInt | ( | void | ) |
Returns a random integer between 0 and RAND_MAX by returning rand(), a better random-number generator may be used in future versions of TurtleBrains.
|
inlinestatic |
Converts an orientation value from 2D into a forward vector. Orientation should be in radians, positive for clockwise rotation around the Z axis, 0 pointing along the -Y axis.
|
inlinestatic |
Converts an orientation value from 2D (XZ plane) into a forward vector X, 0, Z. Orientation should be in radians, positive for clockwise rotation around the Y axis, 0 pointing along the -Z axis.
| unsigned int TurtleBrains::Math::SeedRandomGenerator | ( | const String & | seed | ) |
Generates a seed using the hash of the string passed as parameter seed, then proceeds seed the the random generator, finally return the value as an unsigned int.
| seed | A string, usually shortish, to hash into an unsigned int which will be the generated seed. |
| void TurtleBrains::Math::SeedRandomGenerator | ( | unsigned int | seed | ) |
Starts the random generator with a specific seed.
| unsigned int TurtleBrains::Math::SeedRandomGenerator | ( | void | ) |
Generates a seed using time() and seeds the random generator, returning the seed used.
|
noexcept |
Returns -1, 0 or 1 depending on the sign or value given.
|
inline |
Add two the components of one Vector to another Vector and return the resulting Vector. Behavior is the same as Vector::operator+
| result | is the result of leftSide + rightSide. |
| leftSide | The Vector object to take the left hand side of the addition operation. |
| rightSide | The Vector object to take the right hand side of the addition operation. |
| Type TurtleBrains::Math::Vector2DotProduct | ( | const TypedVector2< Type > * | leftSide, |
| const TypedVector2< Type > * | rightSide | ||
| ) |
Performs the DotProduct on two Vector objects returning resulting scalar value.
| leftSide | The Vector object to take the left hand side of the dot product operation. |
| rightSide | The Vector object to take the right hand side of the dot product operation. |
| Type TurtleBrains::Math::Vector2Magnitude | ( | const TypedVector2< Type > * | input | ) |
Computes the length (magnitude) of a Vector object returning resulting scalar value.
| input | The Vector object to compute the length of. |
| Type TurtleBrains::Math::Vector2MagnitudeSquared | ( | const TypedVector2< Type > * | input | ) |
Computes the length (magnitude) of a Vector object without performing the square-root, so the resulting scalar is actually the squared length of the Vector.
| input | The Vector object to get the squared length of. |
Negates each of the components of a Vector and returns the resulting Vector.
| result | The result of negating each component in input. |
| input | The Vector object to negate. |
| TypedVector2< Type > * TurtleBrains::Math::Vector2Normalize | ( | TypedVector2< Type > * | result, |
| const TypedVector2< Type > * | input | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| TypedVector2< Type > * TurtleBrains::Math::Vector2NormalizeMagnitude | ( | TypedVector2< Type > * | result, |
| const TypedVector2< Type > * | input, | ||
| Type & | magnitude | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector and to save computing the magnitude elsewhere, this will return the value in the magnitude parameter.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| magnitude | The length of the input vector as it must be computed. |
|
inline |
Scales the components of one Vector and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to scale the input Vector by. 2.0f would double the Vectors magnitude. |
|
inline |
Divides the components of one Vector by the scalar and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to inverse scale the input Vector by. 2.0f would half the Vectors magnitude. |
|
inline |
Subtracts the components of one Vector from another Vector and returns the resulting Vector. Behavior is the same as using Vector::operator-
| result | is the result of leftSide - rightSide. |
| leftSide | The Vector object to take the left hand side of the subtraction operation. |
| rightSide | The Vector object to take the right hand side of the subtraction operation. |
|
inline |
Add two the components of one Vector to another Vector and return the resulting Vector. Behavior is the same as Vector::operator+
| result | is the result of leftSide + rightSide. |
| leftSide | The Vector object to take the left hand side of the addition operation. |
| rightSide | The Vector object to take the right hand side of the addition operation. |
| TypedAngle<Type> TurtleBrains::Math::Vector3AngleBetween | ( | const TypedVector3< Type > * | left, |
| const TypedVector3< Type > * | right | ||
| ) |
Returns angle between vectors in radians, 0 is both pointing same direction, kPi if both vectors are pointing in opposite directions.
| TypedVector3< Type > * TurtleBrains::Math::Vector3CrossProduct | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | leftSide, | ||
| const TypedVector3< Type > * | rightSide | ||
| ) |
Computes the CrossProduct of two Vector objects. The resulting Vector will be perpendicular to the input vectors, or become a zero vector if those are parallel. Assuming a right hand coordinate system, X cross Y will result in Z while Y cross X would be -Z. An easy way to get the axis you want is to write xyzxyz, then find the axis you want (ex: Want Y, Y = Z cross X). Again this works for a right handed system because x cross y will be a positive z.
| result | The result of leftSide cross rightSide, also performed with operator^ |
| leftSide | The Vector object to take the left hand side of the cross product operation. |
| rightSide | The Vector object to take the right hand side of the cross product operation. |
| Type TurtleBrains::Math::Vector3DotProduct | ( | const TypedVector3< Type > * | leftSide, |
| const TypedVector3< Type > * | rightSide | ||
| ) |
Performs the DotProduct on two Vector objects returning resulting scalar value.
| leftSide | The Vector object to take the left hand side of the dot product operation. |
| rightSide | The Vector object to take the right hand side of the dot product operation. |
| Type TurtleBrains::Math::Vector3Magnitude | ( | const TypedVector3< Type > * | input | ) |
Computes the length (magnitude) of a Vector object returning resulting scalar value.
| input | The Vector object to compute the length of. |
| Type TurtleBrains::Math::Vector3MagnitudeSquared | ( | const TypedVector3< Type > * | input | ) |
Computes the length (magnitude) of a Vector object without performing the square-root, so the resulting scalar is actually the squared length of the Vector.
| input | The Vector object to get the squared length of. |
| TypedVector3< Type > * TurtleBrains::Math::Vector3MatrixMultiply | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | inputVector, | ||
| const TypedMatrix3< Type > * | inputMatrix | ||
| ) |
Multiplies a vector and a matrix together treating the vector as a 3(row) 1(column) matrix.
| result | The vector to hold the result of the transformed inputVector), must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix), must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
Negates each of the components of a Vector and returns the resulting Vector.
| result | The result of negating each component in input. |
| input | The Vector object to negate. |
| TypedVector3< Type > * TurtleBrains::Math::Vector3Normalize | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | input | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| TypedVector3< Type > * TurtleBrains::Math::Vector3NormalizeMagnitude | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | input, | ||
| Type & | magnitude | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector and to save computing the magnitude elsewhere, this will return the value in the magnitude parameter.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| magnitude | The length of the input vector as it must be computed. |
|
inline |
Scales the components of one Vector and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to scale the input Vector by. 2.0f would double the Vectors magnitude. |
|
inline |
Divides the components of one Vector by the scalar and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to inverse scale the input Vector by. 2.0f would half the Vectors magnitude. |
|
inline |
Subtracts the components of one Vector from another Vector and returns the resulting Vector. Behavior is the same as using Vector::operator-
| result | is the result of leftSide - rightSide. |
| leftSide | The Vector object to take the left hand side of the subtraction operation. |
| rightSide | The Vector object to take the right hand side of the subtraction operation. |
| TypedVector3< Type > * TurtleBrains::Math::Vector3TransformCoordinate | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | inputVector, | ||
| const TypedMatrix4< Type > * | inputMatrix | ||
| ) |
Multiplies a vector and matrix together to transform the inputVector into the space described by the inputMatrix storing and returning the result. This behaves identical to Vector4MatrixMultiply except with Vector3, 1.0f and it can reduce that final round of multiplications.
lower confidence, needs more testing, but this would be the expected way things should work here... With a matrix transform from objectToWorld, the inputVector should be in object space and this function will transform it into world space.
| result | The vector to hold the result of the transformed inputVector, must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix, must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
| TypedVector3< Type > * TurtleBrains::Math::Vector3TransformNormal | ( | TypedVector3< Type > * | result, |
| const TypedVector3< Type > * | inputVector, | ||
| const TypedMatrix4< Type > * | inputMatrix | ||
| ) |
Multiplies a vector and matrix together to transform the inputVector into the space described by the inputMatrix storing and returning the result. This behaves identical to Vector4MatrixMultiply except with Vector3, 0.0f and it can reduces that final round of adding and the multiplications. It differs from TransformCoordinate by not applying the translation, useful for directions/normals.
| result | The vector to hold the result of the transformed inputVector, must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix, must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
|
inline |
Add two the components of one Vector to another Vector and return the resulting Vector. Behavior is the same as Vector::operator+
| result | is the result of leftSide + rightSide. |
| leftSide | The Vector object to take the left hand side of the addition operation. |
| rightSide | The Vector object to take the right hand side of the addition operation. |
| Type TurtleBrains::Math::Vector4DotProduct | ( | const TypedVector4< Type > * | leftSide, |
| const TypedVector4< Type > * | rightSide | ||
| ) |
Performs the DotProduct on two Vector objects returning resulting scalar value.
| leftSide | The Vector object to take the left hand side of the dot product operation. |
| rightSide | The Vector object to take the right hand side of the dot product operation. |
| Type TurtleBrains::Math::Vector4Magnitude | ( | const TypedVector4< Type > * | input | ) |
Computes the length (magnitude) of a Vector object returning resulting scalar value.
| input | The Vector object to compute the length of. |
| Type TurtleBrains::Math::Vector4MagnitudeSquared | ( | const TypedVector4< Type > * | input | ) |
Computes the length (magnitude) of a Vector object without performing the square-root, so the resulting scalar is actually the squared length of the Vector.
| input | The Vector object to get the squared length of. |
| TypedVector4< Type > * TurtleBrains::Math::Vector4MatrixMultiply | ( | TypedVector4< Type > * | result, |
| const TypedVector4< Type > * | inputVector, | ||
| const TypedMatrix4< Type > * | inputMatrix | ||
| ) |
Multiplies a vector and a matrix together treating the vector as a 4(row) 1(column) matrix.
| result | The vector to hold the result of the transformed inputVector), must be a different vector object or an error condition will be triggered. |
| inputVector | The vector to transform by the input matrix), must not be the same as result. |
| inputMatrix | The transform matrix to multiply inputVector by. |
Negates each of the components of a Vector and returns the resulting Vector.
| result | The result of negating each component in input. |
| input | The Vector object to negate. |
| TypedVector4< Type > * TurtleBrains::Math::Vector4Normalize | ( | TypedVector4< Type > * | result, |
| const TypedVector4< Type > * | input | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| TypedVector4< Type > * TurtleBrains::Math::Vector4NormalizeMagnitude | ( | TypedVector4< Type > * | result, |
| const TypedVector4< Type > * | input, | ||
| Type & | magnitude | ||
| ) |
Calculates the unit-length vector of the input Vector and returns the resulting Vector and to save computing the magnitude elsewhere, this will return the value in the magnitude parameter.
| result | The unit length vector from the input, or a zero vector if the input had no length. |
| input | The Vector object to get the unit-length of. |
| magnitude | The length of the input vector as it must be computed. |
|
inline |
Scales the components of one Vector and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to scale the input Vector by. 2.0f would double the Vectors magnitude. |
|
inline |
Divides the components of one Vector by the scalar and returns the resulting Vector.
| result | The result of input * scalar. |
| input | The Vector object to scale by the scalar value. |
| scalar | The amount to inverse scale the input Vector by. 2.0f would half the Vectors magnitude. |
|
inline |
Subtracts the components of one Vector from another Vector and returns the resulting Vector. Behavior is the same as using Vector::operator-
| result | is the result of leftSide - rightSide. |
| leftSide | The Vector object to take the left hand side of the subtraction operation. |
| rightSide | The Vector object to take the right hand side of the subtraction operation. |