The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Rotating a Plane about a Point in Space

Date: 07/03/2004 at 23:26:12
From: Tdon
Subject: plane rotation about a point in space

What is the equation to rotate a random plane in space around a known 
point?  The plane is defined by three points on a right-triangle.  
After rotation the first point is to be at the origin of the rotated
plane, the second point on the x-positive axis and the third point on 
the y-positive axis.

The axes are defined as X, Y, and Z.  The rotary axes are defined as B
(rotating around the Y-axis) and C (rotating around the Z-axis).

This is for a real life application.  It will be used on a computer
controlled metal cutting milling machine.

I have tried the local college and all of my friends that have any 
chance of figuring it it out with no luck.  I have also tried internet 
sites that provide math answers but have not yet found the answer I 
need.  Thank you for your help.

Date: 07/04/2004 at 09:40:58
From: Doctor Tom
Subject: Re: plane rotation about a point in space

Hello Tdon,

First, let me restate the problem to make certain that I understand 
it.  If I have this wrong, please write back and let me know what I
have misunderstood.

Originally, you have three points in 3-dimensional space and I assume
you have their coordinates in your original coordinate system.

To minimize confusion, I will call the three points O, X and Y.  Also,
you know that the angle XOY is a right angle.  Let me label the
original coordinates as follows:

  O = (Ox, Oy, Oz)
  X = (Xx, Xy, Xz)
  Y = (Yx, Yy, Yz)

After the transformation, you want O to be at the origin, you want X
to lie on the x-axis, and you want Y to lie on the y-axis.  In
addition, I assume that you want a method to figure out where an
arbitrary point P = (Px, Py, Pz) will wind up if the three points
above are moved rigidly as described.

So if the rigid transformation takes P -> Q = (Qx, Qy, Qz), what
you're really looking for is a formula to find the values of Qx, Qy
and Qz in terms of the twelve variables Ox, Oy, ... Py, Pz, right?

First do a rigid translation of the whole system that takes O to the

  P' = (Px - Ox, Py - Oy, Pz - Oz)
  X' = (Xx - Ox, Xy - Oy, Xz - Oz)
  Y' = (Yx - Ox, Yy - Oy, Yz - Oz)

and of course:

  O' = (Ox - Ox, Oy - Oy, Oz - Oz) = (0, 0, 0)

Let me name the new translated coordinates as follows:

  Px - Ox = Px'
  Py - Oy = Py'

and so on.

Now calculate the length of the vectors X' amd Y' and let me call them
Lx' and Ly' (these are just numbers):

  Lx' = square_root( (Xx')^2 + (Xy')^2 + (Xz')^2 )

and similarly for Ly'.

We can calculate the point Z' as follows:

  Z' = X' x Y',

where the "x" above refers to the vector cross-product.  It happens
that if you take the cross product of two vectors that lie at 90
degrees from each other, the result will be a vector perpendicular to
both and which forms a right-handed coordinate system with them, which
is exactly what you want.  In other words, this cross product will
find a point that should transform to the positive z-axis.

Here's the formula for the vector cross-product:

  (Xx', Xy', Xz') x (Yx', Yy', Yz')
   = (Xy' Yz' - Xz' Yy', Xz' Yx' - Xx' Yz', Xx' Yy' - Xy' Yx')

This cross-product will yield a vector

  Z' = (Zx', Zy', Zz')

As you did before, find Lz', the lengh of Z'.

Now you know what you need is a calcuation that takes:

  X' -> (Lx', 0, 0)
  Y' -> (0, Ly', 0)
  Z' -> (0, 0, Lz')

in a linear manner.

In other words you are searching for a 3x3 matrix M such that:

  X' M = (Lx', 0, 0)
  Y' M = (0, Ly', 0)
  Z' M = (0, 0, Lz')

That is equivalent to the matrix equation:

  [ Xx' Xy' Xz' ]         [ Lx'   0   0  ]
  [ Yx' Yy' Yz' ]     M = [  0   Ly'  0  ]
  [ Zx' Zy' Zz' ]         [  0    0   Lz']

Let me use the name N to refer to the matrix to the left of M and let 
me use the name L to refer to the matrix to the right of the "=" sign.  
We need to solve the following matrix equation for M:

  N M = L

Let N^(-1) be the inverse of matrix N.  Then:

  M = N^(-1)L

There you are!

So, to transform a point P to where it will be after the translation/
rotation, first subtract off the coordintes of the point O from all
your points.

Next, calculate the cross-product for a z-like vector and find the 
lengths of all.

Find the entries in the matrices N and L as above.  Invert N, and 
multiply it by L on the right to obtain M.

Finally, multiply the vector P' (the one that was translated to the
origin) by M and you will have the result you desire:

  P'M = Q.

Good luck!

- Doctor Tom, The Math Forum 
Associated Topics:
College Geometry
College Linear Algebra
High School Geometry
High School Linear Algebra
High School Practical Geometry

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.