32 float res = sin(ang / 2.0
f);
34 init.
w = cos(ang / 2.0
f);
47 fprintf(stderr,
"Pointer to a modelview matrix points to NULL.\n");
52 mat[ 0] = 1.0f - 2.0f * (quaternion.
y * quaternion.
y + quaternion.
z * quaternion.
z);
53 mat[ 1] = 2.0f * (quaternion.
x * quaternion.
y + quaternion.
z * quaternion.
w);
54 mat[ 2] = 2.0f * (quaternion.
x * quaternion.
z - quaternion.
y * quaternion.
w);
56 mat[ 4] = 2.0f * (quaternion.
x * quaternion.
y - quaternion.
z * quaternion.
w);
57 mat[ 5] = 1.0f - 2.0f * (quaternion.
x * quaternion.
x + quaternion.
z * quaternion.
z);
58 mat[ 6] = 2.0f * (quaternion.
z * quaternion.
y + quaternion.
x * quaternion.
w);
60 mat[ 8] = 2.0f * ( quaternion.
x * quaternion.
z + quaternion.
y * quaternion.
w);
61 mat[ 9] = 2.0f * ( quaternion.
y * quaternion.
z - quaternion.
x * quaternion.
w);
62 mat[10] = 1.0f - 2.0f * ( quaternion.
x * quaternion.
x + quaternion.
y * quaternion.
y);
75 res.
w = a.
w * b.
w - a.
x * b.
x - a.
y * b.
y - a.
z * b.
z;
76 res.
x = a.
w * b.
x + a.
x * b.
w + a.
y * b.
z - a.
z * b.
y;
77 res.
y = a.
w * b.
y + a.
y * b.
w + a.
z * b.
x - a.
x * b.
z;
78 res.
z = a.
w * b.
z + a.
z * b.
w + a.
x * b.
y - a.
y * b.
x;
GLboolean GLboolean GLboolean GLboolean a
Quaternion multiply_quaternions(Quaternion a, Quaternion b)
Quaternion construct_quaternion(float x, float y, float z, float degs)
#define M_PI
The value of pi.
void construct_modelview_matrix(Quaternion quaternion, float *mat)
GLint GLint GLint GLint GLint x
GLboolean GLboolean GLboolean b