Sei sulla pagina 1di 16

# Rotation about an Arbitrary Axis (Line)

## Rotation about an Arbitrary Axis (Line)

Z L
P1
P2 P1
Z0

P0 CC
Y
O
Y0 LL
X0

X AB
P0 B
A
x = Au + x0
y = Bu + y0 0 < =u <=1
z = Cu + z0
L = A2 + B 2 + C 2 u
Step 1: Translate Point P0 to Origin O

T
P0 = [ xo yo zo ] z P1(A,B,C)

⎡1 0 0 − x0 ⎤ C
y
⎢0 1 0 − y0 ⎥⎥
[D] = ⎢ B
⎢0 0 1 − z0 ⎥
A x
O
⎢ ⎥
⎣0 0 0 1 ⎦ P0
Step 2: Rotate Vector about X Axis to get into the x - z plane

L = A2 + B 2 + C 2
V = B2 + C 2
V B
L sin θ1 =
V
C
cosθ1 =
V

1 0 0 0⎤
⎡1 0 0 0⎤ ⎡⎢ C B ⎥
⎢0 cosθ 0 − 0⎥
1 − sin θ1 0⎥⎥ ⎢ V V
[Rx ] = ⎢ = ⎢ ⎥
⎢0 sin θ1 cosθ1 0⎥ ⎢0 B C
0⎥
⎢ ⎥
⎣0 0 0 1⎦ ⎢ V V ⎥
⎢⎣0 0 0 1⎦⎥
X
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

⎡V A ⎤
0 − 0 ⎥
⎡ cos θ 2 0 sin θ 2 0 ⎤ ⎢ L L
⎢ 0 ⎥ ⎢ ⎥
1 0 0 ⎥ ⎢ 0 1 0 0 ⎥
⎡⎣ Ry ⎤⎦ = ⎢ =
⎢ − sin θ 2 0 cos θ 2 0 ⎥ ⎢ A V ⎥
⎢ ⎥ ⎢ L 0 0 ⎥
⎣ 0 0 0 1 ⎦ ⎢ L ⎥
⎢⎣ 0 0 0 1 ⎥⎦

Step 4: Rotate angle θ about axis
L

## ⎡cosθ − sin θ 0 0⎤

⎢ sin θ cosθ 0 0⎥⎥
[Rz ] = ⎢
⎢ 0 0 1 0⎥
⎢ ⎥
⎣ 0 0 0 1⎦
Step 5: Reverse the rotation about the Y axis

⎡ V A ⎤ V A
⎢ L 0 0⎥ ⎡ cosθ 2 0 sin θ 2 0⎤ ⎡⎢ 0 −
⎤
0⎥
L L L
⎢ 0 1 0 0⎥ ⎢ 0 1 0 ⎥
0⎥
[ ]−1
R y = ⎢ A V ⎥ [ ]
R y = ⎢
⎢
= ⎢ 0A 1 0 0⎥
⎥
⎢− 0 0⎥ ⎢− sin θ 2 0 cosθ 2 0⎥ ⎢ V
0 0⎥
⎢ L L ⎥ ⎢ ⎥
1⎦ ⎢ L L
⎢⎣ 0 0 0 1⎥⎦ ⎣ 0 0 0
⎢⎣ 0 0 0
⎥
1⎥⎦

Inverse of Rotation:
Replace θ by –θ
sin θ by – sin θ
cos θ remains cos θ (why?)
Step 6: Reverse rotation about the X axis

⎡ 1 0 0 0⎤
⎢ C B ⎥
⎢ 0 0⎥
[ x ] = ⎢ VB
R
−1 V
C ⎥
⎢ 0 − 0⎥
⎢ V V ⎥
⎢⎣ 0 0 0 1⎥⎦

1 0 0 0⎤
⎡1 0 0 0⎤ ⎡⎢ C B ⎥
⎢0 cosθ 0 − 0⎥
1 − sin θ1 0⎥⎥ ⎢ V V
[Rx ] = ⎢ = ⎢ ⎥
⎢0 sin θ1 cosθ1 0⎥ ⎢0 B C
0⎥
⎢ ⎥
⎣0 0 0 1⎦ ⎢ V V ⎥
⎢⎣0 0 0 1⎥⎦
Step 7: Reverse translation

⎡ 1 0 0 x 0 ⎤
⎢ ⎥
⎢ 0 1 0 y 0 ⎥
−1
[D] = ⎢ ⎥
⎢ 0 0 1 z 0 ⎥
⎢ ⎥
⎣ 0 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
P1 P2 P3 P4
An Example 3 10 1 3
[P1]= 5 6 1 5
0 0 0 0
Given the point matrix (four 1 1 1 1
points) on the right; and a line,
NM, with point N at (6, -2, 0) 1.  Calculate the constants
and point M at (12, 8, 0). (the Line/Axis of Rotation)
x = 6 + 6u
Rotate the these four points 60 y = −2 + 10u
degrees around line NM (alone
z=0
the N to M direction) N: u=0;
M: u=1 Thus
A = 6, B = 10, C = 0
A = 12 − 6 = 6
Po = N
B = 8 − (−2) = 10 L = A2 + B 2 + C 2 = 11.6619
P1 = M
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 [R]x = 1 0 0 0
010 2 0 C/V -B/V 0
001 0 0 B/V C/V 0
000 1 0 0 0 1

## [R]y = V/L 0 -A/L 0 [R]z = cos(60) -sin(60) 0 0

0 1 0 0 sin(60) cos(60) 0 0
A/L 0 V/L 0 0 0 1 0
0 0 0 1 0 0 0 1
6. Reverse [R]y 7. Reverse [R]x

V/L 0 A/L 0 1 0 0 0
[R]y-1= 0 1 0 0 [R]x-1= 0 C/V B/V 0
-A/L 0 V/L 0 0 -B/V C/V 0
0 0 0 1 0 0 0 1

## 8. Reverse the Translation

1 0 0 6
[D]-1 = 0 1 0 -2
0 0 1 0
0 0 0 1
9. Calculate the total transformation

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