MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRMesh/MRMatrix3.h>

Classes

struct  QR

Public Types

using ValueType = T
using VectorType = Vector3<T>

Public Member Functions

constexpr Matrix3 () noexcept
constexpr Matrix3 (const Vector3< T > &x, const Vector3< T > &y, const Vector3< T > &z)
 initializes matrix from its 3 rows
template<typename U>
constexpr Matrix3 (const Matrix3< U > &m)
constexpr const Vector3< T > & operator[] (int row) const noexcept
 row access
constexpr Vector3< T > & operator[] (int row) noexcept
constexpr Vector3< T > col (int i) const noexcept
 column access
constexpr T trace () const noexcept
 computes trace of the matrix
constexpr T normSq () const noexcept
 compute sum of squared matrix elements
constexpr auto norm () const noexcept
constexpr T det () const noexcept
 computes determinant of the matrix
constexpr Matrix3< T > inverse () const noexcept
 computes inverse matrix
constexpr Matrix3< T > transposed () const noexcept
 computes transposed matrix
constexpr Vector3< T > toEulerAngles () const noexcept
 returns 3 Euler angles, assuming this is a rotation matrix composed as follows: R=R(z)*R(y)*R(x)
QR qr () const noexcept
 decompose this matrix on the product Q*R, where Q is orthogonal and R is upper triangular

Static Public Member Functions

static constexpr Matrix3 zero () noexcept
static constexpr Matrix3 identity () noexcept
static constexpr Matrix3 scale (T s) noexcept
 returns a matrix that scales uniformly
static constexpr Matrix3 scale (T sx, T sy, T sz) noexcept
 returns a matrix that has its own scale along each axis
static constexpr Matrix3 scale (const Vector3< T > &s) noexcept
static constexpr Matrix3 rotation (const Vector3< T > &axis, T angle) noexcept
 creates matrix representing rotation around given axis on given angle
static constexpr Matrix3 rotation (const Vector3< T > &from, const Vector3< T > &to) noexcept
 creates matrix representing rotation that after application to (from) makes (to) vector
static constexpr Matrix3 rotationFromEuler (const Vector3< T > &eulerAngles) noexcept
static constexpr Matrix3 approximateLinearRotationMatrixFromEuler (const Vector3< T > &eulerAngles) noexcept
 returns linear by angles approximation of the rotation matrix, which is close to true rotation matrix for small angles
static constexpr Matrix3 fromRows (const Vector3< T > &x, const Vector3< T > &y, const Vector3< T > &z) noexcept
 constructs a matrix from its 3 rows
static constexpr Matrix3 fromColumns (const Vector3< T > &x, const Vector3< T > &y, const Vector3< T > &z) noexcept

Public Attributes

Vector3< T > x { 1, 0, 0 }
 rows, identity matrix by default
Vector3< T > y { 0, 1, 0 }
Vector3< T > z { 0, 0, 1 }

Friends

constexpr bool operator== (const Matrix3< T > &a, const Matrix3< T > &b)
constexpr bool operator!= (const Matrix3< T > &a, const Matrix3< T > &b)
constexpr auto operator+ (const Matrix3< T > &a, const Matrix3< T > &b) -> Matrix3< decltype(std::declval< T >()+std::declval< T >())>
 NOTE: We use std::declval() in the operators below because libclang 18 in our binding generator is bugged and chokes on decltyping a.x and such. TODO fix this when we update libclang.
constexpr auto operator- (const Matrix3< T > &a, const Matrix3< T > &b) -> Matrix3< decltype(std::declval< T >() - std::declval< T >())>
constexpr auto operator* (T a, const Matrix3< T > &b) -> Matrix3< decltype(std::declval< T >() *std::declval< T >())>
constexpr auto operator* (const Matrix3< T > &b, T a) -> Matrix3< decltype(std::declval< T >() *std::declval< T >())>
constexpr auto operator/ (Matrix3< T > b, T a) -> Matrix3< decltype(std::declval< T >()/std::declval< T >())>
constexpr Matrix3< T > & operator+= (Matrix3< T > &a, const Matrix3< T > &b)
constexpr Matrix3< T > & operator-= (Matrix3< T > &a, const Matrix3< T > &b)
constexpr Matrix3< T > & operator*= (Matrix3< T > &a, T b)
constexpr Matrix3< T > & operator/= (Matrix3< T > &a, T b)
constexpr auto operator* (const Matrix3< T > &a, const Vector3< T > &b) -> Vector3< decltype(dot(std::declval< Vector3< T > >(), std::declval< Vector3< T > >()))>
 x = a * b
constexpr auto operator* (const Matrix3< T > &a, const Matrix3< T > &b) -> Matrix3< decltype(dot(std::declval< Vector3< T > >(), std::declval< Vector3< T > >()))>
 product of two matrices
std::ostream & operator<< (std::ostream &s, const Matrix3 &mat)
std::istream & operator>> (std::istream &s, Matrix3 &mat)

(Note that these are not member symbols.)

template<typename T>
auto dot (const Matrix3< T > &a, const Matrix3< T > &b) -> decltype(dot(a.x, b.x))
 double-dot product: x = a : b
template<typename T>
Matrix3< T > outer (const Vector3< T > &a, const Vector3< T > &b)
 x = a * b^T

Detailed Description

template<typename T>
struct MR::Matrix3< T >

arbitrary 3x3 matrix


The documentation for this struct was generated from the following file: