MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Rotation3D, MatrixRotation3D ?

  • To: mathgroup at
  • Subject: [mg30400] RE: [mg30388] Rotation3D, MatrixRotation3D ?
  • From: "David Park" <djmp at>
  • Date: Wed, 15 Aug 2001 01:04:06 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


If you have Mathematica Version 4, I may be able to help you.

My Mathematica friend, Rip Pelletier, and I have been studying rotations
using Jack B. Kuipers` book "Quaternions and Rotation Sequences". I have
been preparing a set of tutorials which basically help us to understand
rotations by explaining it as clearly as possible. They are still somewhat
of a work in progress, but I am far enough along to be able to attack the
problems that you have posed. I am also working on a set graphics routines
which illustrate rotation sequences and help to visualize the various

We would be glad to share these with you if you wish. They do require
Mathematica Version 4 and they also use my DrawingPaper and DrawingCube
packages from my web site. They also use two packages
Geometry`ExtendRotations and Geometry`RotationGraphics. You would have to
install these packages in your AddOns/ExtraPackages folders.

Here are some of the usage messages for the routines that are in the


SetRotationMatrices[alibi|alias] will set the 3D axis rotation matrices \
according to the alibi or alias form. The current setting is saved in the \
variable RotationMatrixForm. The alibi form matrices will rotate a vector by
the right hand rule. The alias form matrices will rotate the coordinate
frame \
by a right hand rule.

Rx[\[Theta]] is a 3D rotation matrix for rotation about the x axis.
Ry[\[Theta]] is a 3D rotation matrix for rotation about the y axis.
Rz[\[Theta]] is a 3D rotation matrix for rotation about the z axis.
Rot[\[Theta]] is a 2D rotation matrix for rotation about the supposed z

RotationAxisAndAngle[rotationmatrix] will generate the axis of rotation and
the associated rotation angle in radians for a 3 x 3 rotation matrix. An \
equally valid answer is obtained by reversing the signs of both the angle
and \
the axis vector.

EulerAngles[matrix, seqstring, form:alibi] will return the Euler angles \
corresponding to a sequence of axes rotations specified by seqstring. An
axes \
sequence of "XYZ" means rotation around the X axes by \[Psi], followed by \
rotation about the Y axis by \[Theta], followed by rotation about the Z axis
by \[Phi]. The rotations angles {\[Psi],\[Theta],\[Phi]} are returned. For \
sequences of the form ABA, 0 \[LessEqual] \[Theta] \[LessEqual] \[Pi]. For \
sequences of the form ABC, -\[Pi]/2 \[LessEqual] \[Theta] \[LessEqual] \
\[Pi]/2.  The answers are in terms of the standard alibi matrices, unless \
alias is specified in the optional argument.


AlibiAliasAnimation2D[vector, {\[Theta]min, \[Theta]max}, numframes:24] \
produces a side by side animation of the alibi and alias interpretation of a
2D rotation.

DrawVector3D[vectortip, name, l, options] will draw a vector from the origin
going to vectortip. The vector will be labeled with name at l vectortip. \
options can be used to pass options to the Arrow3D routine.
DrawVector3D[vectortip, name, options] is the same as
DrawVector3D[vectortip, \
name, 1.1, options]

DrawFrame3D[rotmat, {name1, name2, name3}, l, options] will draw frame axes
rotated according to the rotation matrix, rotmat, rotating the axes vectors
in the alibi mode. The axes will be labeled with the names at a fractional \
distance l along the axes vector. options can be used to pass options to the
Arrow3D routine.
DrawFrame3D[rotmat, {name1, name2, name3}, options] is the same as \
DrawFrame3D[rotmat, {name1, name2, name3}, 1.1, options]

DrawBook[rotmat, scale] will draw a book centered at the origin and rotated
using the rotation matrix rotmat. scale can be used to change the overall \
size of the book. scale = 1 gives a book of dimensions 0.9 x 0.6 x 0.2. The
book looks best with the following lighting option:
Lighting \[Rule] True,
AmbientLight \[Rule] GrayLevel[0.3],
LightSources\[Rule]{{{1, 0, 1}, GrayLevel[0.4]},{{1, 1, 1}, \
GrayLevel[0.4]},{{0, 1, 1},GrayLevel[0.4]}}
Another possibility is to use the BookLighting option command.

ThreeStepBookAnimation[{rot1, \[Theta]1max}, {rot2, \[Theta]2max}, {rot3, \
\[Theta]3max}] will produce an animation of the book, rotating successively
according to the three rotation matrices by the specified angles.

TwoBookAnimation[seq1, seq2] animates two side by side book rotation \
sequences where each sequence is given by a sequence of the form {{rot1, \
\[Theta]1max}, {rot2, \[Theta]2max}, {rot3, \[Theta]3max}}.

AliasAnimation3D[{rot1, \[Theta]1max}, {rot2, \[Theta]2max}, {rot3, \
\[Theta]3max}] will animate the a three step rotation of the frame using \
alias form matrices. The routine sets the alias form for matrices and then \
restores the original form.

So far, I have two completed tutorials.
1) 2D rotations, alibi and alias interptetations. Matrix form. Mathematica
expressions for transforming row vectors, column vectors etc.
2) 3D rotations about axes. Illustration of the matrix forms and the
mnemonic XYZXY for determining the directions of rotations and where to put
the +Sin and -Sin terms in the matrix.
3) 3D rotation sequences. Calculating Euler angles or axis of rotation.
Still in progress, although the underlying routines are finished.

We would be glad to share this work with anyone studying 3D rotations,
especially if they are interested in contributing ideas to improve them.

Rip has been jumping ahead, learning how to use quaternions, but so far I
have been staying with rotation matrices.

David Park
djmp at

> From: ojg [mailto:ole.jonny.gjoen at]
To: mathgroup at
> Question regarding rotations.
> Some of the documentation found regarding this is not as far as I can see
> complete in the documentation, at least the subject is difficult enough to
> make me unsure once not 100% clear:)
> Fist, what are the defined "euler angles" in mathematica, and in
> what order
> are they applied?
> Second, of which side of the vector is the rotational matrix multiplied ?
> Third, is there a mathematica way to rotate around an abitrary rotational
> axis? If not, what would the mathematica matix be for this?
> My problem to solve is as follows: Given three rotational angles (a,b,c)
> applied in order to the following three rotational axes: Y axis, X axis, Z
> axis. (usual right hand system). This rotation applied to any
> vector v will
> give you a vector V (first Y rotation applied on v, etc).
> Now, given a rotational matrix with pure numerical values in, I
> need to find
> the three angles, and I need a general formulae for this solution taking
> care of the special cases.
> Thanks,
> Johnny

  • Prev by Date: Re: Intersection of polygons and more
  • Next by Date: Substitutions[rookie]
  • Previous by thread: Re: Rotation3D, MatrixRotation3D ?
  • Next by thread: Re: Re: Rotation3D, MatrixRotation3D ?