2024-02-14 10:54:26 +01:00

33 lines
804 B
C++

#ifndef MATRIX_H
#define MATRIX_H
#include "Vector3.h"
/// @brief Single precision float matrix
template <typename T>
class MatrixOf {
public:
MatrixOf(unsigned int rows, unsigned int cols, T* data)
: rows(rows), cols(cols), data(data) {}
MatrixOf(Vector3 v); // creates a 3,1 matrix
/// @brief Transpose with result in matrix m
/// @param r The matrix in which the transposed matrix is stored
void Transpose(MatrixOf<T>* r);
static void Multiply(MatrixOf<T>* m1, MatrixOf<T>* m2, MatrixOf<T>* r);
void Multiply(MatrixOf<T>* m, MatrixOf<T>* r);
static Vector3 Multiply(MatrixOf<T>* m, Vector3 v);
T Get(unsigned int rowIx, unsigned int colIx);
unsigned int RowCount();
unsigned int ColCount();
private:
unsigned int rows;
unsigned int cols;
T* data;
};
#endif