VIEW2MODEL(nged)

convert view xyz to model coordinates (vec)

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… VIEW2MODEL(nged) β€” or: how to grab your viewβ†’model matrix

Ok bestie, welcome to the nged corner of BRL-CAD User Commands. This one's short, sweet, and honestly kind of iconic for how much it doesn't do. Let's get into it ✨


✨ NAME ✨

view2model β€” convert view xyz to model coordinates (vec) πŸ¦‹


✨ SYNOPSIS ✨

view2model

That's it. That's the whole mood. No flags, no args, no drama πŸ’…


✨ DESCRIPTION ✨

So here's the tea: view2model hands you back the current view-to-model transformation matrix (gv_view2model) as a 16-element space-separated floating-point string, all encoded up by bn_encode_mat. πŸŽ€

That matrix's whole job? It transforms points from normalized view space into model space β€” and model space here is measured in millimeters. No cap.

⚠️ Real talk: this command takes no arguments. It is a pure matrix accessor β€” it does not perform a point transformation. Not even a little. Don't come for it asking it to transform your point, because it will simply not 😭

If you actually want to convert an individual point from view space to model space with local-unit scaling, that's a whole different girlies situation β€” use v2m_point for normalized or view2model_lu for local units. 🫢

And the matrix you get back is the mathematical inverse of the model2view matrix. Together, those two define the current view orientation and zoom in BRL-CAD's view system. They're literally a duo, main character energy, inseparable πŸ”₯


✨ EXAMPLES ✨

Example 1 β€” grab the current view-to-model matrix 🌸

mged> view2model

This returns the 16-element view-to-model matrix, like for example:

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Which is what you get when the view is in the default front-facing orientation with no rotation β€” a nice lil identity moment ✨

Example 2 β€” capture the matrix for scripting 🧚

mged> set v2m [view2model] mged> mat4x3pnt $v2m "0 0 0"

(yes that's two mged> prompts squished on one line in the original β€” she's cozy like that, you got this πŸ’–)

So what's happening: you retrieve the current view-to-model matrix into v2m, then apply it to the view origin (0, 0, 0) via mat4x3pnt. The result? The model-space position of the view center. Chef's kiss πŸ‘‘


✨ AUTHOR ✨

BRL-CAD Team β€” legends, honestly πŸ†


✨ BUG REPORTS ✨

Found a bug or a problem? Don't suffer in silence, bestie β€” send electronic mail to devs@brlcad.org πŸ’Œ


and that's the whole page, you ate it up 🌈

sign-off era: this beauty comes to you from BRL-CAD, from the VIEW2MODEL(nged) manual page in the nged section β€” mwah, go transform something πŸ’œ

πŸ“¦ where this page comes from