Rotation Matrices Jan08

Embed Size (px)

Citation preview

  • 8/4/2019 Rotation Matrices Jan08

    1/46

    1

    27-750

    Advanced Characterization and

    Microstructural Analysis

    Vectors, Matrices, Rotations

    Spring 2007

    CarnegieMellon

    MRSECMost of the material in these slides

    originated in lecture notes by Prof. Brent

    Adams (now at BYU).

  • 8/4/2019 Rotation Matrices Jan08

    2/46

    2

    Notation

    X point

    x1,x2,x3 coordinates of a point

    u vector

    o originbase vector (3 dirn.)

    n1 coefficient of a vector

    Kronecker delta

    eijk permutation tensor

    aij,Lij rotation matrix (passive)or, axis transformation

    gij rotation matrix (active*)

    u (ui) vector (row or column)

    ||u|| L2 norm of a vector

    A (Aij) general second rank

    tensor (matrix)l eigenvalue

    v eigenvector

    I Identity matrix

    AT transpose of matrix

    n, r rotation axisq rotation angle

    tr trace (of a matrix)

    3 3D Euclidean space

    u

    e3

    ij

    * in most texture books,gdenotes an axis transformation, or passive rotation!

  • 8/4/2019 Rotation Matrices Jan08

    3/46

    3

    Points, vectors, tensors, dyadics

    Material pointsof the crystalline sample, ofwhich xand yare examples, occupy a subsetof the three-dimensional Euclidean point

    space, 3, which consists of the set of allordered triplets of real numbers, {x1,x2,x3}.The term pointis reserved for elements of 3.The numbersx1,x2,x3describe the location of

    the pointx by its Cartesian coordinates.

    Cartesian; from Ren Descartes, a French mathematician, 1596 to 1650.

  • 8/4/2019 Rotation Matrices Jan08

    4/46

    4

    VECTORS

    The differencebetween any two pointsdefines a vectoraccording to the

    relation . As such denotes thedirected line segment with its origin at x andits terminus at y. Since it possesses both adirection and a length the vectoris an

    appropriate representation for physicalquantities such as force, momentum,displacement, etc.

    x,y 3v = y -x v

  • 8/4/2019 Rotation Matrices Jan08

    5/46

    5

    Two vectors u and v compound (addition) accordingto the parallelogram law. If u and v are taken to bethe adjacent sides of a parallelogram (i.e., emanatingfrom a common origin), then a new vector, w,

    is defined by the diagonal of the parallelogram whichemanates from the same origin. The usefulness ofthe parallelogram law lies in the fact that many

    physical quantities compound in this way.

    w u v

    Parallelogram Law

  • 8/4/2019 Rotation Matrices Jan08

    6/46

    6

    It is convenient to introduce a rectangularCartesian coordinate framefor consisting ofthe base vectors , , and and a point ocalled the origin. These base vectors haveunit length, they emanate from the commonorigin o, and they are orthogonal to each

    another. By virtue of the parallelogram lawany vector can be expressed as a vectorsum of these three base vectors according tothe expressions

    e1

    e2

    e3

    v

    v v1e1 v2 e2 v3e3 vieii13 vi eiCoordinate Frame

  • 8/4/2019 Rotation Matrices Jan08

    7/46

    7

    where are real numbers calledthe componentsof in the specifiedcoordinate system. In the previous equation,the standard shorthand notation has been

    introduced. This is known as the summationconvention. Repeated indices in the sameterm indicate that summation over therepeated index, from 1 to 3, is required. Thisnotation will be used throughout the textwhenever the meaning is clear.

    v1, v2 andv3

    Coordinate Frame, contd.

  • 8/4/2019 Rotation Matrices Jan08

    8/46

    8

    v2 v12 v2

    2 v32 vivi

    The magnitude,v, of is related to its

    components through the parallelogram

    law:

    v

    Magnitude of a vector

    You will also encounter this quantity as theL2 Norm in matrix-vector algebra:

    v 2 v v12 v2

    2 v32 vivi

  • 8/4/2019 Rotation Matrices Jan08

    9/46

    9

    The scalar productuvof the two vectorsand whose directions are separated by theangle q is the scalar quantity

    where u and v are the magnitudes of u andv respectively. Thus, uv is the product of theprojected length of one of the two vectors withthe length of the other. Evidently the scalar

    product is commutative, since:

    u v uvcosq uivi

    u v v u

    Scalar Product (Dot product)

  • 8/4/2019 Rotation Matrices Jan08

    10/46

    10

    There are many instances where the scalarproduct has significance in physical theory.Note that if and are perpendicular then

    =0, if they are parallel then =uv,

    and if they are antiparallel =-uv. Also,the Cartesian coordinates of a pointx, withrespect to the chosen base vectors andcoordinate origin, are defined by the scalar

    product

    u vu v u v

    u v

    xi (x o) ei

    Cartesian coordinates

  • 8/4/2019 Rotation Matrices Jan08

    11/46

    11

    For the base vectors themselves the followingrelationships exist

    The symbol is called the Kronecker delta.Notice that the components of the Kroneckerdelta can be arranged into a 3x3 matrix, I,where the first index denotes the row and the

    second index denotes the column. Iis calledthe unit matrix; it has value 1 along thediagonal and zero in the off-diagonal terms.

    ei ej ij 1 if i = j0 if i j

    ij

  • 8/4/2019 Rotation Matrices Jan08

    12/46

    12

    The vector product of vectors and

    is the vector normal to the planecontaining and , and oriented in thesense of a right-handed screw rotating from

    to . The magnitude of is givenby uvsinq, which corresponds to the area ofthe parallelogram bounded by and . Aconvenient expression for in terms of

    components employs the alternating symbol,e or

    u v uv u v

    u v uv

    u vu v

    uv eijkeiujvk

    Vector Product (Cross Product)

  • 8/4/2019 Rotation Matrices Jan08

    13/46

    13

    Related to the vector and scalar products isthe triple scalar product whichexpresses the volume of the parallelipipedbounded on three sides by the vectors ,

    and . In component form it is given by

    eijk 1 if ijk = 123, 312 or 231 (even permutations of 12

    -1 if ijk = 132, 213 or 321 (odd permutations of 12

    0 if any two of ijk are equal

    (u v )wu vw

    (u v) w eijkuivjwk

    Permutation tensor, eijk

  • 8/4/2019 Rotation Matrices Jan08

    14/46

    14

    With regard to the set of orthonormal basevectors, these are usually selected in such amanner that .

    Such a coordinate basis is termed righthanded. If on the other hand

    ,then the basis is left handed.

    (e1 e2) e3 1

    (e1 e2) e3 1

    Handed-ness of Base Vectors

  • 8/4/2019 Rotation Matrices Jan08

    15/46

    15

    CHANGES OF THE

    COORDINATE SYSTEM Many different choices are possible for the

    orthonormal base vectors and origin of the

    Cartesian coordinate system. A vector is anexample of an entity which is independent ofthe choice of coordinate system. Its directionand magnitude must not change (and are, in

    fact, invariants), although its components willchange with this choice.

  • 8/4/2019 Rotation Matrices Jan08

    16/46

    16

    Consider a neworthonormal system consisting ofright-handed base vectors

    with the same origin, o, associated with

    and

    The vector

    is clearly expressed equally wellin either coordinate system:

    Note - same vector, different values of thecomponents. We need to find a relationship betweenthe two sets of components for the vector.

    v

    v vi ei viei

    e1, e2 and e3New Axes

    e1, e2 and e3

    ^ e1^

    e2^

    e2^

    e3^

    e3^

    e1

  • 8/4/2019 Rotation Matrices Jan08

    17/46

    17

    The two systems are related by the ninedirection cosines, , which fix the cosine ofthe angle between the ithprimed and thejth

    unprimed base vectors:

    Equivalently, represent the components

    of in according to the expression

    aij

    aij ei ejaij

    ei

    ejei aijej

    Direction Cosines

  • 8/4/2019 Rotation Matrices Jan08

    18/46

    18

    That the set of direction cosines are notindependent is evident from the followingconstruction:

    Thus, there are sixrelationships (itakesvalues from 1 to 3, andj takes values from 1

    to 3) between the ninedirection cosines, andtherefore only threeare independent.

    ei

    ej aikajl

    ek

    el aikajlkl aikajk ij

    Direction Cosines, contd.

  • 8/4/2019 Rotation Matrices Jan08

    19/46

    19

    Note that the direction cosines can be

    arranged into a 3x3 matrix, L, and thereforethe relation above is equivalent to theexpression

    where LT denotes the transpose of L. Thisrelationship identifies L as an orthogonalmatrix, which has the properties

    LL

    T I

    L1 LT det L 1

    Orthogonal Matrices

  • 8/4/2019 Rotation Matrices Jan08

    20/46

    20

    When both coordinate systems are right-handed,

    det(L

    )=+1 andL

    is a proper orthogonal matrix.

    The orthogonality of L also insures that, in addition to

    the relation above, the following holds:

    Combining these relations leads to the following inter-

    relationships between components of vectors in thetwo coordinate systems:

    ej aij ei

    v = LT v , vi aji vj , v = Lv , vj ajiv i

    Relationships

    v Lv ; ei aijej

  • 8/4/2019 Rotation Matrices Jan08

    21/46

    21

    These relations are called the laws of

    transformationfor the components of vectors.They are a consequence of, and equivalentto, the parallelogram law for addition ofvectors. That such is the case is evidentwhen one considers the scalar productexpressed in two coordinate systems:

    u v uivi aji ujaki vk ajiaki uj vk jk uj vk uj vj ui vi

    Transformation Law

  • 8/4/2019 Rotation Matrices Jan08

    22/46

    22

    Thus, the transformation law as expressed preserves

    the lengths and the angles between vectors. Anyfunction of the components of vectors which remainsunchanged upon changing the coordinate system iscalled an invariantof the vectors from which thecomponents are obtained. The derivations illustrate

    the fact that the scalar product,

    is an invariantof the vectors uand v.Other examples of invariantsinclude the vectorproduct of two vectors and the triple scalar product ofthree vectors. Note that the transformation law forvectors also applies to the components of pointswhen they are referred to a common origin.

    u v

    Invariants

    23

  • 8/4/2019 Rotation Matrices Jan08

    23/46

    23

    Rotation Matrices

    Since an orthogonal matrix merely rotates a

    vector but does not change its length, thedeterminant is one, det(L)=1.

    L aij

    a11 a12 a13

    a21 a22 a23

    a31 a32 a33

    24

  • 8/4/2019 Rotation Matrices Jan08

    24/46

    24

    A rotation matrix, L, is an orthogonal matrix,

    however, because each row is mutuallyorthogonal to the other two.

    Equally, each column is orthogonal to theother two, which is apparent from the fact thateach row/column contains the direction

    cosines of the new/old axes in terms of theold/new axes and we are working with[mutually perpendicular] Cartesian axes.

    aki

    akj

    ij

    , aik

    ajk

    ij

    Orthogonality

    25

  • 8/4/2019 Rotation Matrices Jan08

    25/46

    25

    Vector realization of rotation

    The convenient way tothink about a rotationis to draw a plane that

    is normal to the rotationaxis. Then project thevector to be rotated ontothis plane, and onto therotation axis itself.

    Then one computes the vector product of the rotationaxis and the vector to construct a set of 3 orthogonalvectors that can be used to construct the new, rotatedvector.

    vv

    q

    n

    26

  • 8/4/2019 Rotation Matrices Jan08

    26/46

    26

    Vector realization of rotation

    One of the vectorsdoes not changeduring the rotation.The other two can be

    used to construct thenew vector.

    vv

    q

    n

    v n v

    n

    n v n

    n v

    v gv (cosq)v (sinq)n v (1 cosq)(n v )nNote that this equation does not require any specific coordinatesystem; we will see similar equations for the action of matrices,

    Rodrigues vectors and (unit) quaternions

    27

  • 8/4/2019 Rotation Matrices Jan08

    27/46

    27

    A rotation is commonly written as ( ,q) or

    as (n,w). The figure illustrates the effectof a rotation about an arbitrary axis,

    OQ (equivalent to and n) through an

    anglea

    (equivalent toq

    andw

    ).

    r

    r

    gij ij cosqeijknksinq

    (1 cosq)ninj(This is an active rotation: a

    passive rotation axis

    transformation)

    Rotations (Active): Axis- Angle Pair

    28

  • 8/4/2019 Rotation Matrices Jan08

    28/46

    28

    The rotation can be converted to a matrix(passive rotation) by the following expression,

    where is the Kronecker delta and

    is the permutation tensor; note thechange of sign on the off-diagonal terms.

    aij ij cosq rirj 1 cosq

    ijkrksinqk1,3

    Axis Transformation from Axis-Angle Pair

    Compare with

    active rotation

    matrix!24

    A rotation is commonly written as ( ,q) oras (n,w). The figure illustrates the effect

    of a rotation about an arbitrary axis,OQ (equivalent to and n) through anangle a(equivalent to q and w).

    r

    r

    gij ij cosq eijknksinq

    (1 cosq)ninj(This is anactive rotation: a

    passiv e rotation axistransformation)

    Rotations (Active): Axis- Angle Pai

    29

  • 8/4/2019 Rotation Matrices Jan08

    29/46

    29

    Rotation Matrix for Axis

    Transformation from Axis-Angle Pair

    gij ij cosq rirj 1 cosq

    ijkrksin

    q

    k1,3

    cosq u2 1 cosq uv 1 cosq wsinq uw 1 cosq vsinquv 1 cosq wsinq cosq v2 1 cosq vw 1 cosq usinquw 1 cosq vsinq vw 1 cosq usinq cosq w

    2 1 cosq

    This form of the rotation matrix is a passiverotation, appropriate to axis transformations

    30

  • 8/4/2019 Rotation Matrices Jan08

    30/46

    30

    Eigenvector of a Rotation

    A rotation has a single (real) eigenvectorwhich is the rotation axis. Since aneigenvector must remain unchanged by the

    action of the transformation, only the rotationaxis is unmoved and must therefore be theeigenvector, which we will callv. Note that

    this is a different situation from other secondrank tensors which may have more than onereal eigenvector, e.g. a strain tensor.

    31

  • 8/4/2019 Rotation Matrices Jan08

    31/46

    31

    Characteristic Equation

    An eigenvector corresponds to a solution of thecharacteristic equation of the matrix a, where l

    is a scalar: av =lv

    (a - lI)v

    =0

    det(a - lI) = 0

    32

  • 8/4/2019 Rotation Matrices Jan08

    32/46

    32

    Characteristic equation is a cubic and so three

    eigenvaluesexist, for each of which there is acorresponding eigenvector.

    Consider however, the physical meaning of arotation and its inverse. An inverse rotationcarries vectors back to where they started outand so the only feature to distinguish it from theforward rotation is the change in sign. The

    inverse rotation, a-1

    must therefore share thesame eigenvector since the rotation axis is thesame (but the angle is opposite).

    Rotation: physical meaning

    33

  • 8/4/2019 Rotation Matrices Jan08

    33/46

    33

    Therefore we can write:

    av = a-1v = v,

    and subtract the first two quantities.

    (aa-1) v = 0.

    The resultant matrix, (a

    a-1) clearlyhas zero determinant(required for non-trivialsolution of a set of homogeneous equations).

    Forward vs. Reverse Rotation

    34

  • 8/4/2019 Rotation Matrices Jan08

    34/46

    34

    Eigenvalue = +1

    To prove that (a - I)v = 0 (l= 1):

    Multiply by aT: aT(a - I)v = 0(aTa - aT)v = 0

    (I- aT

    )v

    =0.

    Add the first and last equations:(a - I)v + (I- aT)v = 0

    (a - aT)v = 0.

    If a

    T

    aI, then the last step would not be valid. The last result was already demonstrated.

    Orthogonal matrix

    property

    35

  • 8/4/2019 Rotation Matrices Jan08

    35/46

    35

    n

    (a23 a32 ),(a31 a13),(a12 a21)

    (a23 a32)2 (a31 a13)

    2 (a12 a21)2

    One can extract the rotation axis,n,(the only real eigenvector, same asvin previous

    slides, associated with the eigenvaluewhosevalue is +1) in terms of the matrix coefficients for

    (a - aT

    )v

    =0

    , with a suitable normalization to obtaina unit vector:

    Rotation Axis from Matrix

    Note the order (very important) of the coefficients in each subtraction;

    again, if the matrix represents an active rotation, then the sign is inverted.

    36

    R i A i f M i d

  • 8/4/2019 Rotation Matrices Jan08

    36/46

    36

    (aa-1) =

    0 a12 a21 a13 a31a21 a12 0 a23 a32a31 a13 a32 a23 0

    Given this form of the difference matrix,based ona-1 = aT, the only non-zero vector that

    will satisfy(aa-1) n = 0is:

    n (a23 a32),(a31 a13),(a12 a21)

    (a23 a32 )2 (a31 a13)

    2 (a12 a21)2

    Rotation Axis from Matrix, contd.

    37

  • 8/4/2019 Rotation Matrices Jan08

    37/46

    37

    Another useful relation gives us the magnitude of the

    rotation,q, in terms of thetraceof the matrix,aii:

    , therefore,

    cos q= 0.5 (trace(a) 1).

    aii 3cosq (1 cosq)ni2 1 2cosq

    Rotation Angle from Matrix

    - In numerical calculations, it can happen that tr(a)-1 is either slightly greaterthan 1 or slightly less than -1. Provided that there is no logical error, it isreasonable to truncate the value to +1 or -1 and then apply ACOS.- Note that if you try to construct a rotation of greater than 180 (which isperfectly possible using the formulas given), what will happen when you extractthe axis-angle is that the angle will still be in the range 0-180 but you willrecover the negative of the axis that you started with. This is a limitation of the

    rotation matrix (which the quaternion does not share).

    38

    (S ll) A l f

  • 8/4/2019 Rotation Matrices Jan08

    38/46

    (Small) Rotation Angle from Matrix

    What this shows is that for small angles, it is safer to use a sine-based formula to extract the angle(be careful to include only a12-a21, but not a21-a12). However, this is strictly limited to angles less than90 because the range of ASIN is -/2 to +/2, in contrast to ACOS, which is 0 to , and the formulabelow uses the squares of the coefficients, which means that we lose the sign of the (sine of the)angle. Thus, if you try to use it generally, it can easily happen that the angle returned by ASIN is, infact, -q because the positive and the negative versions of the axis will return the same value.

    sinqijkajk

    2

    2

    i

    gij

    cosq u2 1 cosq uv 1 cosq wsinq uw 1 cosq v sinquv 1 cosq wsinq cosq v2 1 cosq vw 1 cosq usinq

    uw 1 cosq v sinq vw 1 cosq usinq cosq w2 1 cosq

    gI

    0 uv 1 cosq wsinq uw 1 cosq v sinquv 1 cosq wsinq 0 vw 1 cosq usinquw 1 cosq v sinq vw 1 cosq usinq 0

    w 2usinq 2v sinq 2wsinq

    39

    R i A l 180

  • 8/4/2019 Rotation Matrices Jan08

    39/46

    gij

    ij

    cos rirj

    1 cos

    ijkrksin

    k1,3

    2u2 1 2uv 2uw

    2uv 2v2 1 2vw

    2uw 2vw 2w2 1

    Rotation Angle = 180

    A special case is when the rotation,q, is equal to 180

    (=). The matrix then takes the special form:

    In this special case, the axis is obtained thus:

    n a11 1

    2

    a22 12

    a33 12

    However, numerically, the standard procedure is surprisingly robust

    and, apparently, only fails when the angle is exactly 180.

    40

  • 8/4/2019 Rotation Matrices Jan08

    40/46

    tr[a] cos1 cos2 sin1 sin2 cos

    sin1 sin2 cos1cos2 cos cos

    Trace of the (mis)orientation matri

    cos (1 cos)(cos1

    cos2

    sin1

    sin2

    )

    cos (1 cos) cos 1 2 Thus the cosine, v, of the rotation angle,

    vcosq, expressed in terms of the Euler angles:

    tr[a] 1

    2

    cos2 2 cos 1 2 sin2 2

    41

  • 8/4/2019 Rotation Matrices Jan08

    41/46

    Is a Rotation a Tensor? (yes!)Recall the definition of a tensor as a quantity

    that transforms according to this convention,whereLis an axis transformation,anda is a rotation:

    a = LTaL

    Since this is a perfectly valid method of

    transforming a rotation from one set of axesto another, it follows that an active rotationcan be regarded as a tensor. (Think oftransforming the axes on which the rotation axis

    is described.)

    42

  • 8/4/2019 Rotation Matrices Jan08

    42/46

    Matrix, Miller Indices

    In the following, we recapitulate some results obtained in thediscussion of texture components (where now it should be clearerwhat their mathematical basis actually is).

    The general Rotation Matrix, a, can be represented as in thefollowing:

    Where the Rows are the direction cosines for [100], [010], and [001]in the sample coordinate system(pole figure).

    [100] direction

    [010] direction

    [001] direction

    a11 a12 a13a21 a22 a23

    a31 a32 a33

    43

  • 8/4/2019 Rotation Matrices Jan08

    43/46

    Matrix, Miller Indices

    The columnsrepresent components of three other unit vectors:

    Where the Columns are the direction cosines (i.e. hklor uvw) for theRD, TD and Normal directions in the crystal coordinate system.

    [uvw]RD TD ND(hkl)

    a11 a12 a13

    a21 a22 a23

    a31 a32 a33

    44

  • 8/4/2019 Rotation Matrices Jan08

    44/46

    Compare Matrices

    aij Crystal

    Sample

    b1 t1 n1b2 t2 n2

    b3 t3 n3

    cos1 cos2

    sin1sin2 cossin1 cos2

    cos1sin2 cossin2 sin

    cos1sin2 sin1cos2 cos

    sin1sin2cos1cos2 cos

    cos2 sin

    sin1 sin cos1sin cos

    [uvw] [uvw] (hkl)(hkl)

    45

  • 8/4/2019 Rotation Matrices Jan08

    45/46

    Summary

    The rules for working with vectors andmatrices, i.e. mathematics, especially with

    respect to rotations and transformations ofaxes, has been reviewed.

    46

  • 8/4/2019 Rotation Matrices Jan08

    46/46

    Supplemental Slides

    [none]