matrix4

From GriffinEngine
Jump to: navigation, search

Usage

Multipurpose 4*4 matrix type.

Inheritance

(Global)

Base classes

None

Derived classes

  • None

Reference

Constants

  • None

Fields

  • float* values;

Constructors

The first constructor creates an empty matrix. The second constructor takes in an 4x4 array of floats to create the matrix. The third constructor takes in another matrix4 and makes another matrix with it. The last constructor takes in an array of float4 and creates a matrix out of it.

  • matrix4();
  • matrix4(float** vectors);
  • matrix4(matrix4 &rhs);
  • matrix4(float4* vectors);

Accessors

  • None

Methods

The create methods all create a 4x4 matrix for either rotation, scaling, translation, or identity. The rotate takes in a theta for the angle where as the scale and the translate takes in a float3 of the format <x,y,z> or just three floats. The create_identity will just return a 4x4 identity matrix. determinant() will calculate and return the determinant. invert() will calculate and return the inverted 4x4 matrix. transformVector() applies the transform matrix to a float3 vector and returns the new float3 vector.

  • static matrix4* create_rotate(float thetaX, float thetaY, float thetaZ);
  • static matrix4* create_rotate(float3 theta);
  • static matrix4* create_translate(float transX, float transY, float transZ);
  • static matrix4* create_translate(float3 translate);
  • static matrix4* create_scale(float scaleX, float scaleY, float scaleZ);
  • static matrix4* create_scale(float3 scale);
  • static matrix4* create_identity();
  • float determinant();
  • matrix4 invert();
  • float3 transformVector (float3 &rhs);

Operators

These are all the overloaded operators for matrix3 which take care of scalar multiplication and matrix addition, subtraction, multiplication and division.

  • matrix4 operator+ (matrix4 &rhs);
  • matrix4 operator- (matrix4 &rhs);
  • matrix4 operator* (float rhs);
  • matrix4 operator/ (float rhs);
  • matrix4 operator* (matrix4 &rhs);
  • float4 operator* (float4 &rhs);
  • void operator+= (matrix4 &rhs);
  • void operator-= (matrix4 &rhs);
  • void operator*= (float rhs);
  • void operator/= (float rhs);
  • void operator*= (matrix4 &rhs);
  • operator float* ();