forked from MauriceGit/Quaternion_Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmtQuaternions.h
50 lines (31 loc) · 1.28 KB
/
mtQuaternions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __MTQUATERNIONS_H__
#define __MTQUATERNIONS_H__
/**
* Interface for some operations on Quaternions.
* All operations are prefixed with 'mt' to avoid name clashes and get an
* attempt for a unique prefix.
*
* @author Maurice Tollmien
*/
#include "mtVector.h"
/** Quaternion */
typedef struct
{
double s;
MTVec3D v;
} MTQuaternion;
/* Low level operations on MTQuaternions */
MTQuaternion mtCreateMTQuaternion(MTVec3D axis, double angle);
MTQuaternion mtMultMTQuaternionMTQuaternion (const MTQuaternion* q1, const MTQuaternion* q2);
MTQuaternion mtMultMTQuaternionScalar (const MTQuaternion* q1, double s);
MTQuaternion mtAddMTQuaternionMTQuaternion (const MTQuaternion* q1, const MTQuaternion* q2);
MTQuaternion mtSubtractMTQuaternionMTQuaternion (const MTQuaternion* q1, const MTQuaternion* q2);
MTQuaternion mtConjugateMTQuaternion (const MTQuaternion* q1);
MTQuaternion mtInverseMTQuaternion (const MTQuaternion* q1);
void mtNormMTQuaternion (MTQuaternion* q1);
double mtLengthMTQuaternion (const MTQuaternion* q1);
int mtIsNormMTQuaternion (const MTQuaternion* q1);
/* Some higher level functions, using MTQuaternions */
MTVec3D mtRotatePointWithMTQuaternion(MTQuaternion q, MTVec3D point);
MTVec3D mtRotatePointAxis (MTVec3D axis, double angle, MTVec3D point);
#endif