ORIENT(nged)

set the view rotation from a quaternion

πŸ“… published 7.44.0, from nixpkgs unstable

✨ ORIENT(nged) ✨

okay so bestie, this is a page from the BRL-CAD User Commands manual and it's literally all about pointing your view exactly where you want it πŸ’…


πŸ’– NAME πŸ’–

orient, orientation β€” sets the view rotation straight from a quaternion, no cap πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

orient x y z w
orient "x y z w"

🌸 DESCRIPTION 🌸

so the orient command (and yes, it also answers to orientation, same girl different name 🫢) sets the current view's rotation matrix directly from a unit quaternion. iconic. no middleman, no drama.

the quaternion components go in this order: (x, y, z, w) β€” where (x, y, z) is the vector part and w is the scalar part. write that down, it matters πŸ‘‘

you can feed her the quaternion in two forms:

  • four separate arguments β€” orient x y z w, where each component is its own separate number (one number per slot, keep them in order bestie)
  • a single quoted string β€” orient "x y z w", where all four components are space-separated inside one argument, and it gets decoded by bn_decode_quat ✨

under the hood (iykyk), the quaternion gets converted into a 4Γ—4 rotation matrix using quat_quat2mat, then stored in the view's gv_rotation field. after that the view gets refreshed via bv_update. that's the whole pipeline, she's efficient πŸ’€

🚨 real talk: this command sets the absolute view orientation. it does not apply a relative rotation. so if you're trying to rotate the view by some angle around an axis, that's a whole different vibe β€” use ae (azimuth/elevation) instead, bestie 🌈

⭐ EXAMPLES ⭐

πŸŽ€ Example 1. Set the view to look straight down the -Z axis (top view)

mged> orient 0.707107 0 0 0.707107

this sets the view orientation to a 90Β° rotation about the X axis (it's the unit quaternion for a top-down view, slay πŸ‘‘). the w scalar is approximately cos(45Β°) and the X vector component is sin(45Β°). math ate, honestly.

πŸŽ€ Example 2. Use the orientation alias

mged> orientation 0 0 0 1

this sets the view to the identity quaternion β€” the default front-facing orientation with zero rotation. cute and simple πŸ¦‹ and yes, orient and orientation are equivalent, they're the same command, fr fr.

πŸŽ€ Example 3. Set orientation from a quoted quaternion string

mged> orient "0 0 1 0"

this sets the view using a 180Β° rotation about the Z axis (quaternion (0, 0, 1, 0)). quoted-string form, we love to see it πŸ’–


🌟 AUTHOR 🌟

BRL-CAD Team β€” the actual masterminds behind all of this 🫢


πŸ’Œ BUG REPORTS πŸ’Œ

if you find a bug or hit a problem, don't suffer in silence bestie β€” send electronic mail to devs@brlcad.org and tell them all about it πŸ“§


and that's the whole page, mwah πŸ’… this little writeup is from the BRL-CAD source, manual page ORIENT(nged) β€” go point your view somewhere gorgeous ✨

πŸ“¦ where this page comes from