1exquat(3)                       Allegro manual                       exquat(3)
2
3
4

NAME

6       exquat  -  A  comparison  between Euler angles and quaternions. Allegro
7       game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       Example exquat
14

DESCRIPTION

16       Euler angles are convenient for storing and creating  3D  orientations.
17       However, this program demonstrates that they are not good when interpo‐
18       lating between two different orientations. The  problem  is  solved  by
19       using Allegro's quaternion operations.
20
21       In  this  program,  two  cubes are rotated between random orientations.
22       Notice that although they have the same beginning and  ending  orienta‐
23       tions, they do not follow the same path between orientations.
24
25       One  cube is being rotated by directly incrementing or decrementing the
26       Euler angles from the starting point to the ending point.  This  is  an
27       intuitive  notion,  but  it  is incorrect because it does not cause the
28       object to turn around a single unchanging axis of rotation.   The  axis
29       of  rotation  wobbles resulting in the object spinning in strange ways.
30       The object will eventually end up in  the  orientation  that  the  user
31       intended,  but it gets there in a way that is unattractive.  Imagine if
32       this method was used to update the position of  a  camera  in  a  game!
33       Sometimes it would swing wildly and disorient the player.
34
35       The  other  cube  is animated using quaternions. This results in a much
36       more pleasing animation because the cube turns around a single axis  of
37       rotation.
38
39

SEE ALSO

41       BITMAP(3),  END_OF_MAIN(3),  MATRIX_f(3),  QUAT(3),  acquire_bitmap(3),
42       allegro_error(3),         allegro_init(3),          allegro_message(3),
43       apply_matrix_f(3),       blit(3),      circle(3),      clear_keybuf(3),
44       clear_to_color(3), create_bitmap(3),  desktop_palette(3),  destroy_bit‐
45       map(3),    font(3),   get_camera_matrix_f(3),   get_rotation_matrix(3),
46       get_rotation_matrix_f(3),  get_rotation_quat(3),   install_keyboard(3),
47       keypressed(3),      line(3),     matrix_mul_f(3),     palette_color(3),
48       persp_project_f(3), quat_interpolate(3), quat_to_matrix(3), readkey(3),
49       release_bitmap(3), rest(3), screen(3), set_gfx_mode(3), set_palette(3),
50       set_projection_viewport(3), textout_ex(3)
51
52
53
54Allegro                          version 4.2.3                       exquat(3)
Impressum