Professional Documents
Culture Documents
3D Transformation-Edited - Compatibility Mode
3D Transformation-Edited - Compatibility Mode
3D Transformation-Edited - Compatibility Mode
Industrial Robot
PhD. Le Duc Do
Email: do.leduc@hust.edu.vn
Three Dimensional
(3D) Modeling
Transformations
1
11/19/2021
3D Point
We will consider points as column vectors.
Thus, a typical point with coordinates (x, y, z)
is represented as:
x
y
z
A 3D point P is represented in
homogeneous coordinates by a 4-dim.
Vect: x
y
P
z
1
6
2
11/19/2021
3D Coordinate Systems
Right Hand Left Hand coordinate
coordinate system: system:
3D Transformation
In homogeneous coordinates, 3D
transformations are represented by 4×4
matrixes:
a b c t
x
d e f t
y
g h i t
z
0 0 0 1
3
11/19/2021
3D Translation
10
3D Translation
P is translated to P' by:
x 1 0 0 t x x
y 0 1 0 t y y
z 0 0 1 tz z
1 0 0 0 1 1
P T P
11
3D Translation
An object is translated in 3D dimensional by
transforming each of the defining points of the
objects .
12
4
11/19/2021
3D Translation
An Object represented as a set of polygon surfaces, is translated
by translate each vertex of each surface and redraw the polygon
facets in the new position.
Inverse Translation:
1
T (t , t , t ) T (t ,t ,t )
x y z x y z
13
3D Translation
Example1: U is the vector represents a point in space to translational
movement:
u x y z
T
| 14 |
14
3D Translation
Example1: U is the vector represents a point in space to translational
movement:
u x y z T
and p is the vector indicating the direction and length to be shifted:
p px p y pz
T
Ans:
1 0 0 4 2 6
0 1 0 3 3 0
v Tp p x p y p z .u
0 0 1 7 2 9
0 0 0 1 1 1
| 15 |
15
5
11/19/2021
3D Rotation
16
3D Rotation
17
3D Rotation
The easiest rotation axes are those that parallel to
the coordinate axis.
18
6
11/19/2021
Coordinate Axis
Rotations
19
P R z (θ ) P
20
21
7
11/19/2021
P R () Px
22
23
24
8
11/19/2021
25
P T 1 R x (θ) T P
26
Rotation Axis
In general rotation vector does not pass through
origin
27
9
11/19/2021
y Basic Idea
T 1. Translate (x1, y1, z1) to the origin
(x2,y2,z2)
2. Rotate (x’2, y’2, z’2) on to the z axis
R
3. Rotate the object around the z-axis
(x1,y1,z1) 4. Rotate the axis to the original
orientation
x R-1
5. Translate the rotation axis to the
z original position
T-1
28
(x2,y2,z2)
1 0 0 x1
0 1 0 y1
(x1,y1,z1)
TTR
x
0 0 1 z1
z 0 0 0 1
29
y b b
sin
b2 c 2 d
(0,b,c) c c
(a,b,c)
cos
b2 c 2 d
Projected
Point 1 0 0 0 1 0 0 0
cos sin 0 0 c / d 0
x T 00
R x ( )
sin cos
0 0 b / d
b/ d
c/d 0
z
0 0 0 1 0 0 0 1
Rotated
Point
30
10
11/19/2021
y a d
sin , cos
l l
l 2 a 2 b2 c 2 a 2 d 2
(a,b,c)
d b2 c 2
Projected l
Point cos 0 sin 0 d / l 0 a / l 0
d 0 0 0
x T sin0
Ry
1 0
0 cos
0 a / l
1 0
0 d / l 0
(a,0,d)
0 0 0 1 0 0 0 1
Rotated
z Point
31
cos sin 0 0
sin cos 0 0
T
Rz
0 0 1 0
l
x
0 0 0 1
32
0 0 1 z1 0 sin cos 0
l
0 0 0 1 0 0 0 1
cos 0 sin 0
0 1 0 0
l
x
sin 0 cos 0
0 0 0 1
z
[TRarb ] [TTR ]1[TRx ]1[TR y ]1[TRz ][TR y ][TR x ][TTR ]
33
11
11/19/2021
34
R (r,φ) :
1 0 0 0 C 0 S 0
0 0 0
C S 1 0 0
R ( x , ) R ( y, )
0 S C 0 S 0 C 0
0 0 0 1 0 0 0 1
C S 0 0 C 0 S 0 1 0 0 0
S C 0 0 0 1 0 0 0 C S 0
R( z, ) R ( y , ) R ( x, )
0 0 1 0 S 0 C 0 0 S C 0
0 0 0 1 0 0 0 1 0 0 0 1
S rx / r; C ry2 rz2
1/ 2
/r V ver sin vers 1 cos |
35
Find the new coordinates of a unit cube 90º-rotated about an axis defined
by its endpoints A(2,1,0) and B(3,3,1).
36
12
11/19/2021
B’(1,2,1)
1 0 0 2
0 1 0 1
A’(0,0,0) x [TTR ]
0 0 1 0
z
0 0 0 1
37
2 2 2 5
sin
2 2 12 5 5
1 5
cos
y 5 5
Projected point
(0,2,1) B’(1,2,1)
l 12 2 2 12 6
l
1 0 0 0
x 5 2 5
0 0
z T 5 5
B”(1,0,5) Rx
2 5 5
0 0
5 5
0 0 0 1
38
1 6
sin
y 6 6
5 30
cos
6 6
l 30 6
x 0 0
(0,0,6) 6 6
B”(1,0, 5) T
Ry
0
6
1 0
30
0
0 0
z 6 6
0 0 0 1
39
13
11/19/2021
0 1 0 0
1 0 0 0
TRz 90
0 0 1 0
0 0 0 1
Finally, the concatenated rotation matrix about the arbitrary axis AB becomes,
40
41
P T P
*
Rarb
42
14
11/19/2021
x ' 1 0 0
0 x
y y
y ' 0 1 0 0 y
z z' 0 0 1 0 z
z x x 1 0 0 0 1 1
Z-axis
x ' Shear
1 0 a 0 x
y ' 0
1 b 0 y
z ' 0 0 1 0 z
1 0 0 0 1 1
43
1 0 0 tx So to translate by a
0 1 0 t y vector
M T (t x , t y , t z ) (1, 1, 1), the matrix is simply:
0 0 1 tz
0 0 0 1
1 0 0 1
0 1 0 1
M T (1,1,1)
0 0 1 1
0 0 0 1
44
1 0 0 0
1 0 0 0 1 1
0 cos 45 sin 45 0 0
0 2 2
R x ( 45) 1 1
0 sin 45 cos 45 0 0 0
0 0 0 1 2 2
0 0 0 1
45
15
11/19/2021
Q3 - Rotate by 45 about
axis <1, 1, 1>
So a rotation by 45 degrees about <1, 1, 1> can
be achieved by a few succesive rotations about
the major axes. Which can be represented as a
single composite transformation
2 2
d n x n z 2 1 .414
nx = 1
ny 1
ny = 1 SO tan 1 tan 1 35 . 264
d 2
nz = 1 nx 1
tan 1 tan 1 45
nz 1
46
47
48
16
11/19/2021
Homogeneous Directions
Translation does not affect directions!
Homogeneous coordinates give us a clear way of handling
this, e.g., direction (x,y) becomes homogeneous direction
(x,y,0), and remains the same after translation:
1 0 bx x x
0 1 b y y
y
0 0 1 0 0
(x, y, 0) is a vector, (x,y,1) is a point.
The same applies to rotation and scaling, e.g., scaling
changes the length of vector, but not direction
Normal vectors are slightly different though (can’t always
use the matrix for points to transform the normal vector)
49
R (θ ) T 1 R x 1 ( α ) R y1 (β ) R z (θ) R y (β ) R x ( α) T
50
51
17
11/19/2021
52
53
54
18
11/19/2021
Roll
Roll: rotation around the front-to-back axis.
55
PITCH
PITCH: Rotation around the side-to-side axis
56
YAW
YAW: Rotation around the vertical axis.
57
19
11/19/2021
| 58 |
58
An Example of the
Airplane
59
60
20
11/19/2021
Composite
3D Transformations
61
Composite 3D Transformations
62
Composite 3D Transformations
Ex4:
r x y z 1
B T
is:
| 63 |
63
21
11/19/2021
5. Euler Rotation:
64
Transformations
Between
Coordinate Systems
65
z z'
66
22
11/19/2021
67
R (r,φ) :
1 0 0 0 C 0 S 0
0 0 0
C S 1 0 0
R ( x , ) R ( y, )
0 S C 0 S 0 C 0
0 0 0 1 0 0 0 1
C S 0 0 C 0 S 0 1 0 0 0
0 0
S C 0 0 1 0 0 C S 0
R( z, ) R ( y , ) R ( x, )
0 0 1 0 S 0 C 0 0 S C 0
0 0 0 1 0 0 0 1 0 0 0 1
S sin ry / ry2 rz2
1/ 2
; C cos rz / ry2 rz2 1/ 2
S rx / r; C ry2 rz2
1/ 2
/r |
V ver sin vers 1 cos
68
Homeworks
Exercise 1:
Exercise 2:
Exercise 3:
Exercise 4:
69
23
11/19/2021
Suppose we have 3
coordinate systems A, B, C.
System B is related to system A
through transformation ATB
System C is related to system B
through transformation B TC
We have point P belongs to
the C system: PC
We need to find the
relationship of P in the A
system, denoted: PA
70
PB BTC . PC
PA ATB .PB
71
72
24
11/19/2021
73
-1
74
Describe an object
0 1 0 0 1 1 1 1 1 1
1 0 0 0 0 0 0 0 4 4
u1 R z ,90 o .u
0 0 1
.
0 0 0 2 2 0 0
0 0 0 1 1 1 1 1 1 1
u 2 R y ,90 o .u1 R y ,90 o .R z ,90 o .u
u3 T 4 ,0 ,0 .u T 4,0 ,0 .R y ,90 .R z ,90 .u H .u
2
o o
75
25
11/19/2021
76
77
78
26
11/19/2021
Square both sides of the above equations and then add them together,
we have:
v z wy wx u z u y vx 2 S2
2 2 2
1
S sin v z wy 2 wx u z 2 u y vx 2 (4)
2
When 0 1800
v z wy wx u z u y vx
2 2 2
tg (5)
u x v y wz 1
79
u x C ux cos
rx
V 1 cos
u x rx2V C
v y C v y cos (7)
v y ry2V C ry
V 1 cos
2
wz r V C
z
wy C wz cos
rz
V 1 cos
80
When 0 1800
Sin is always positive, according to eq.(3) we have rx, ry, rz always with
the same sign as the left side, so we can use the function Sgn(x) to
represent the relation .
u x cos
rx Sgn(vz w y )
1 cos
v y cos (8)
ry Sgn( wx u z )
1 cos
wz cos
rz Sgn(u y v x )
1 cos
81
27
11/19/2021
82
According to eq.(8): 0 1/ 2 1
rx ry rz
1 1 / 2 3
83
r
120 y
1/ 3
x 1/ 3
84
28
11/19/2021
w x C S ; w y S S ; w z C
85
Since the multi value of the arccos function and the sine function in the
denominator, it will be infinitive when =0 or =180°. People often use
arctg2 function (y, x) called variable arctg2 function or arctg2 function,
with the definition of the item being unique based on the sign of the y / x
ratio. The function returns the angle value in the range - ≤ ≤ by
checking the sign of y and x.
86
C S 0 0 u x vx wx p x C C C S S 0
S C 0 0 u y vy wy p y S C 0 0
.
0 0 1 0 u z vz wz p z S C S S C 0 (15)
0 0 0 1 0 0 0 1 0 0 0 1
87
29
11/19/2021
88
C w x S w y S ; w z C arctg 2 C w x S w y , w z
And:
S u x C u y S ; S v x C v y C
arctg 2 S u x C u y , S v x C v y
Thus, 3 Euler rotation angles are determined as follows :
arctg 2 w y , w x arctg 2 w y , w x
arctg 2 C w x S w y , w z (18)
arctg 2 S u x C u y , S v x C v y
89
90
30
11/19/2021
C u x S u y C v x S v x C wx S wy 0 C C S S C 0
S u C u S v x C v y S wx C w y 0 0 C S 0
x y
uz vz wz 0 S C S C C 0 (21)
0 0 0 1 0 0 0 1
91
arctg 2 u x , u y ; 180
arctg 2 u z , C u x S u y (22)
arctg 2S w x C w y , S v x C v y
92
y
arctan x if x 0
y
arctan if x 0 and y 0
x
y
arctan if x 0 and y 0
a tan 2 ( y , x ) x
if x 0 and y 0
2
if x 0 and y 0
2
undefined if x 0 and y 0
https://vi.wikipedia.org/wiki/H%E1%BB%87_t%E1%BB%8Da_%C4%91%E1%BB%99_c%E1%BB%B1c
93
31
11/19/2021
94
95
32