OpenVSP API Documentation 3.49.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 void print( const std::string &header = "" );
56
57 static void setIdentity( double *m );
58
90
91 void translatef( const double &x, const double &y, const double &z );
92
93 void translatev( const vec3d &v );
94
123
124 void rotateX( const double &ang );
125
154
155 void rotateY( const double &ang );
156
185
186 void rotateZ( const double &ang );
187
219
220 void rotate( const double &angle, const vec3d &axis );
221
222
223 void rotatealongX( const vec3d &dir1 );
224
225 void zeroTranslations();
226
266
268
297
298 void scale( const double &scale );
299
300 void scalex( const double &scalex );
301
302 void scaley( const double &scaley );
303
304 void scalez( const double &scalez );
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
330 const double *const_data() const
331 {
332 return mat;
333 }
334
362
363 void loadXZRef();
364
392
393 void loadXYRef();
394
422
423 void loadYZRef();
424
425
454
455 void mirrory();
456
457 vec3d xform( const vec3d &in ) const;
458
459 void xformvec( std::vector < vec3d > &in ) const;
460
461 void xformmat( std::vector < std::vector < vec3d > > &in ) const;
462
463 vec3d xformnorm( const vec3d &in ) const;
464
465 void xformnormvec( std::vector < vec3d > &in ) const;
466
467 void xformnormmat( std::vector < std::vector < vec3d > > &in ) const;
468
501
503
504 vec3d getArcballAngles() const;
505
506 vec3d getTranslation() const;
507
517
518 void buildXForm( const vec3d &pos, const vec3d &rot, const vec3d &cent_rot );
519
520
521 void getBasis( vec3d &xdir, vec3d &ydir, vec3d &zdir ) const;
522
523 void setBasis( const vec3d &xdir, const vec3d &ydir, const vec3d &zdir );
524
525 void getRotationAxis( vec3d &axis_dir, vec3d &axis_pnt, double &angle ) const;
526
527 void toQuat( double &qw, double &qx, double &qy, double &qz, double &tx, double &ty, double &tz ) const;
528
529private:
530 double mat[ 16 ];
531};
532
533#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)