2024-02-21 12:55:37 +01:00

33 lines
860 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(const MatrixOf<T> *m1, MatrixOf<T> *m2, MatrixOf<T> *r);
void Multiply(MatrixOf<T> *m, MatrixOf<T> *r);
static Vector3 Multiply(const MatrixOf<T> *m, Vector3 v);
Vector3 operator*(const Vector3 v) const;
T Get(unsigned int rowIx, unsigned int colIx);
unsigned int RowCount();
unsigned int ColCount();
private:
unsigned int rows;
unsigned int cols;
T *data;
};
#endif