matrix3

From GriffinEngine
Jump to: navigation, search

Usage

Multipurpose 3*3 matrix type.

Inheritance

(Global)

Base classes

Derived classes

  • None

Reference

Constants

  • None

Fields

  • float* values;

Constructors

The first constructor creates an empty matrix. The second constructor takes in an 3x3 array of floats to create the matrix. The third constructor takes in another matrix3 and makes another matrix with it. The last constructor takes in an array of float3 and creates a matrix out of it.

  • matrix3();
  • matrix3(float** vectors);
  • matrix3(matrix3 &rhs);
  • matrix3(float3* vectors);

Accessors

  • None

Methods

The create methods all create a 3x3 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 float2 of the format <x,y> or just two floats. The create_identity will just return a 3x3 identity matrix. determinant() will calculate and return the determinant. invert() will calculate and return the inverted 3x3 matrix. transformVector() applies the transform matrix to a float2 vector and returns the new float2 vector.

  • static matrix3* create_rotate(float theta);
  • static matrix3* create_translate(float2 translate);
  • static matrix3* create_translate(float transX, float transY);
  • static matrix3* create_scale(float2 scale);
  • static matrix3* create_scale(float scaleX, float scaleY);
  • static matrix3* create_identity();
  • float determinant();
  • matrix3 invert();
  • float2 transformVector (float2 &rhs);

Operators

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

  • matrix3 operator+ (matrix3 &rhs);
  • matrix3 operator- (matrix3 &rhs);
  • matrix3 operator* (float rhs);
  • matrix3 operator/ (float rhs);
  • matrix3 operator* (matrix3 &rhs);
  • float3 operator* (float3 &rhs);
  • void operator+= (matrix3 &rhs);
  • void operator-= (matrix3 &rhs);
  • void operator*= (float rhs);
  • void operator/= (float rhs);
  • void operator*= (matrix3 &rhs);
  • operator float* ();