MAT4X3PNT(nged)
transform a 3D point by a 4x4 matrix
π 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 bybn_encode_mator by commands likemat_ae,mat_mul)."x y z"β the 3D point you wanna transform, given as a space-separated string that gets decoded bybn_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
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms