OpenVSP API Documentation 3.44.2
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 "Defines.h"
14#include <cstring>
15#include "Vec3d.h"
16
17
24class Matrix4d
25{
26public:
27 Matrix4d();
28
53
55
56 static void setIdentity( double *m );
57
89
90 void translatef( const double &x, const double &y, const double &z );
91
92 void translatev( const vec3d &v );
93
122
123 void rotateX( const double &ang );
124
153
154 void rotateY( const double &ang );
155
184
185 void rotateZ( const double &ang );
186
218
219 void rotate( const double &angle, const vec3d &axis );
220
221
222 void rotatealongX( const vec3d &dir1 );
223
224 void zeroTranslations();
225
265
267
296
297 void scale( const double &scale );
298
299 void scalex( const double &scalex );
300
301 void scaley( const double &scaley );
302
303 void scalez( const double &scalez );
304
305 void mirrory();
306
307 void flipx();
308
309 void getMat( double *m ) const;
310
311 void matMult( const double *m );
312
313 void postMult( const double *m );
314
315 void matMult( const Matrix4d &m );
316
317 void postMult( const Matrix4d &m );
318
319
320 void initMat( const double *m );
321
322 void initMat( const Matrix4d &m );
323
324 void mult( const double in[ 4 ], double out[ 4 ] ) const;
325
326 double *data()
327 {
328 return mat;
329 }
330
358
359 void loadXZRef();
360
388
389 void loadXYRef();
390
418
419 void loadYZRef();
420
421
450
451 vec3d xform( const vec3d &in ) const;
452
453 void xformvec( std::vector < vec3d > &in ) const;
454
455 void xformmat( std::vector < std::vector < vec3d > > &in ) const;
456
457 vec3d xformnorm( const vec3d &in ) const;
458
459 void xformnormvec( std::vector < vec3d > &in ) const;
460
461 void xformnormmat( std::vector < std::vector < vec3d > > &in ) const;
462
495
497
498 vec3d getTranslation() const;
499
509
510 void buildXForm( const vec3d &pos, const vec3d &rot, const vec3d &cent_rot );
511
512
513 void getBasis( vec3d &xdir, vec3d &ydir, vec3d &zdir ) const;
514
515 void setBasis( const vec3d &xdir, const vec3d &ydir, const vec3d &zdir );
516
517 void toQuat( double &qw, double &qx, double &qy, double &qz, double &tx, double &ty, double &tz ) const;
518
519private:
520 double mat[ 16 ];
521};
522
523#endif
Definition Vec3d.h:236
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)