aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h')
-rw-r--r--src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h b/src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h
new file mode 100644
index 0000000..2d68907
--- /dev/null
+++ b/src/others/mimesh/libg3d-0.0.8/include/g3d/quat.h
@@ -0,0 +1,117 @@
1/* $Id:$ */
2
3/*
4 libg3d - 3D object loading library
5
6 Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21*/
22#ifndef _G3D_QUAT_H
23#define _G3D_QUAT_H
24
25#include <g3d/types.h>
26
27/**
28 * SECTION:quat
29 * @short_description: quaternion helpers
30 * @include: g3d/quat.h
31 */
32
33/**
34 * g3d_quat_normalize:
35 * @q: a quaternion
36 *
37 * normalize the quaternion to a length of 1.0.
38 *
39 * Returns: TRUE on success, FALSE else
40 */
41EAPI
42gboolean g3d_quat_normalize(G3DQuat *q);
43
44/**
45 * g3d_quat_rotate:
46 * @q: resulting quat
47 * @axis: rotation axis
48 * @angle: rotation angle
49 *
50 * Encode a rotation around an axis into quaternion.
51 *
52 * Returns: TRUE on success, FALSE else
53 */
54EAPI
55gboolean g3d_quat_rotate(G3DQuat *q, G3DVector *axis, G3DFloat angle);
56
57/**
58 * g3d_quat_add:
59 * @qr: result quat
60 * @q1: first quat
61 * @q2: second quat
62 *
63 * Add two quats.
64 *
65 * Returns: TRUE on success, FALSE else
66 */
67EAPI
68gboolean g3d_quat_add(G3DQuat *qr, G3DQuat *q1, G3DQuat *q2);
69
70/**
71 * g3d_quat_trackball:
72 * @q: resulting quaternion
73 * @x1: x value of first point
74 * @y1: y value of first point
75 * @x2: x value of second point
76 * @y2: y value of second point
77 * @r: radius of virtual trackball, usually 0.8
78 *
79 * Emulate a virtual trackball movement and return rotation as quaternion.
80 * The x and y values of the starting and end point of the movement have
81 * to be in the range -1.0 .. 1.0.
82 *
83 * Returns: TRUE on success, FALSE else
84 */
85EAPI
86gboolean g3d_quat_trackball(G3DQuat *q, G3DFloat x1, G3DFloat y1,
87 G3DFloat x2, G3DFloat y2, G3DFloat r);
88
89/**
90 * g3d_quat_to_matrix:
91 * @q: source quat
92 * @matrix: resulting matrix
93 *
94 * Convert a quaternion to a transformation matrix.
95 *
96 * Returns: TRUE on success, FALSE else
97 */
98EAPI
99gboolean g3d_quat_to_matrix(G3DQuat *q, G3DMatrix *matrix);
100
101/**
102 * g3d_quat_to_rotation_xyz:
103 * @q: a quaternion
104 * @rx: rotation around x axis
105 * @ry: rotation around y axis
106 * @rz: rotation around z axis
107 *
108 * Calculate the rotation around the three coordinate axes from a given
109 * quaternion.
110 *
111 * Returns: TRUE on success, FALSE else
112 */
113EAPI
114gboolean g3d_quat_to_rotation_xyz(G3DQuat *q, G3DFloat *rx, G3DFloat *ry,
115 G3DFloat *rz);
116
117#endif /* _G3D_QUAT_H */