Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
exquat(3)			Allegro	manual			     exquat(3)

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

       #include	<allegro.h>

       Example exquat

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

       In  this	 program,  two	cubes are rotated between random orientations.
       Notice that although they have the same beginning and  ending  orienta-
       tions, 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 ob-
       ject 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  in-
       tended,	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

       BITMAP(3), END_OF_MAIN(3), MATRIX_f(3), QUAT(3),	acquire_bitmap(3), al-
       legro_error(3), allegro_init(3),	allegro_message(3), apply_matrix_f(3),
       blit(3),	 circle(3),  clear_keybuf(3),  clear_to_color(3),  create_bit-
       map(3), desktop_palette(3), destroy_bitmap(3), font(3),	get_camera_ma-
       trix_f(3),  get_rotation_matrix(3), get_rotation_matrix_f(3), get_rota-
       tion_quat(3),   install_keyboard(3),   keypressed(3),   line(3),	   ma-
       trix_mul_f(3),	palette_color(3),   persp_project_f(3),	 quat_interpo-
       late(3),	 quat_to_matrix(3),  readkey(3),  release_bitmap(3),  rest(3),
       screen(3), set_gfx_mode(3), set_palette(3), set_projection_viewport(3),

Allegro				 version 4.4.3			     exquat(3)


Want to link to this manual page? Use this URL:

home | help