get_rotation_matrix(3alleg4)
π« get_rotation_matrix β the Allegro manual, bestie edition π«
okay so this is a page straight out of the Allegro manual, and today we're rotating things in 3D. sit down, grab a snack π
β¨ NAME β¨
get_rotation_matrix, get_rotation_matrix_f β they build you X, Y and Z rotation matrices. it's giving Allegro game programming library, and it's giving iconic. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
void get_rotation_matrix(MATRIX *m, fixed x, fixed y, fixed z);
void get_rotation_matrix_f(MATRIX_f *m, float x, float y, float z);
π¦ DESCRIPTION π¦
So what this does: it constructs a transformation matrix that rotates points around all three axes by the amounts you pass in. and the amounts are in binary, 256 degrees to a circle format β yes bestie, 256, not 360, that's just how we do it here. π
Now for the direction of rotation, and this is the part everyone gets confused about, so listen up π«Ά. You find it with the right-hand rule: point the dumb of your right hand towards the origin along the axis of rotation, and your fingers will curl in the positive direction of rotation.
E.g. if you rotate around the y axis and look at the scene from above, a positive angle will rotate in clockwise direction. like, actually clockwise, from that viewpoint. no cap. π₯
lowkey a vibe check on your spatial reasoning, but you got this. β¨
π SEE ALSO π
apply_matrix(3alleg4)get_transformation_matrix(3alleg4)get_vector_rotation_matrix(3alleg4)get_x_rotate_matrix(3alleg4)get_y_rotate_matrix(3alleg4)get_z_rotate_matrix(3alleg4)get_align_matrix(3alleg4)ex12bit(3alleg4)exquat(3alleg4)exstars(3alleg4)
go read those too, they're all part of the rotation-adjacent friend group π
and that's the whole page! this was Allegro, version 4.4.3, and honestly? she ate. π go rotate something, bestie. πβπ
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms