MAT4X3PNT(nged)

transform a 3D point by a 4x4 matrix

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… MAT4X3PNT (nged) β€” or, "how to yeet a point through a matrix"

okay bestie, so this is a page from the BRL-CAD user commands manual, nged edition, and it's genuinely one of the cutest little commands out there. no cap. let's get into it ✨


✨ NAME ✨

mat4x3pnt β€” transform a 3D point by a 4x4 matrix. that's it. that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

mat4x3pnt matrix "x y z"

πŸ¦‹ DESCRIPTION πŸ¦‹

so the mat4x3pnt command takes a 4x4 homogeneous transformation matrix and applies it to a 3D point, handing you back the resulting transformed point. it's giving "glow-up via linear algebra" honestly πŸ’…

under the hood it uses the MAT4X3PNT macro, which does the full 4x4 matrix multiplication but discards the homogeneous w component β€” so what comes out is a 3D Cartesian output point. like, the w was there for the math and then it just... left. iconic behavior 🫢

πŸ“ Arguments

  • matrix β€” a 4x4 transformation matrix, given as a 16-element space-separated string (the kind of thing produced by bn_encode_mat or by commands like mat_ae, mat_mul).
  • "x y z" β€” the 3D point you wanna transform, given as a space-separated string that gets decoded by bn_decode_vect.

the result comes back as a space-separated 3-element vector string. clean, simple, slay ✨


πŸ”₯ EXAMPLES πŸ”₯

πŸ’– Example 1. Transform the origin by an identity matrix

mged> mat4x3pnt "1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1" "10 20 30"

10 20 30

the identity matrix leaves the point unchanged. literally does nothing and we respect it for that πŸ’€ ngl the identity matrix is the "no thoughts head empty" of matrices and it's still valid 🌈

⭐ Example 2. Apply a rotation matrix to a point

mged> set rot [mat_ae 90 0]
mged> mat4x3pnt $rot "100 0 0"

this rotates the point (100, 0, 0) by 90Β° in azimuth, which lands it right on the Y axis. bonkers. obsessed. πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team


😭 BUG REPORTS 😭

if you find a bug or a problem, pls don't suffer in silence β€” report it by electronic mail to devs@brlcad.org. the devs wanna know, fr fr πŸ’œ


also, like, a little reminder from me to you: this is a manual page, so everything above is the documented behavior β€” don't come for me if your matrix is weird πŸŽ€

and that's the whole page, bestie!! brought to you by BRL-CAD (the source) and this very page, MAT4X3PNT(nged) β€” go transform something gorgeous with it πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from