Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::Mat2 Class Reference

2 x 2 matrix to be used for math. More...

#include <mat2.h>

Public Member Functions

 Mat2 ()
 Default empty constructor that sets X and Y to 0.
 
 Mat2 (double a11, double a12, double a21, double a22)
 Constructor that sets up a new vector. More...
 
Mat2 operator- (const Mat2 &right)
 Overload of subtraction operator. More...
 
Mat2 operator- ()
 Overload of negation operator. More...
 
Mat2 operator+ (const Mat2 &right)
 Overload of addition operator. More...
 
Mat2 operator* (const Mat2 &right)
 Overload of multiplication operator. More...
 
Mat2 operator* (double scalar)
 Overload of multiplication operator for a scalar on the left. More...
 
Vec2 operator* (const Vec2 &right)
 Overload of multiplication operator for a rune::Mat2. More...
 
Mat2 operator/ (const Mat2 &right)
 Overload of division operator. More...
 
Mat2operator-= (const Mat2 &right)
 Overload of -= operator. More...
 
Mat2operator+= (const Mat2 &right)
 Overload of += operator. More...
 
Mat2operator+= (const double scalar)
 Overload of += operator for scalar. More...
 
Mat2operator*= (const Mat2 &right)
 Overload of *= operator. More...
 
Mat2operator*= (const double right)
 Overload of *= operator for a scalar multiplier. More...
 
bool operator== (const Mat2 &right)
 Overload of comparator operator. More...
 
bool operator!= (const Mat2 &right)
 Overload of != operator. More...
 
rune::Mat2 operator/ (double scalar)
 Overload of division operator for a scalar. More...
 
Mat2 invert ()
 Inversion of the matrix. More...
 
double determinant ()
 Determinant of the matrix. More...
 
double * operator[] (int index)
 Array like accessing of elements.
 
std::ostream & operator<< (std::ostream &os, const rune::Mat2 &matrix)
 
rune::Vec2 operator* (Vec2 const &vec, Mat2 &mat)
 
rune::Mat2 operator* (double scalar, Mat2 &mat)
 

Friends

RUNE_ENGINE std::ostream & operator<< (std::ostream &os, const Mat2 &vector)
 Overload of stream operator for printing.
 

Detailed Description

2 x 2 matrix to be used for math.

You should access this matrix using row major order. That means accessing the matrix using Mat2[y][x] where y is the row and x is the column number.

Author
Thomas Montano
Date
May 15 2020

Constructor & Destructor Documentation

◆ Mat2()

rune::Mat2::Mat2 ( double  a11,
double  a12,
double  a21,
double  a22 
)

Constructor that sets up a new vector.

Parameters
a11Element a11 of the matrix.
a12Element a12 of the matrix.
a21Element a21 of the matrix.
a22Element a22 of the matrix.

Member Function Documentation

◆ determinant()

double rune::Mat2::determinant ( )

Determinant of the matrix.

Returns
The determinant of the matrix.

◆ invert()

rune::Mat2 rune::Mat2::invert ( )

Inversion of the matrix.

Parameters
rightThe matrix to invert.
Returns
The inverse of the square matrix.

◆ operator!=()

bool rune::Mat2::operator!= ( const Mat2 right)

Overload of != operator.

Parameters
rightTHe matrix to compare with.
Returns
The result of a member wise comparison.

◆ operator*() [1/5]

rune::Mat2 rune::Mat2::operator* ( const Mat2 right)

Overload of multiplication operator.

Parameters
rightThe matrix to multiply by.
Returns
The result of the matrix multiplication.

◆ operator*() [2/5]

rune::Vec2 rune::Mat2::operator* ( const Vec2 right)

Overload of multiplication operator for a rune::Mat2.

Parameters
rightThe rune::Vec2 to be multiplied by.
Returns
The result of the multiplication.

◆ operator*() [3/5]

rune::Mat2 rune::Mat2::operator* ( double  scalar)

Overload of multiplication operator for a scalar on the left.

Parameters
scalarThe scalar to multiply by.
Returns
A member wise scalar multiplication.

◆ operator*() [4/5]

rune::Mat2 operator* ( double  scalar,
Mat2 mat 
)
Parameters
scalar
mat
Returns

◆ operator*() [5/5]

rune::Vec2 operator* ( Vec2 const &  vec,
Mat2 mat 
)
Parameters
vec
mat
Returns

◆ operator*=() [1/2]

rune::Mat2 & rune::Mat2::operator*= ( const double  right)

Overload of *= operator for a scalar multiplier.

Parameters
rightThe scalar to multiply by.
Returns
A member wise scalar multiplication.

◆ operator*=() [2/2]

rune::Mat2 & rune::Mat2::operator*= ( const Mat2 right)

Overload of *= operator.

Parameters
rightThe matrix to be multiplied by.
Returns
The result of the matrix multiplication.

◆ operator+()

rune::Mat2 rune::Mat2::operator+ ( const Mat2 right)

Overload of addition operator.

Parameters
rightThe matrix to be added.
Returns
The member wise addition.

◆ operator+=() [1/2]

rune::Mat2 & rune::Mat2::operator+= ( const double  scalar)

Overload of += operator for scalar.

Parameters
scalarThe scalar to be added.
Returns
A member wise addition.

◆ operator+=() [2/2]

rune::Mat2 & rune::Mat2::operator+= ( const Mat2 right)

Overload of += operator.

Parameters
rightThe matrix to be added.
Returns
The member wise addition.

◆ operator-() [1/2]

rune::Mat2 rune::Mat2::operator- ( )

Overload of negation operator.

Returns
The negative of the matrix.

◆ operator-() [2/2]

rune::Mat2 rune::Mat2::operator- ( const Mat2 right)

Overload of subtraction operator.

Parameters
rightThe matrix to be subtracted.
Returns
A member wise subtraction.

◆ operator-=()

rune::Mat2 & rune::Mat2::operator-= ( const Mat2 right)

Overload of -= operator.

Parameters
rightThe matrix to be subtracted.
Returns
The member wise subtraction.

◆ operator/() [1/2]

rune::Mat2 rune::Mat2::operator/ ( const Mat2 right)

Overload of division operator.

Parameters
rightThe matrix to divide by
Returns
The result of the multiplication by the inverse of the matrix.

◆ operator/() [2/2]

rune::Mat2 rune::Mat2::operator/ ( double  scalar)

Overload of division operator for a scalar.

Parameters
scalarThe scalar to multiply by.
Returns
A member wise scalar division.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const rune::Mat2 matrix 
)
Parameters
osOutput stream that the vector should be printed to.
matrixVector to be printed.
Returns
Stream to be printed to the console.

◆ operator==()

bool rune::Mat2::operator== ( const Mat2 right)

Overload of comparator operator.

Parameters
rightThe matrix to compare with.
Returns
The result of a member wise comparison.

The documentation for this class was generated from the following files: