OpenVSP API Documentation 3.51.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
51
53
54 void print( const std::string &header = "" );
55
56 static void setIdentity( double *m );
57
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 flipx();
305
306 void getMat( double *m ) const;
307
308 void matMult( const double *m );
309
310 void postMult( const double *m );
311
312 void matMult( const Matrix4d &m );
313
314 void postMult( const Matrix4d &m );
315
316
317 void initMat( const double *m );
318
319 void initMat( const Matrix4d &m );
320
321 void mult( const double in[ 4 ], double out[ 4 ] ) const;
322
323 double *data()
324 {
325 return mat;
326 }
327
328 const double *const_data() const
329 {
330 return mat;
331 }
332
360
361 void loadXZRef();
362
390
391 void loadXYRef();
392
420
421 void loadYZRef();
422
423
451
452 void mirrory();
453
454 vec3d xform( const vec3d &in ) const;
455
456 void xformvec( std::vector < vec3d > &in ) const;
457
458 void xformmat( std::vector < std::vector < vec3d > > &in ) const;
459
460 vec3d xformnorm( const vec3d &in ) const;
461
462 void xformnormvec( std::vector < vec3d > &in ) const;
463
464 void xformnormmat( std::vector < std::vector < vec3d > > &in ) const;
465
498
500
501 vec3d getArcballAngles() const;
502
503 vec3d getTranslation() const;
504
514
515 void buildXForm( const vec3d &pos, const vec3d &rot, const vec3d &cent_rot );
516
517
518 void getBasis( vec3d &xdir, vec3d &ydir, vec3d &zdir ) const;
519
520 void setBasis( const vec3d &xdir, const vec3d &ydir, const vec3d &zdir );
521
522 void getRotationAxis( vec3d &axis_dir, vec3d &axis_pnt, double &angle ) const;
523
524 void toQuat( double &qw, double &qx, double &qy, double &qz, double &tx, double &ty, double &tz ) const;
525
526private:
527 double mat[ 16 ];
528};
529
530#endif
Definition Vec3d.h:243
void loadXZRef()
void rotate(const double &angle, const vec3d &axis)
vec3d getAngles() const
void mirrory()
void loadXYRef()
void rotateX(const double &ang)
void rotateY(const double &ang)
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)