quat_mul(3)

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

πŸ’– quat_mul β€” the Allegro manual, but make it cute πŸ’–

okay bestie, welcome to the quat_mul(3) page from the Allegro game programming library manual. yes, the whole thing. sit down, hydrate, let's go 🫢


✨ NAME ✨

quat_mul β€” multiplies two quaternions. and yeah, she's part of the Allegro game programming library, so she's living in a whole ecosystem of gamer math 🌸


🌈 SYNOPSIS 🌈

so first you gotta let her in the building:

#include <allegro.h>

and here's the actual signature, character for character, no notes:

void quat_mul(const QUAT *p, const QUAT *q, QUAT *out);

three pointers. two in, one out. it's giving passing notes in class but the notes are quaternions πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. quat_mul multiplies two quaternions together and drops the result into out. that's the whole job. she's focused, she's employed, she's iconic πŸ‘‘

now the part that actually matters: the resulting quaternion has the same effect as the combination of p and q. in math-speak, when you apply it to a point:

(point * out) = ((point * p) * q)

so out isn't just some new quaternion, she's the combined one β€” p first, then q, stacked together. and lowkey the slay of this function is that you can chain any number of rotations this way. like, stack them, concatenate them, keep going, the party never ends πŸŽ‰

🚨 okay but here's the warning, and I need you to actually read it: quaternion multiplication is not commutative. that means: c quat_mul(p, q) != quat_mul(q, p) order matters, fr fr. flipping them gives you a different answer. so don't go swapping p and q around and expecting the same vibe, because you will simply not get it 😭

and that's the page, bestie πŸ’œ this was the quat_mul(3) entry out of the Allegro manual, version 4.4.3. mwah, go multiply responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from