exquat(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’« exquat β€” the Allegro manual, bestie edition ✨

okay so this is exquat(3), straight out of the Allegro manual, and it's basically a whole vibe check on 3D rotations. buckle up πŸŽ€


🌸 NAME 🌸

exquat β€” a comparison between Euler angles and quaternions. it's part of the Allegro game programming library. yes, that Allegro. the icon. πŸ‘‘


✨ SYNOPSIS ✨

#include <allegro.h>

Example exquat

like, that's it. that's the whole entrance. she's lowkey minimal πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first things first, bestie: Euler angles are genuinely convenient for storing and creating 3D orientations. they're giving easy, they're giving approachable. but this program is here to demonstrate that they are not good when interpolating between two different orientations 😭 the problem gets solved by using Allegro's quaternion operations. periodt.

so in this program, two cubes are rotated between random orientations. and here's the tea 🍡 β€” notice that although they have the same beginning and ending orientations, they do not follow the same path between orientations. same start, same end, completely different journey. it's giving two besties leaving the same party and taking wildly different routes home.

Cube number one 🧊 is being rotated by directly incrementing or decrementing the Euler angles from the starting point to the ending point. and like, that's an intuitive notion, fr fr, 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 β€” so like, she gets there β€” but she 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. not the main character energy we're going for, honestly πŸ™ˆ

Cube number two 🧊 is animated using quaternions. and this results in a much more pleasing animation because the cube turns around a single axis of rotation. clean. smooth. slay. the way that quaternions just work? obsessed. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

all the girlies this page is linked to πŸ’– every single one, no skips:


and that's the whole page, bestie 🫢 this one's from Allegro, version 4.4.3, and it's filed under exquat(3). go rotate something responsibly βœ¨πŸŽ€πŸ’œ

πŸ“¦ where this page comes from