OpenVSP API Documentation  3.38.0
Matrix4d.h
1 //
2 // This file is released under the terms of the NASA Open Source Agreement (NOSA)
3 // version 1.3 as detailed in the LICENSE file which accompanies this software.
4 //
5 
6 
7 #ifndef __MATRIX_H_
8 #define __MATRIX_H_
9 
10 #include "Defines.h"
11 #include <cmath>
12 #include <cstring>
13 #include "Vec3d.h"
14 
15 
19 class Matrix4d
20 {
21 public:
22 
23  Matrix4d();
24 
47  void loadIdentity();
48 
49  static void setIdentity( double* m );
79  void translatef( const double &x, const double &y, const double &z );
80 
81  void translatev( const vec3d &v );
108  void rotateX( const double &ang );
109 
136  void rotateY( const double &ang );
137 
164  void rotateZ( const double &ang );
165 
195  void rotate( const double &angle, const vec3d & axis );
196 
197 
198  void rotatealongX( const vec3d & dir1 );
199 
200  void zeroTranslations();
239 
266  void scale( const double &scale );
267 
268 
269  void flipx();
270 
271  void getMat( double* m ) const;
272  void matMult( const double* m );
273  void postMult( const double* m );
274  void matMult( const Matrix4d &m );
275  void postMult( const Matrix4d & m );
276 
277 
278  void initMat( const double* m );
279  void initMat( const Matrix4d & m );
280  void mult( const double in[4], double out[4] ) const;
281  double * data()
282  {
283  return mat;
284  }
285 
311  void loadXZRef();
312 
338  void loadXYRef();
339 
365  void loadYZRef();
366 
367 
394  vec3d xform( const vec3d & in ) const;
395 
396  void xformvec( std::vector < vec3d > & in ) const;
397  vec3d xformnorm( const vec3d & in ) const;
398  void xformnormvec( std::vector < vec3d > & in ) const;
429  vec3d getAngles() const;
430 
431  vec3d getTranslation() const;
432 
440  void buildXForm( const vec3d & pos, const vec3d & rot, const vec3d & cent_rot );
441 
442 
443  void getBasis( vec3d &xdir, vec3d &ydir, vec3d &zdir );
444  void setBasis( const vec3d &xdir, const vec3d &ydir, const vec3d &zdir );
445 
446  void toQuat( double &qw, double &qx, double &qy, double &qz, double &tx, double &ty, double &tz ) const;
447 
448 private:
449 
450  double mat[16];
451 };
452 
453 #endif
void loadXZRef()
void rotate(const double &angle, const vec3d &axis)
vec3d getAngles() const
void loadXYRef()
void rotateX(const double &ang)
void rotateY(const double &ang)
vec3d xform(const vec3d &in) const
void buildXForm(const vec3d &pos, const vec3d &rot, const vec3d &cent_rot)
void loadYZRef()
void scale(const double &scale)
void loadIdentity()
void affineInverse()
void rotateZ(const double &ang)
void translatef(const double &x, const double &y, const double &z)
Definition: Vec3d.h:235
double angle(const vec3d &a, const vec3d &b)