quat
quat a b c d
QUAT(nged)
NAME
quat - get or set the view orientation as a quaternion
On this page
SYNOPSIS
DESCRIPTION
The quat command gets or sets the current view rotation as a unit quaternion with components ordered (a, b, c, d) — that is, (x, y, z, w) where (x, y, z) is the vector part and w is the scalar part.
-
No arguments: Returns the current view rotation matrix as a quaternion, formatted as four space-separated floating-point values with 12 significant digits:
a b c d. -
Four arguments
a b c d: Sets the view rotation from the given quaternion. Each component is provided as a separate argument. The quaternion is converted to a rotation matrix and the view is updated immediately.
The quat command is closely related to orient / orientation, which accepts the same quaternion but as either four separate values or a single quoted string. quat always uses four separate arguments.
To set the view by azimuth/elevation angles instead of a quaternion, use ae.
EXAMPLES
mged> quat
Returns the current view rotation as a quaternion, e.g. 0.5 -0.5 -0.5 0.5 for a typical isometric view. The four values are the x y z w components.
mged> quat 0.707107 0 0 0.707107
Sets the view orientation to a 90° rotation about the X axis — a top-down view. The quaternion (sin(45°), 0, 0, cos(45°)) encodes this rotation.
mged> quat 0 0 0 1
Sets the view to the identity quaternion — the default front-facing orientation with no rotation applied.
mged> set q [quat] mged> ae 35 25 mged> quat {*}$q
Saves the current quaternion, changes to a 35/25 azimuth-elevation view, then restores the original orientation using Tcl list expansion.
SEE ALSO
view(nged)
AUTHOR
BRL-CAD Team
BUG REPORTS
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org