Struct Matrix3x3

Struct Documentation

struct Matrix3x3

Public Functions

inline Matrix3x3 operator+(const Matrix3x3 &other) const

Matrix addition operator.

inline Matrix3x3 operator-(const Matrix3x3 &other) const

Matrix subtraction operator.

inline Matrix3x3 operator*(const double scalar) const

Matrix scalar multiplication operator.

inline Matrix3x3 &operator*=(const double scalar)

In-place scalar multiplication operator.

inline Vector3 operator*(const Vector3 &vec) const

Matrix multiply with vector.

inline void SetIJ(int i, int j, double value)

Set value at row i and column j.

inline void AddIJ(int i, int j, double value)

Add value to value at row i and column j.

inline double GetIJ(int i, int j) const

Obtain a copy of the value at row i and column j.

inline void SetRowIVec(int i, const Vector3 &vec)

Set row i using a vector.

inline void SetColJVec(int j, const Vector3 &vec)

Set column j using a vector.

inline void SetDiagonalVec(double a00, double a11, double a22)

Sets the diagonal of the matrix.

inline double Det(int row = 0) const

Get the determinant using specified row [default:0].

inline double MinorIJ(int ir, int jr) const

Get the minor value associated with row ir and column jr.

inline Matrix3x3 Transpose() const

Compute the matrix transpose.

inline Matrix3x3 Inverse() const

Compute the matrix inverse.

inline std::string PrintStr() const

Print the matrix as a string.

Public Members

std::array<double, 9> vals = {0., 0., 0., 0., 0., 0., 0., 0., 0.}

Storage for matrix elements.

Public Static Functions

static inline Matrix3x3 MakeRotationMatrixFromVector(const Vector3 &vec)

Produces a rotation matrix with a reference vector rotated from the cartesian basis vectors \(\hat{i}\), \(\hat{j}\) and \(\hat{k}\).

By default a rotation matrix that creates no rotation is the identity matrix. Such a matrix can be defined from basis vectors following the notion that the “up-vector” is \(\hat{k}\), this is also called the normal vector \(\hat{n}\). The tangent vector is \(\hat{i}\), denoted with \(\hat{t}\). And the bi-norm vector is \(\hat{j}\), denoted with \(\hat{b}\).

By specifying only the normal vector we can compute a simple pitch based rotation matrix. The supplied vector is therefore the new normal-vector, the tangent vector is computed as \( \hat{t} = \hat{n} \times \hat{k} \), and the bi-norm vector is computed as \( \hat{b} = \hat{n} \times \hat{t} \)