MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / Matrix3

Class Matrix3

samples/shared/Matrices.h:81–130  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////// 3x3 matrix //////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

79// 3x3 matrix
80///////////////////////////////////////////////////////////////////////////
81class Matrix3
82{
83public:
84 // constructors
85 Matrix3(); // init with identity
86 Matrix3(const float src[9]);
87 Matrix3(float m0, float m1, float m2, // 1st column
88 float m3, float m4, float m5, // 2nd column
89 float m6, float m7, float m8); // 3rd column
90
91 void set(const float src[9]);
92 void set(float m0, float m1, float m2, // 1st column
93 float m3, float m4, float m5, // 2nd column
94 float m6, float m7, float m8); // 3rd column
95 void setRow(int index, const float row[3]);
96 void setRow(int index, const Vector3& v);
97 void setColumn(int index, const float col[3]);
98 void setColumn(int index, const Vector3& v);
99
100 const float* get() const;
101 float getDeterminant();
102
103 Matrix3& identity();
104 Matrix3& transpose(); // transpose itself and return reference
105 Matrix3& invert();
106
107 // operators
108 Matrix3 operator+(const Matrix3& rhs) const; // add rhs
109 Matrix3 operator-(const Matrix3& rhs) const; // subtract rhs
110 Matrix3& operator+=(const Matrix3& rhs); // add rhs and update this object
111 Matrix3& operator-=(const Matrix3& rhs); // subtract rhs and update this object
112 Vector3 operator*(const Vector3& rhs) const; // multiplication: v' = M * v
113 Matrix3 operator*(const Matrix3& rhs) const; // multiplication: M3 = M1 * M2
114 Matrix3& operator*=(const Matrix3& rhs); // multiplication: M1' = M1 * M2
115 bool operator==(const Matrix3& rhs) const; // exact compare, no epsilon
116 bool operator!=(const Matrix3& rhs) const; // exact compare, no epsilon
117 float operator[](int index) const; // subscript operator v[0], v[1]
118 float& operator[](int index); // subscript operator v[0], v[1]
119
120 friend Matrix3 operator-(const Matrix3& m); // unary operator (-)
121 friend Matrix3 operator*(float scalar, const Matrix3& m); // pre-multiplication
122 friend Vector3 operator*(const Vector3& vec, const Matrix3& m); // pre-multiplication
123 friend std::ostream& operator<<(std::ostream& os, const Matrix3& m);
124
125protected:
126
127private:
128 float m[9];
129
130};
131
132
133

Callers 5

operator+Method · 0.85
operator-Method · 0.85
operator*Method · 0.85
operator-Function · 0.85
operator*Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected