       Re: Re: Rotation3D, MatrixRotation3D ?

• To: mathgroup at smc.vnet.net
• Subject: [mg30438] Re: [mg30410] Re: Rotation3D, MatrixRotation3D ?
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Sat, 18 Aug 2001 04:05:01 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Actually (of course) there is no need to multiply the rotation matrices
explicitly as I somewhat blindly did in the message below, the following
will do just as well:

In:=
Needs["Geometry`Rotations`"]

In:=
B=RotationMatrix3D[Pi/3,Pi/4,Pi/6];

In:=
Solve[RotationMatrix3D[\[Phi],\[Theta],\[Psi]]\[Equal]
B,{\[Phi],\[Theta],\[Psi]}]

From In:=
Solve::ifun: Inverse functions are being used by Solve, so some
solutions may \
not be found.

Out=
{{\[Psi] -> Pi/6, \[Theta] -> Pi/4, \[Phi] -> Pi/3}}

On Friday, August 17, 2001, at 09:49  PM, Andrzej Kozlowski wrote:

> My previous message in this thread actually contains (implicitly) two
> ways to do that. The first way is very straight forward and consists
> simply of the combination of Euler's theorem and the Mathematica
> function Solve. For example, let's construct a rotation matrix:
>
> In:=
> Needs["Geometry`Rotations`"]
>
> In:=
> B=RotationMatrix3D[Pi/3,Pi/4,Pi/6];
>
> In:=
> Solve[ RotationMatrix3D[\[Psi], 0, 0].
>       RotationMatrix3D[0, \[Theta], 0].RotationMatrix3D[\[Phi], 0,
> 0]\[Equal]
>     B,{\[Phi],\[Theta],\[Psi]}]
>
> From In:=
> Solve::ifun: Inverse functions are being used by Solve, so some
> solutions may \
> not be found.
>
> Out=
> {{\[Psi] -> Pi/6, \[Theta] -> Pi/4, \[Phi] -> Pi/3}}
>
> One has to be careful here to get the names of the angles right (or
> equivalently their order), I had it wrong in my message since
> Mathematica convention is not the same as I am used to.
>
> This method is not 100% reliable because Mathematica is not 100%
> reliable when solving trigonometric equations. There is also a second
> method, basically described at the end of my previous message. If you
> really need it I send you the details  or you can look it up in a good
> linear algebra book, e.g. Kostrykin and Manin, "Linear Algebra and
> Geometry".
>
>
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/
>
>
>
>
>
> On Friday, August 17, 2001, at 04:09  PM, ojg wrote:
>
>> Sounds interesting:)
>>
>> Are your routines able to regenerate the auler angles from the
>> rotation? My
>> problem is of a similar kind and might be good to look at:)
>>
>> Thanks,
>> Johnny
>>
>> "David Park" <djmp at earthlink.net> wrote in message
>> news:9ld1m6\$2gi\$1 at smc.vnet.net...
>>> Johnny,
>>>
>>> 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
>>> sequences.
>>>
>>> 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
>>>
>>> Here are some of the usage messages for the routines that are in the
>>> packages.
>>>
>>> Geometry`ExtendRotations`
>>>
>>> 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
>>> axis.
>>>
>>> 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.
>>>
>>> Geometry`RotationGraphics`
>>>
>>> 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.
>>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> From: ojg [mailto:ole.jonny.gjoen at hitecvision.com]
To: mathgroup at smc.vnet.net
>> To: mathgroup at smc.vnet.net
>>>>
>>>> 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: Re: Rotation3D, MatrixRotation3D ?
• Next by Date: Re: Polynomial Reduction with Mod
• Previous by thread: Re: Re: Rotation3D, MatrixRotation3D ?
• Next by thread: Re: Re: Rotation3D, MatrixRotation3D ?