matrix_mul(3)
β¨ matrix_mul(3) β¨
okay bestie, welcome to the Allegro manual, and specifically to the part where we talk about matrix_mul and matrix_mul_f π these two are the matrix-gluing girlies of the Allegro game programming library, and they are literally here to multiply two matrices together. no cap.
π NAME π
matrix_mul, matrix_mul_f β Multiplies two matrices. Allegro game programming library.
like... that's the whole vibe. multiply. matrices. slay. π
π¦ SYNOPSIS π¦
#include <allegro.h>
void matrix_mul(const MATRIX *m1, const MATRIX *m2, MATRIX *out);
void matrix_mul_f(const MATRIX_f *m1, const MATRIX_f *m2, MATRIX_f *out);
so you pull in <allegro.h> and boom, two icons are available: one for the regular integer-ish MATRIX girlies and one with the _f suffix for the float MATRIX_f girlies πΈ both take m1 and m2 in, and both drop the answer into out. periodt.
π« DESCRIPTION π«
okay so here's the tea β these functions multiply two matrices, and the result goes into out.
heads up bestie:outmay be a duplicate of one of the input matrices, but it is faster when the inputs and output are all different. so like, it works if you overlap them, but it's giving "slow queen energy" if you do π keepm1,m2andoutall separate if you want the speed.
the resulting matrix will have the same effect as the combination of m1 and m2 β meaning when it's applied to a point p:
(p * out) = ((p * m1) * m2)
iconic. so out is literally m1 then m2, stacked into one transformation. and the way that any number of transformations can be concatenated in this way?? obsessed. you can just keep chaining them. π
β οΈ IMPORTANT CAVEAT β οΈ matrix multiplication is not commutative, ie. c matrix_mul(m1, m2) != matrix_mul(m2, m1) so do NOT swap your arguments and expect the same result. order matters, fr fr. flip them and you get a whole different transformation, no cap. π
π SEE ALSO π
go read those next bestie, they're part of the same friend group π«Ά
and that's the whole page!! this was brought to you by the Allegro girlies, version 4.4.3 β¨ stay multiplying, stay non-commutative, and remember: out can overlap but it's faster when it doesn't π bye babes!! ππ¦πΈ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms