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

Class Matrix4

samples/shared/Matrices.h:137–213  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////// 4x4 matrix //////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

135// 4x4 matrix
136///////////////////////////////////////////////////////////////////////////
137class Matrix4
138{
139public:
140 // constructors
141 Matrix4(); // init with identity
142 Matrix4(const float src[16]);
143 Matrix4(float m00, float m01, float m02, float m03, // 1st column
144 float m04, float m05, float m06, float m07, // 2nd column
145 float m08, float m09, float m10, float m11, // 3rd column
146 float m12, float m13, float m14, float m15);// 4th column
147
148 void set(const float src[16]);
149 void set(float m00, float m01, float m02, float m03, // 1st column
150 float m04, float m05, float m06, float m07, // 2nd column
151 float m08, float m09, float m10, float m11, // 3rd column
152 float m12, float m13, float m14, float m15);// 4th column
153 void setRow(int index, const float row[4]);
154 void setRow(int index, const Vector4& v);
155 void setRow(int index, const Vector3& v);
156 void setColumn(int index, const float col[4]);
157 void setColumn(int index, const Vector4& v);
158 void setColumn(int index, const Vector3& v);
159
160 const float* get() const;
161 const float* getTranspose(); // return transposed matrix
162 float getDeterminant();
163
164 Matrix4& identity();
165 Matrix4& transpose(); // transpose itself and return reference
166 Matrix4& invert(); // check best inverse method before inverse
167 Matrix4& invertEuclidean(); // inverse of Euclidean transform matrix
168 Matrix4& invertAffine(); // inverse of affine transform matrix
169 Matrix4& invertProjective(); // inverse of projective matrix using partitioning
170 Matrix4& invertGeneral(); // inverse of generic matrix
171
172 // transform matrix
173 Matrix4& translate(float x, float y, float z); // translation by (x,y,z)
174 Matrix4& translate(const Vector3& v); //
175 Matrix4& rotate(float angle, const Vector3& axis); // rotate angle(degree) along the given axix
176 Matrix4& rotate(float angle, float x, float y, float z);
177 Matrix4& rotateX(float angle); // rotate on X-axis with degree
178 Matrix4& rotateY(float angle); // rotate on Y-axis with degree
179 Matrix4& rotateZ(float angle); // rotate on Z-axis with degree
180 Matrix4& scale(float scale); // uniform scale
181 Matrix4& scale(float sx, float sy, float sz); // scale by (sx, sy, sz) on each axis
182
183 // operators
184 Matrix4 operator+(const Matrix4& rhs) const; // add rhs
185 Matrix4 operator-(const Matrix4& rhs) const; // subtract rhs
186 Matrix4& operator+=(const Matrix4& rhs); // add rhs and update this object
187 Matrix4& operator-=(const Matrix4& rhs); // subtract rhs and update this object
188 Vector4 operator*(const Vector4& rhs) const; // multiplication: v' = M * v
189 Vector3 operator*(const Vector3& rhs) const; // multiplication: v' = M * v
190 Matrix4 operator*(const Matrix4& rhs) const; // multiplication: M3 = M1 * M2
191 Matrix4& operator*=(const Matrix4& rhs); // multiplication: M1' = M1 * M2
192 bool operator==(const Matrix4& rhs) const; // exact compare, no epsilon
193 bool operator!=(const Matrix4& rhs) const; // exact compare, no epsilon
194 float operator[](int index) const; // subscript operator v[0], v[1]

Callers 15

GetHMDMatrixPoseEyeMethod · 0.85
SetupSceneMethod · 0.85
GetHMDMatrixPoseEyeMethod · 0.85
SetupSceneMethod · 0.85
GetHMDMatrixPoseEyeMethod · 0.85
SetupSceneMethod · 0.85
GetHMDMatrixPoseEyeMethod · 0.85
operator+Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected