EDIT_ROTATE(nged)
Rotate one or more objects in the database.
π NAME π
okay so this is EDIT ROTATE(nged), straight from BRL-CAD User Commands, manual section nged β and it's the page for edit rotate, aka edit rot, and its whole job is literally rotating one or more objects in the database. π
β¨
The alias rot is equivalent to rotate. periodt.
β¨ SYNOPSIS β¨
edit [options] geometry rotate [X_DEG [Y_DEG [Z_DEG]]]
edit [options] geometry rotate [-x|-y|-z] DEGREES
edit [options] geometry rotate [-R]
[-k AXIS_FROM_POS|AXIS_FROM_OBJ]
(-a|-r) AXIS_TO_POS|AXIS_TO_OBJ
[-c CENTER_POS|CENTER_OBJ]
[-O ANGLE_ORIGIN_POS|ANGLE_ORIGIN_OBJ]
(-d DEGREES | DEGREES)
where AXIS_FROM_POS, AXIS_TO_POS, CENTER_POS, and ANGLE_ORIGIN_POS each accept one to three scalar values:
x | x y | x y z
and AXIS_FROM_OBJ, AXIS_TO_OBJ, CENTER_OBJ, ANGLE_ORIGIN_OBJ are names of existing database objects whose bounding-box centers are used. π«Ά
π DESCRIPTION π
Used to rotate one or more instances of primitive or combination objects. OBJECTs rotate around CENTER by ANGLE. In axis mode, the rotation is further constrained to a specific AXIS direction. π₯
edit rotate operates in one of two modes:
- Euler mode (default, no
-aor-roption) β Angles are supplied directly as one, two, or three degree values. One angle is a Z-axis rotation; two angles are X then Y rotations; three angles are X, Y, Z rotations applied in sequence. The-x,-y, and-zflags restrict the single positional angle to the named axis only. - Axis mode (triggered by
-aor-r) β An explicit rotation axis is specified as the direction vector fromAXIS_FROMtoAXIS_TO. The rotation angle may be supplied by-d, as a trailing positional value, or derived implicitly from a secondANGLE_FROMβANGLE_TOreference pair (see the-koption below).CENTERandANGLE_ORIGINcontrol the pivot location. Axis mode is useful for rotating around an arbitrary axis defined by two scene objects, for example:rotate -k sphere1 -a sphere2 -d 90 cuberotates cube 90Β° around the axis running from sphere1 to sphere2. iconic. π
Rotation center defaults to the bounding-box center of the target object. A rotation of exactly 180Β° without specifying an axis (e.g., rotate 180) is rejected as ambiguous because the rotation direction is undefined. Supply an explicit axis by using -z 180 to force the Z-axis, or use axis mode (-k / -a) to supply a direction vector. π no cap, it needs to know which way to go.
β οΈ 180Β° vibe check: exactly 180Β° with no explicit axis = ambiguous and rejected. Use-z 180for the Z-axis, or axis mode via-k/-a. π
The alias rot is equivalent to rotate.
Global options (-S, -f, -F, -i) are described in edit(nged). πΈ
π OPTIONS π
-Rβ Interpret all angle values as radians instead of degrees.-k AXIS_FROM_POS | AXIS_FROM_OBJβ SetAXIS_FROM, the tail of the rotation-axis direction vector. Accepts up to three scalar values (broadcast to a 3-vector if fewer are given) or an object name whose bounding-box center is used. Defaults to the origin(0, 0, 0)when absent.- Two-pair form for implicit angle: A second
-k/-apair may be given after the first to supply anANGLE_FROMβANGLE_TOreference. When no explicit-dor positional angle is provided, the rotation angle is derived by projecting both reference points onto the plane perpendicular to the rotation axis through the pivot center, and computing the signed arc between the projected vectors. For example,rotate -k 0 0 0 -a 0 0 1 -k 1 0 0 -a 0 1 0 cuberotates cube 90Β° around Z (the XβY arc in the XY-plane). π - Single-pair implicit angle: When only one
-k/-apair is given and no explicit angle is supplied,AXIS_FROMandAXIS_TOdouble as the angle reference points. The commandrotate -k sphere1 -a sphere2 cubederives the rotation angle from the arc that sphere1 β sphere2 subtends around the cube's center, projected onto the plane perpendicular to the sphere1β*sphere2* axis. Both reference points must lie off the rotation axis (i.e., not at the center) for the projection to be non-degenerate. π§
- Two-pair form for implicit angle: A second
-a AXIS_TO_POS | AXIS_TO_OBJβ SetAXIS_TOas an absolute position, triggering axis mode. Accepts coordinates or an object name.-r AXIS_TO_POSβ SetAXIS_TOas a position relative toAXIS_FROM, triggering axis mode. Not available with an object name.-d DEGREESβ Specify the rotation angle as a single scalar degree value (radians if-Ris also set). In axis mode, this is optional when a second-k/-aangle-reference pair is given (the angle is then computed implicitly). In Euler mode,-dsupplies the single angle that would otherwise come from the first positional argument.-c CENTER_POS | CENTER_OBJ | .β Set the pivot center of the rotation. Accepts coordinates, an object name whose keypoint is used, or the batch marker.to use each target object's own keypoint as the pivot center. Defaults to the bounding-box center of the target object. π―-O ANGLE_ORIGIN_POS | ANGLE_ORIGIN_OBJβ Sets the angle-measurement origin. Defaults toCENTER. Accepts coordinates or an object name. In the original design this defined the "zero" reference for the angle-from/angle-to reference model; in the current implementation it serves as an alternative way to specify the rotation pivot.-nβ Accepted for compatibility with the original design but has minimal effect in the current implementation. Intended to cause a following*_OBJECTto use its natural origin rather than its bounding-box center.-oβ Accepted for compatibility; reserved for the axis-override feature from the original design.-x,-y,-zβ Restrict the rotation to the specified axis (Euler mode). The angle value comes from the next positional argument. Cannot be combined with axis mode (-a/-r). β¨
β¨ EXAMPLES β¨
Okay bestie, grab a snack π β these examples all use a cube centered at the origin that intersects the +x/+y axes at its corners. Two helper spheres sit at the q1 and q4 corners to show off axis-mode rotation. Here's the little map so you can follow along:
+y cube sphere1
___|___ / /
|q2 | q1| o
-x __|___|___|___________+x
|q3 | q4| o
|___|___| /
| sphere2
-y
πΈ Example 1.
Rotate the cube 45Β° counterclockwise on the z-axis (corner in q1 β +y axis):
mged> edit cube rotate -z 45
Equivalent forms using other supported syntax:
mged> edit cube rotate 0 0 45
mged> edit cube rotate -c 0 0 0 0 0 45
mged> edit cube rotate -c cube 0 0 45
mged> edit cube rotate -c . 0 0 45
Return it to the last position (clockwise by 45Β°):
mged> edit cube rotate -z -45
Return counterclockwise by 315Β°:
mged> edit cube rotate -z 315
π¦ Example 2.
Rotate the cube so that the forward edge rolls toward the viewer π«Ά
A single positional angle value rotates around the Z-axis:
mged> edit cube rotate 90
The -x flag restricts to the X-axis, rolling toward the viewer (assuming +x is "forward"):
mged> edit cube rotate -x 90
π Example 3.
Rotate the cube so that the q3 corner points directly toward the viewer:
Two positional angles apply as an X rotation then a Y rotation:
mged> edit cube rotate -45 45
π Example 4.
Rotate the cube around an explicit axis β axis from sphere1 to sphere2
In axis mode, -k and -a define the rotation axis; -d supplies the angle. Here sphere1 and sphere2 are database objects whose bounding-box centers define the axis direction:
mged> edit cube rotate -k sphere1 -a sphere2 -d 90
Rotate back the same way:
mged> edit cube rotate -k sphere1 -a sphere2 -d -90
Or equivalently, reverse the axis direction:
mged> edit cube rotate -k sphere2 -a sphere1 -d 90
Use explicit coordinates when the axis is known:
mged> edit cube rotate -k 0 0 0 -a 0 0 1 -d 45
Implicit angle from reference arc: omit -d and instead supply a second -k/-a pair to define an ANGLE_FROM β ANGLE_TO reference. The rotation angle is computed as the signed arc between those two points projected onto the plane perpendicular to the rotation axis. This is the "rotate by as much as sphere1 β sphere2 sweeps" idiom:
mged> edit cube rotate -k sphere1 -a sphere2 cube
This single-pair form uses sphere1 and sphere2 as both axis and angle references simultaneously. For a cleaner two-pair form where the axis and angle references are independent, supply a dedicated angle pair:
mged> edit cube rotate -k 0 0 0 -a 0 0 1 -k sphere1 -a sphere2 cube
Here the first pair sets the +Z axis and the second pair provides the projected reference arc to determine the angle. Iconic behavior tbh π
π§ Example 5.
Rotate the cube around its own center along the z-axis, constrained to an explicit axis
Using the default center (cube's own keypoint) while specifying the z-axis direction explicitly:
mged> edit cube rotate -k 0 0 0 -a 0 0 1 -c cube -d 45
Using a positional angle instead of -d:
mged> edit cube rotate -k 0 0 0 -a 0 0 1 -c cube 45
Center on cube and keep center fixed while rotating:
mged> edit cube rotate -c cube -z 45
π Example 6.
Rotate the cube 180Β° around a point offset from its own center
Specify the pivot as a world-space coordinate (e.g., 25 units in the +x direction from the origin):
mged> edit cube rotate -c 25 0 0 -d 180
Using a Z-axis axis mode:
mged> edit cube rotate -k 0 0 0 -a 0 0 1 -c 25 0 0 -d 180
π Example 7.
Rotate the cube to face a specific direction in 3-D using an axis defined by two points
When you want to rotate the cube so that a face that currently points toward +Z instead points toward sphere1, you need to:
- Identify the current face direction (here
+Z, so a point on that direction is0 0 1): setAXIS_FROM = 0 0 1. - Use
sphere1asAXIS_TO(the target direction). - Determine the required rotation angle. If
sphere1lies in the XY-plane at a 45Β° bearing from the cube, the required angle is 90Β°.
mged> edit cube rotate -k 0 0 1 -a sphere1 -d 90
For an arbitrary target direction, the required axis is the cross-product of the current "forward" vector and the target vector, and the angle is their arc-cosine. Compute those values externally and supply them explicitly:
mged> edit cube rotate -k AX AY AZ -a TX TY TZ -d COMPUTED_DEGREES
π Example 8.
Rotate cube around an axis from sphere2 to sphere1, with and without custom center
The axis is the direction vector sphere2 β sphere1. The rotation center is set explicitly to sphere2 so that sphere2 remains fixed:
mged> edit cube rotate -k sphere2 -a sphere1 -c sphere2 -d 180
Place cube "in front of" the spheres by rotating 90Β° around the same axis, pivoting on sphere1:
mged> edit cube rotate -k sphere2 -a sphere1 -c sphere1 -d 90
π Example 9.
Rotate a sphere 180Β° around the axis from its own center to the cube
The sphere's own center is the AXIS_FROM, the cube's center is AXIS_TO. Pivoting on the sphere keeps the sphere's center stationary while its orientation flips. Using -c<|place_holder_mm_span_0442|>... no wait, using -c . pivots each sphere on its own center:
mged> edit sphere1 rotate -k sphere1 -a cube -c . -d 180
mged> edit sphere2 rotate -k sphere2 -a cube -c . -d 180
Equivalently, using explicit -c with the sphere's own name:
mged> edit sphere1 rotate -k sphere1 -a cube -c sphere1 -d 180
mged> edit sphere2 rotate -k sphere2 -a cube -c sphere2 -d 180
β Example 10.
Rotate two spheres 180Β° around the axis joining them so they swap positions
The axis runs from sphere1 to sphere2. The pivot should lie on the axis β use the midpoint if sphere1 and sphere2 are at known positions (say sphere1 at (1, 1, 0) and sphere2 at (1, -1, 0), midpoint at (1, 0, 0)):
mged> edit sphere1 rotate -k sphere1 -a sphere2 -c 1 0 0 -d 180
mged> edit sphere2 rotate -k sphere1 -a sphere2 -c 1 0 0 -d 180
If the midpoint coordinates are not known in advance, compute them from the sphere positions before issuing the command. No guessing, bestie π
π₯ Example 11.
Rotate by Ο/2 radians around the Z-axis
mged> edit ell.s rotate -R 0 0 1.5707963
Or using the -z flag in Euler mode:
mged> edit ell.s rotate -R -z 1.5707963
πΈ Example 12.
Apply cumulative Euler rotations in multiple steps
Each invocation is applied to the current state of the geometry, so three separate rotations compose:
mged> edit ell.s rotate 30 0 0
mged> edit ell.s rotate 0 45 0
mged> edit ell.s rotate 0 0 60
Stack 'em like bracelets, it just works β¨
π Example 13.
Use the intermediate buffer: rotate tentatively, then revert if unsatisfied
mged> edit cube checkpoint
mged> edit -i cube rotate -z 45
mged> edit cube revert
Checkpoint, try the fit, then change your mind with zero regrets. Main character energy only π
π SEE ALSO π
edit(nged)edit translate(nged)edit scale(nged)orot(nged)arot(nged)
Go read those too, they're the whole friend group π«Ά
π AUTHOR π
BRL-CAD Team β legends, honestly.
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org
Fr fr, if something's cursed, tell the devs β they genuinely wanna know π
And that's the whole page, bestie! π This one's from the BRL-CAD docs, page EDIT ROTATE(nged) β the footer's got the BRL-CAD source/version stamp and the EDIT ROTATE(nged) page name on it (no date on this one, just the two). Now go rotate something, you absolute icon ππ
π¦ 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