GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
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 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.

BITMAP(3), END_OF_MAIN(3), MATRIX_f(3), QUAT(3), acquire_bitmap(3), allegro_error(3), allegro_init(3), allegro_message(3), apply_matrix_f(3), blit(3), circle(3), clear_keybuf(3), clear_to_color(3), create_bitmap(3), desktop_palette(3), destroy_bitmap(3), font(3), get_camera_matrix_f(3), get_rotation_matrix(3), get_rotation_matrix_f(3), get_rotation_quat(3), install_keyboard(3), keypressed(3), line(3), matrix_mul_f(3), palette_color(3), persp_project_f(3), quat_interpolate(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), textout_ex(3)
version 4.4.3 Allegro

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.