## table of contents

exquat(3alleg4) | Allegro manual | exquat(3alleg4) |

# 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**(3alleg4), **END_OF_MAIN**(3alleg4),
**MATRIX_f**(3alleg4), **QUAT**(3alleg4),
**acquire_bitmap**(3alleg4), **allegro_error**(3alleg4),
**allegro_init**(3alleg4), **allegro_message**(3alleg4),
**apply_matrix_f**(3alleg4), **blit**(3alleg4),
**circle**(3alleg4), **clear_keybuf**(3alleg4),
**clear_to_color**(3alleg4), **create_bitmap**(3alleg4),
**desktop_palette**(3alleg4), **destroy_bitmap**(3alleg4),
**font**(3alleg4), **get_camera_matrix_f**(3alleg4),
**get_rotation_matrix**(3alleg4), **get_rotation_matrix_f**(3alleg4),
**get_rotation_quat**(3alleg4), **install_keyboard**(3alleg4),
**keypressed**(3alleg4), **line**(3alleg4),
**matrix_mul_f**(3alleg4), **palette_color**(3alleg4),
**persp_project_f**(3alleg4), **quat_interpolate**(3alleg4),
**quat_to_matrix**(3alleg4), **readkey**(3alleg4),
**release_bitmap**(3alleg4), **rest**(3alleg4),
**screen**(3alleg4), **set_gfx_mode**(3alleg4),
**set_palette**(3alleg4), **set_projection_viewport**(3alleg4),
**textout_ex**(3alleg4)

version 4.4.3 | Allegro |