Rotation about an Arbitrary Axis (Line)

Rotation about an Arbitrary Axis (Line)
Rotation about an Arbitrary Axis (Line)
Z
P1
L
P1
P2
Z0
P0
X0
O
Y0
Y
X
y = Bu + y0
LL
P0
x = Au + x0
0 < =u <=1
z = Cu + z0
L = A2 + B 2 + C 2 u
CC
B
A
AB
Step 1: Translate Point P0 to Origin O
T
P0 = [ xo yo zo ]
0 0 − x0 ⎤
1 0 − y0 ⎥⎥
0 1 − z0 ⎥
⎥
0 0
1 ⎦
C
A
O
⎡1
⎢0
[D] = ⎢
⎢0
⎢
⎣0
P1(A,B,C)
z
P0
B
y
x
Step 2: Rotate Vector about X Axis to get into the x - z plane
L = A2 + B 2 + C 2
V
L
X
V = B2 + C 2
B
sin θ1 =
V
C
cosθ1 =
V
0
⎡1
⎢0 cosθ
1
[Rx ] = ⎢
⎢0 sin θ1
⎢
0
⎣0
1 0
0
0⎤ ⎡⎢ C
0
− sin θ1 0⎥⎥ ⎢ V
= ⎢
cosθ1 0⎥ ⎢0 B
⎥
0
1⎦ ⎢ V
⎢⎣0 0
0
B
−
V
C
V
0
0⎤
⎥
0⎥
⎥
0⎥
⎥
1⎦⎥
Step 3: Rotate about the Y axis to get it in the Z direction
Rotate a negative angle (CW)!
A
sin θ 2 = −
L
V
cosθ 2 =
L
⎡ cos θ 2
⎢ 0
⎡⎣ Ry ⎤⎦ = ⎢
⎢ − sin θ 2
⎢
⎣ 0
0 sin θ 2
1
0
0 cos θ 2
0
0
⎡V
0 ⎤ ⎢ L
⎢
⎥
0 ⎥ ⎢ 0
=
0 ⎥ ⎢ A
⎥ ⎢ L
1 ⎦ ⎢
⎢⎣ 0
A
⎤
0 −
0 ⎥
L
⎥
1 0 0 ⎥
⎥
V
0
0 ⎥
L
⎥
0 0 1 ⎥⎦

Step 4: Rotate angle θ about axis
L
⎡cosθ
⎢ sin θ
[Rz ] = ⎢
⎢ 0
⎢
⎣ 0
− sin θ
cosθ
0
0
0 0⎤
0 0⎥⎥
1 0⎥
⎥
0 1⎦
Step 5: Reverse the rotation about the Y axis
⎡ V
⎢ L
⎢ 0
−1
R y = ⎢ A
⎢−
⎢ L
⎢⎣ 0
[ ]
0
1
0
0
A
L
0
V
L
0
⎤
0⎥
0⎥
⎥
0⎥
⎥
1⎥⎦
⎡ cosθ 2
⎢ 0
R y = ⎢
⎢− sin θ 2
⎢
⎣ 0
[ ]
0 sin θ 2
1
0
0 cosθ 2
0
0
V
0⎤ ⎡⎢
L
⎥
⎢
0⎥
= ⎢ 0A
0⎥ ⎢
⎥
1⎦ ⎢ L
⎢⎣ 0
Inverse of Rotation:
Replace
θ
by
–θ
sin θ
by
– sin θ
cos θ remains cos θ (why?)
A
L
0
V
L
0
0 −
1
0
0
⎤
0⎥
0⎥
⎥
0⎥
⎥
1⎥⎦
Step 6: Reverse rotation about the X axis
⎡ 1 0
⎢
C
0
⎢
−1
R
[ x ] = ⎢ VB
⎢ 0 −
V
⎢
⎢⎣ 0 0
0
⎡1
⎢0 cosθ
1
[Rx ] = ⎢
⎢0 sin θ1
⎢
0
⎣0
0
B
V
C
V
0
0⎤
⎥
0⎥
⎥
0⎥
⎥
1⎥⎦
1 0
0
0⎤ ⎡⎢ C
0
− sin θ1 0⎥⎥ ⎢ V
= ⎢
cosθ1 0⎥ ⎢0 B
⎥
0
1⎦ ⎢ V
⎢⎣0 0
0
B
−
V
C
V
0
0⎤
⎥
0⎥
⎥
0⎥
⎥
1⎥⎦
Step 7: Reverse translation
⎡ 1 0
⎢
⎢ 0 1
−1
[D] = ⎢
⎢ 0 0
⎢
⎣ 0 0
0 x 0 ⎤
⎥
0 y 0 ⎥
⎥
1 z 0 ⎥
⎥
0 1 ⎦
Overall Transformation
[T ] = [ D]−1[ Rx ]−1[ Ry ]−1[ Rzθ ][ Ry ][ Rx ][ D]
P2 = [T ]P1
An Example
CCW
original
60
120
180
An Example
Given the point matrix (four
points) on the right; and a line,
NM, with point N at (6, -2, 0)
and point M at (12, 8, 0).
Rotate the these four points 60
degrees around line NM (alone
the N to M direction) N: u=0;
M: u=1
Po = N
P1 = M
A = 12 − 6 = 6
P1 P2 P3 P4
[P1]=
3 10 1 3
5 6 1 5
0 0 0 0
1 1 1 1
1.  Calculate the constants
(the Line/Axis of Rotation)
x = 6 + 6u
y = −2 + 10u
z=0
Thus
A = 6, B = 10, C = 0
B = 8 − (−2) = 10
L = A2 + B 2 + C 2 = 11.6619
C = 0− 0 = 0
V = B 2 + C 2 = 10
2. Translate N to the origin
3. Rotate about the X axis
[D] = 1 0 0 -6
010 2
001 0
000 1
[R]x = 1 0 0
0
0 C/V -B/V 0
0 B/V C/V 0
0 0
0 1
4. Rotate about the Y axis
5. Rotate 60 degree (positive)
[R]y = V/L
0
A/L
0
[R]z = cos(60) -sin(60) 0 0
sin(60) cos(60) 0 0
0
0
1 0
0
0
0 1
0 -A/L 0
1 0 0
0 V/L 0
0
0 1
6. Reverse [R]y
7. Reverse [R]x
V/L 0 A/L 0
[R]y-1= 0 1 0 0
-A/L 0 V/L 0
0 0 0 1
1
[R]x-1= 0
0
0
8. Reverse the Translation
1
[D]-1 = 0
0
0
0
1
0
0
0 6
0 -2
1 0
0 1
0
0 0
C/V B/V 0
-B/V C/V 0
0
0 1
9. Calculate the total transformation
[T ] = [ D]−1[ Rx ]−1[ Ry ]−1[ Rz60 ][ Ry ][ Rx ][ D]
P2 = [T ]P1
5.6471 10.2941 3.5000 5.6471
[P]2 = 3.4118 5.8235 -0.5000 3.4118
5.3468 0.5941 5.0498 5.3468
1.0000 1.0000 1.0000 1.0000
P1
P2
P3
P4
CCW
original
60
120
180