Vector Rotation Matrices (GNU Octave (version 7.1.90))

Previous: Interpolation on Scattered Data, Up: Geometry [Contents][Index]

### 30.5 Vector Rotation Matrices

Also included in Octave’s geometry functions are primitive functions to enable vector rotations in 3-dimensional space. Separate functions are provided for rotation about each of the principle axes, x, y, and z. According to Euler’s rotation theorem, any arbitrary rotation, R, of any vector, p, can be expressed as a product of the three principle rotations:

    p' = Rp = Rz*Ry*Rx*p

: T = rotx (angle) ¶

  `rotx` returns the 3x3 transformation matrix corresponding to an active rotation of a vector about the x-axis by the specified angle, given in degrees, where a positive angle corresponds to a counterclockwise rotation when viewing the y-z plane from the positive x side.

  The form of the transformation matrix is:

           | 1      0           0      |
       T = | 0  cos(angle) -sin(angle) |
           | 0  sin(angle)  cos(angle) |

  This rotation matrix is intended to be used as a left-multiplying matrix when acting on a column vector, using the notation `v = T*u`. For example, a vector, u, pointing along the positive y-axis, rotated 90-degrees about the x-axis, will result in a vector pointing along the positive z-axis:

      >> u = [0 1 0]'
      u =
         0
         1
         0

      >> T = rotx (90)
      T =
         1.00000   0.00000   0.00000
         0.00000   0.00000  -1.00000
         0.00000   1.00000   0.00000

      >> v = T*u
      v =
         0.00000
         0.00000
         1.00000

  See also: roty, rotz.

: T = roty (angle) ¶

  `roty` returns the 3x3 transformation matrix corresponding to an active rotation of a vector about the y-axis by the specified angle, given in degrees, where a positive angle corresponds to a counterclockwise rotation when viewing the z-x plane from the positive y side.

  The form of the transformation matrix is:

           |  cos(angle)  0  sin(angle) |
       T = |      0       1      0      |
           | -sin(angle)  0  cos(angle) |

  This rotation matrix is intended to be used as a left-multiplying matrix when acting on a column vector, using the notation `v = T*u`. For example, a vector, u, pointing along the positive z-axis, rotated 90-degrees about the y-axis, will result in a vector pointing along the positive x-axis:

        >> u = [0 0 1]'
         u =
            0
            0
            1

         >> T = roty (90)
         T =
            0.00000   0.00000   1.00000
            0.00000   1.00000   0.00000
           -1.00000   0.00000   0.00000

         >> v = T*u
         v =
            1.00000
            0.00000
            0.00000

  See also: rotx, rotz.

: T = rotz (angle) ¶

  `rotz` returns the 3x3 transformation matrix corresponding to an active rotation of a vector about the z-axis by the specified angle, given in degrees, where a positive angle corresponds to a counterclockwise rotation when viewing the x-y plane from the positive z side.

  The form of the transformation matrix is:

           | cos(angle) -sin(angle) 0 |
       T = | sin(angle)  cos(angle) 0 |
           |     0           0      1 |

  This rotation matrix is intended to be used as a left-multiplying matrix when acting on a column vector, using the notation `v = T*u`. For example, a vector, u, pointing along the positive x-axis, rotated 90-degrees about the z-axis, will result in a vector pointing along the positive y-axis:

        >> u = [1 0 0]'
         u =
            1
            0
            0

         >> T = rotz (90)
         T =
            0.00000  -1.00000   0.00000
            1.00000   0.00000   0.00000
            0.00000   0.00000   1.00000

         >> v = T*u
         v =
            0.00000
            1.00000
            0.00000

  See also: rotx, roty.

Previous: Interpolation on Scattered Data, Up: Geometry [Contents][Index]