MODEL2GRID_LU(nged)

convert model xyz to grid coordinates (local units)

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… MODEL2GRID_LU (nged) πŸ’…

okay bestie, so this is a page from the BRL-CAD User Commands manual β€” yes, that BRL-CAD β€” and today's main character is model2grid_lu. she's the one who translates your 3D model vibes into 2D grid vibes. let's get into it 🫢


✨ NAME ✨

model2grid_lu β€” convert model xyz to grid coordinates (local units)

like, literally what it says on the tin πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

model2grid_lu x y z

three args, no more no less. slay.


🌸 DESCRIPTION 🌸

okay so here's the lore πŸ’« the model2grid_lu command converts a 3D model-space point (in local units) into a 2D grid offset (also in local units). the three arguments x y z are the model-space coordinates in local units.

and what do you get back? a 2-element u v string representing the horizontal and vertical grid displacement from the projected model origin. that's the whole tea β˜• and here's the crucial bit β€” only the X and Y components of the view-projected difference are returned, not Z. Z is not invited to this party πŸ™ˆ

now for the behind-the-scenes, because the pipeline is kinda iconic ngl:

  • it converts the input point to base units
  • it projects it and the model origin into view space
  • it subtracts to get the view-space displacement
  • then it scales by gv_scale and the unit conversion factor to get the final grid-space offset in local units

that's the whole glow-up from model space to grid space, step by step πŸ”₯

and if you ever need to go backwards? the inverse operation is grid2model_lu. they're giving matched set energy πŸ‘‘


πŸŽ€ EXAMPLES πŸŽ€

Example 1. Convert a model point to a 2D grid offset

mged> model2grid_lu 100 50 0

Returns a 2-element u v grid offset in local units representing the screen-space position of model point (100, 50, 0) relative to the projected model origin. like, it literally tells you where that point lands on screen πŸ’…βœ¨


πŸ’œ AUTHOR πŸ’œ

BRL-CAD Team β€” the collective. the squad. the ones who built all this 🫢


🌈 BUG REPORTS 🌈

found a bug? a problem? something acting sus? πŸ“© reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org β€” they genuinely want to hear it, no cap.


ok that's the whole page bestie, every flag-free, option-free, argument-having detail of it πŸ’€ she's a short one but she works.

mwah πŸ’‹ this has been MODEL2GRID_LU(nged) from BRL-CAD β€” go forth and project your points responsibly, bestie πŸŒŸπŸ“πŸ§š

πŸ“¦ where this page comes from