VIEW2MODEL(nged)
convert view xyz to model coordinates (vec)
π 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
- 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