Man Linux: Main Page and Category List

NAME

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

SYNOPSIS

       #include <allegro.h>

       Example exquat

DESCRIPTION

       Euler angles are convenient for storing and creating  3D  orientations.
       However,  this  program  demonstrates  that  they  are  not  good  when
       interpolating between two different orientations. The problem is solved
       by using Allegro's quaternion operations.

       In  this  program,  two  cubes are rotated between random orientations.
       Notice  that  although  they  have  the  same  beginning   and   ending
       orientations, they do not follow the same path between orientations.

       One  cube is being rotated by directly incrementing or decrementing the
       Euler angles from the starting point to the ending point.  This  is  an
       intuitive  notion,  but  it  is incorrect because it does not cause the
       object to turn around a single unchanging axis of rotation.   The  axis
       of  rotation  wobbles resulting in the object spinning in strange ways.
       The object will eventually end up in  the  orientation  that  the  user
       intended,  but it gets there in a way that is unattractive.  Imagine if
       this method was used to update the position of  a  camera  in  a  game!
       Sometimes it would swing wildly and disorient the player.

       The  other  cube  is animated using quaternions. This results in a much
       more pleasing animation because the cube turns around a single axis  of
       rotation.

SEE ALSO

       BITMAP(3alleg),  END_OF_MAIN(3alleg),  MATRIX_f(3alleg),  QUAT(3alleg),
       acquire_bitmap(3alleg),  allegro_error(3alleg),   allegro_init(3alleg),
       allegro_message(3alleg),      apply_matrix_f(3alleg),     blit(3alleg),
       circle(3alleg),      clear_keybuf(3alleg),      clear_to_color(3alleg),
       create_bitmap(3alleg), desktop_palette(3alleg), destroy_bitmap(3alleg),
       font(3alleg), get_camera_matrix_f(3alleg), get_rotation_matrix(3alleg),
       get_rotation_matrix_f(3alleg),               get_rotation_quat(3alleg),
       install_keyboard(3alleg),       keypressed(3alleg),       line(3alleg),
       matrix_mul_f(3alleg),  palette_color(3alleg),  persp_project_f(3alleg),
       quat_interpolate(3alleg),   quat_to_matrix(3alleg),    readkey(3alleg),
       release_bitmap(3alleg),          rest(3alleg),          screen(3alleg),
       set_gfx_mode(3alleg),                              set_palette(3alleg),
       set_projection_viewport(3alleg), textout_ex(3alleg)