OpenVSP API Documentation 3.45.0
Loading...
Searching...
No Matches
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#define _USE_MATH_DEFINES
11#include <cmath>
12
13#include <cstring>
14#include "Vec3d.h"
15
16
23class Matrix4d
24{
25public:
26 Matrix4d();
27
52
54
55 static void setIdentity( double *m );
56
88
89 void translatef( const double &x, const double &y, const double &z );
90
91 void translatev( const vec3d &v );
92
121
122 void rotateX( const double &ang );
123
152
153 void rotateY( const double &ang );
154
183
184 void rotateZ( const double &ang );
185
217
218 void rotate( const double &angle, const vec3d &axis );
219
220
221 void rotatealongX( const vec3d &dir1 );
222
223 void zeroTranslations();
224
264
266
295
296 void scale( const double &scale );
297
298 void scalex( const double &scalex );
299
300 void scaley( const double &scaley );
301
302 void scalez( const double &scalez );
303
304 void mirrory();
305
306 void flipx();
307
308 void getMat( double *m ) const;
309
310 void matMult( const double *m );
311
312 void postMult( const double *m );
313
314 void matMult( const Matrix4d &m );
315
316 void postMult( const Matrix4d &m );
317
318
319 void initMat( const double *m );
320
321 void initMat( const Matrix4d &m );
322
323 void mult( const double in[ 4 ], double out[ 4 ] ) const;
324
325 double *data()
326 {
327 return mat;
328 }
329
357
358 void loadXZRef();
359
387
388 void loadXYRef();
389
417
418 void loadYZRef();
419
420
449
450 vec3d xform( const vec3d &in ) const;
451
452 void xformvec( std::vector < vec3d > &in ) const;
453
454 void xformmat( std::vector < std::vector < vec3d > > &in ) const;
455
456 vec3d xformnorm( const vec3d &in ) const;
457
458 void xformnormvec( std::vector < vec3d > &in ) const;
459
460 void xformnormmat( std::vector < std::vector < vec3d > > &in ) const;
461
494
496
497 vec3d getTranslation() const;
498
508
509 void buildXForm( const vec3d &pos, const vec3d &rot, const vec3d &cent_rot );
510
511
512 void getBasis( vec3d &xdir, vec3d &ydir, vec3d &zdir ) const;
513
514 void setBasis( const vec3d &xdir, const vec3d &ydir, const vec3d &zdir );
515
516 void toQuat( double &qw, double &qx, double &qy, double &qz, double &tx, double &ty, double &tz ) const;
517
518private:
519 double mat[ 16 ];
520};
521
522#endif
Definition Vec3d.h:243
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)
double angle(const vec3d &a, const vec3d &b)