MODEL2VIEW(nged)

convert model coordinates to view (screen) coordinates

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… MODEL2VIEW (nged) β€” bestie's guide to model β†’ view coords ✨

okay so this is a nged command, and it's genuinely iconic once you get the vibe β€” it converts model coordinates to view (screen) coordinates. two whole personalities depending on how you call it, iykyk πŸŽ€


🌸 SYNOPSIS

model2view
model2view x y z

πŸ¦‹ DESCRIPTION

model2view has two distinct behaviors depending on whether you pass arguments or not. not me loving a command with range πŸ’…

  • No arguments: it hands you back the current model-to-view transformation matrix (gv_model2view) as a 16-element space-separated floating-point string (encoded by bn_encode_mat). this is the raw 4Γ—4 matrix that BRL-CAD's view system uses to transform geometry from model space into normalized view space. like, the whole plot. 🌈
  • Three arguments x y z: treats those args as a model-space point in millimeters (not local units!) and transforms it through the gv_model2view matrix using MAT4X3PNT, giving you the resulting 3-element normalized view-space vector. so yeah β€” the input is expected in base (mm) units, not local units. πŸ™ˆ don't say I didn't warn you.

the matrix form is the mathematical inverse of the view2model matrix. cute, symmetric, obsessed.

if you actually want point conversion with local-unit scaling applied (which is the more common case for interactive use), go use model2view_lu or m2v_point instead β€” they're the main characters for that job 🫢

✨ EXAMPLES

🌟 Example 1. Retrieve the current model-to-view matrix

mged> model2view

Returns the 16-element gv_model2view matrix as a space-separated string, reflecting the current view rotation and zoom. lowkey a little snapshot of your viewport's whole soul πŸ’–

🌟 Example 2. Transform a model point to view space (in mm)

mged> model2view 0 0 0
0 0 0

Transforms the model origin (in mm) into normalized view space, and returns the view-space position of the model origin. yes that's 0 0 0 in and 0 0 0 out here, no cap 😭

🌟 Example 3. Capture matrix for use with mat4x3pnt

mged> set m2v [model2view] mged> mat4x3pnt $m2v "25.4 0 0"

Retrieves the model-to-view matrix and manually applies it to the model point (25.4 mm = 1 inch along X), yielding the normalized view-space position of that point. grab the matrix, do the math yourself, main character energy fr fr πŸ”₯


πŸ‘‘ AUTHOR

BRL-CAD Team β€” legends, every one of them 🌸


πŸ’€ BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org β€” they genuinely want to hear it, so spill πŸ“


okay that's the whole page, mwah πŸ’œ this one comes to you straight from the BRL-CAD manual (the MODEL2VIEW (nged) page, obvs) β€” the software's version and date live in that footer, so go check the source if you need the exact stamp ✨ slay, go convert some coordinates πŸ¦‹

πŸ“¦ where this page comes from