MAT_MUL(nged)

multiply two 4x4 matrices

๐Ÿ“… published 7.44.0, from nixpkgs unstable

๐Ÿ’… mat_mul โ€” the manual page, but make it make sense

okay so this is mat_mul, a command from the nged manual (BRL-CAD User Commands, bestie โ€” that's the crew we're running with) โœจ


โœจ NAME โœจ

mat_mul โ€” multiply two 4x4 matrices ๐Ÿงฎ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

mat_mul matA matB

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So the mat_mul command multiplies two 4x4 homogeneous transformation matrices together, and it computes:

result = matA * matB

Both matA and matB must be given as 16-element space-separated floating-point strings โ€” literally the format that bn_encode_mat produces. And the result? Comes back in that exact same 16-element encoded format. no cap, same vibe in, same vibe out ๐Ÿซถ

The operation itself is the standard 4x4 matrix product. Lowkey important: this command is the GED wrapper for bn_mat_mul, so it's out here fronting for the real one.

โš ๏ธ Careful bestie โ€” matrix multiplication is not commutative. The order of operands matters. Flip them and you get a different answer, fr fr. ๐Ÿ’€

๐ŸŒธ EXAMPLES ๐ŸŒธ

Example 1. Multiply two identity matrices ๐Ÿ‘‘

mged> mat_mul "1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1" "1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1"

Returns the identity matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1, because the product of two identity matrices is the identity. iconic behaviour honestly โœจ

Example 2. Chain two rotation matrices ๐ŸŒ€

mged> set m1 [mat_ae 45 0]
mged> set m2 [mat_ae 0 30]
mged> mat_mul $m1 $m2

This composes the azimuth rotation matrix $m1 with the elevation rotation matrix $m2, and returns their combined transformation. it's giving collaboration ๐Ÿ’…


๐Ÿฆ‹ AUTHOR ๐Ÿฆ‹

BRL-CAD Team ๐Ÿ’œ


๐Ÿ“ BUG REPORTS ๐Ÿ“

If you find a bug or a problem, pls submit it via electronic mail to devs@brlcad.org โ€” they genuinely want to hear from you, bestie ๐Ÿ™ˆ


and that's the whole page!! brought to you by BRL-CAD, filed under MAT_MUL(nged) โ€” go forth and multiply (matrices) ๐Ÿ”ฅ๐ŸŒˆ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from