![Page 1: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/1.jpg)
1
2D Transformations
几何变换
![Page 2: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/2.jpg)
2
What is a transformation?
A transformation is an operation that transforms or changes a shape (line, drawing etc.)
There are several basic ways you can change a shape:
translation (moving it)
rotation (turning it round)
scaling (making it bigger or smaller).
There are others, but we’ll worry about them later.
![Page 3: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/3.jpg)
3
2D Geometrical Transformations
Translate
Rotate Scale
Shear
![Page 4: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/4.jpg)
4
Translation
Consider the arrow below. We may want to move it from position A to position B.
A
B
dx
dy
x
y
![Page 5: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/5.jpg)
5
Translate Points
We can translate points in the (x, y) plane to new positions by adding translation amounts to the coordinates of the points. For each point P(x, y) to be moved by dx units parallel to the x axis and by dy
units parallel to the y axis, to the new point P’(x’, y’ ). The translation has the following form:
y
x
dyy
dxx
'
'P(x,y)
P’(x’,y’)
dx
dy
![Page 6: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/6.jpg)
6
Translating a line or shape
To translate a line, simply translate both of its end points.
Translating a shape therefore, simply translate all of the points.
The same applies for all transformations.
![Page 7: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/7.jpg)
7
Scale Points
Points can be scaled (stretched) by sx along the x axis and by sy along the y axis into the new points by the multiplications:
We can specify how much bigger or smaller by means of a “scale factor”
To double the size of an object we use a scale factor of 2, to half the size of an obejct we use a scale factor of 0.5
ysy
xsx
y
x
'
'P(x,y)
P’(x’,y’)
xsx x
sy y
y
![Page 8: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/8.jpg)
8
We first review the idea of sin and cos for a given angle :
Useful formulas:
Rotate Points
sin
cos
/sin
/cos
|| 22
ly
lx
ly
lx
yxOPl
sin)sin(cos)cos(
sinsincoscos)cos(
sincoscossin)sin(
P
x
y
l
O
![Page 9: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/9.jpg)
9
Rotate Points (cont.)
Points can be rotated through an angle about the origin:
cossin
cossinsincos
)sin()sin(|'|'
sincos
sinsincoscos
)cos()cos(|'|'
|||'|
yx
ll
lOPy
yx
ll
lOPx
lOPOP
P(x,y)
P’(x’,y’)
xx’
y’
y
l
O
![Page 10: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/10.jpg)
10
Identity transformations
Some transformations lead to no change in the shape/drawing Translate(0,0) Rotate(0) Scale(1,1)
![Page 11: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/11.jpg)
11
Order of transformations
The order in which transformations are applied to a shape is important.
Performing a translation followed by a rotation, will give an entirely different drawing to a performing the rotation followed by
the same translation.
![Page 12: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/12.jpg)
12
Order of transformations
x
y
rotation by 45° followed by translation (100,0)
![Page 13: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/13.jpg)
13
Order of transformations
x
translation (100,0) followed by rotation by 45°
y
![Page 14: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/14.jpg)
14
Rotation around local origin
At the moment, our rotation is centred around the origin. What is often required is to spin the shape in its original location (in-situ)
x
y
local origin
![Page 15: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/15.jpg)
15
Rotation around local origin
This can be achieved by combining two of our existing transformations: Translate the shape to the origin, rotate it the required amount about the origin and translate it back to where it was.
![Page 16: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/16.jpg)
16
Local rotation
x
y
dy
dx
![Page 17: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/17.jpg)
17
Local rotation
x
y
![Page 18: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/18.jpg)
18
Local rotation
y
x
y
![Page 19: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/19.jpg)
19
Local rotation
x
+dy
+dx
![Page 20: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/20.jpg)
20
Summary
So we have looked at simple transformation of points/lines etc.
Next we will look at transformations using matrices.
![Page 21: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/21.jpg)
21
2D Transformations with Matrices
![Page 22: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/22.jpg)
22
2D Geometrical Transformations
Translate
Rotate Scale
Shear
![Page 23: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/23.jpg)
23
Translate Points
Recall.. We can translate points in the (x, y) plane to new positions by adding translation amounts to the coordinates of the points. For each point P(x, y) to be moved by dx units parallel to the x axis and by dy
units parallel to the y axis, to the new point P’(x’, y’ ). The translation has the following form:
y
x
dyy
dxx
'
'
P(x,y)
P’(x’,y’)
dx
dy
In matrix format:
y
x
d
d
y
x
y
x
'
'
If we define the translation matrix , then we have P’ =P + T.
y
x
d
dT
![Page 24: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/24.jpg)
24
Scale Points
Points can be scaled (stretched) by sx along the x axis and by sy along the y axis into the new points by the multiplications:
We can specify how much bigger or smaller by means of a “scale factor”
To double the size of an object we use a scale factor of 2, to half the size of an obejct we use a scale factor of 0.5
ysy
xsx
y
x
'
'
P(x,y)
P’(x’,y’)
xsx x
sy y
y
y
x
s
s
y
x
y
x
0
0
'
'
If we define , then we have P’ =SP
y
x
s
sS
0
0
![Page 25: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/25.jpg)
25
Rotate Points (cont.)
Points can be rotated through an angle about the origin:
cossin
cossinsincos
)sin()sin(|'|'
sincos
sinsincoscos
)cos()cos(|'|'
|||'|
yx
ll
lOPy
yx
ll
lOPx
lOPOP
P(x,y)
P’(x’,y’)
xx’
y’
y
l
O
y
x
y
x
cossin
sincos
'
'
P’ =RP
![Page 26: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/26.jpg)
26
Review…
Translate: P’ = P+T Scale: P’ = SP Rotate: P’ = RP
Spot the odd one out… Multiplying versus adding matrix… Ideally, all transformations would be the same..
easier to code Solution: Homogeneous Coordinates
![Page 27: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/27.jpg)
27
Homogeneous Coordinates
For a given 2D coordinates (x, y), we introduce a third dimension:
[x, y, 1]
In general, a homogeneous coordinates for a 2D point has the form:
[x, y, W]
Two homogeneous coordinates [x, y, W] and [x’, y’, W’] are said to be of the same (or equivalent) if
x = kx’ eg: [2, 3, 6] = [4, 6, 12]y = ky’ for some k ≠ 0 where k=2W = kW’
Therefore any [x, y, W] can be normalised by dividing each element by W:[x/W, y/W, 1]
![Page 28: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/28.jpg)
28
Homogeneous Transformations
Now, redefine the translation by using homogeneous coordinates:
Similarly, we have:
y
x
d
d
y
x
y
x
'
'
1100
10
01
1
'
'
y
x
d
d
y
x
y
x
PTP '
1100
00
00
1
'
'
y
x
s
s
y
x
y
x
1100
0cossin
0sincos
1
'
'
y
x
y
x
Scaling Rotation
P’ = S P P’ = R P
![Page 29: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/29.jpg)
29
Composition of 2D Transformations
1. Additivity of successive translations
We want to translate a point P to P’ by T(dx1, dy1) and then to P’’ by another T(dx2, dy2)
On the other hand, we can define T21= T(dx1, dy1) T(dx2, dy2) first, then apply T21 to P:
where
]),()[,('),('' 112222 PddTddTPddTP yxyxyx
PTP 21''
100
10
01
100
10
01
100
10
01
),(),(
21
21
1
1
2
2
112221
yy
xx
y
x
y
x
yxyx
dd
dd
d
d
d
d
ddTddTT
![Page 30: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/30.jpg)
30
T(-1,2) T(1,-1)
(2,1)
(1,3)
(2,2)
100
110
001
100
210
101
100
110
101
21T
Examples of Composite 2D Transformations
![Page 31: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/31.jpg)
31
Composition of 2D Transformations (cont.)
2. Multiplicativity of successive scalings
where
PS
PssSssS
PssSssSP
yxyx
yxyx
21
1122
1122
)],(),([
]),()[,(''
100
0*0
00*
100
00
00
100
00
00
),(),(
12
12
1
1
2
2
112221
yy
xx
y
x
y
x
yxyx
ss
ss
s
s
s
s
ssSssSS
![Page 32: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/32.jpg)
32
Composition of 2D Transformations (cont.)
3. Additivity of successive rotations
where
PR
PRR
PRRP
21
12
12
)]()([
])()[(''
100
0)cos()sin(
0)sin()cos(
100
0cossin
0sincos
100
0cossin
0sincos
)()(
1212
1212
11
11
22
22
1221
RRR
![Page 33: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/33.jpg)
33
Composition of 2D Transformations (cont.)
4. Different types of elementary transformations discussed above can be concatenated as well.
where
MP
PddTR
PddTRP
yx
yx
)],()([
]),()[('
),()( yx ddTRM
![Page 34: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/34.jpg)
34
Consider the following two questions:
1) translate a line segment P1 P2, say, by -1 units in the x direction and -2 units in the y direction.
2). Rotate a line segment P1 P2, say by degrees counter clockwise, about P1.
P1(1,2)
P2(3,3)
P’2
P’1
P1(1,2)
P2(3,3)P’2
P’1
![Page 35: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/35.jpg)
35
Other Than Point Transformations…
Translate Lines: translate both endpoints, then join them.
Scale or Rotate Lines: More complex. For example, consider to rotate an arbitrary line about a point P1, three steps are needed:1). Translate such that P1 is at the origin;2). Rotate;3). Translate such that the point at the origin returns to P1.
T(-1,-2) R()
P1(1,2)
P2(3,3)
P2(2,1)T(1,2)P2
P2
P1
P1P1
![Page 36: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/36.jpg)
36
Another Example.
Scale
Translate
Rotate
Translate
![Page 37: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/37.jpg)
37
Rigid-Body vs. Affine Transformations
A transformation matrix of the form
where the upper 22 sub-matrix is orthogonal, preserves angles and lengths. Such transforms are called rigid-body transformations, because the body or object being transformed is not distorted in any way. An arbitrary sequence of rotation and translation matrices creates a matrix of this form.
The product of an arbitrary sequence of rotation, translations, and scale matrices will cause an affine transformation, which have the property of preserving parallelism of lines, but not of lengths and angles.
1002221
1211
y
x
trr
trr
![Page 38: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/38.jpg)
38
Rigid-Body vs. Affine Transformations (cont.)
Shear transformation is also affine.
Unit cube45º
Scale in x, not in y
Rigid- bodyTransformation
AffineTransformation
Shear in the x direction Shear in the y direction
100
010
01 a
SH x
100
01
001
bSH y
![Page 39: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/39.jpg)
39
![Page 40: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/40.jpg)
40
![Page 41: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/41.jpg)
41
![Page 42: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/42.jpg)
42
P1
P3P2
1 2
1
2P2'
P1'P3'
1 2
1
2
3
Original Transformed
Translate P2->O, T(-1,-1) Rotate R(-90) Shear sHy(-1) Scale S(2,1) Translate O->P2’ T(1,2) M = T(1,2) * S(2,1)*sHy(-1)*R(-90)*T(-1,-1)=
100
411
120
![Page 43: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/43.jpg)
43
![Page 44: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/44.jpg)
44
![Page 45: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/45.jpg)
45
Prove that we can transform a line by transforming its endpoints and then constructing a new line between the transformed endpoints.
Answer:
S = P + t*(Q- P) , 0<= t <= 1
M can be any transform we discussed,then
S’ = M*S = M*(P + t*(Q-P))
= M*P + t*(M*Q – M*P))
= P’ + t*(Q’-P’)
Q
P
![Page 46: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/46.jpg)
46
3D Transformations
2D coordinates 3D coordinates
x
y
x
y
z
xz
y
Right-handed coordinate system:
![Page 47: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/47.jpg)
47
3D Transformations (cont.)
1. Translation in 3D is a simple extension from that in 2D:
2. Scaling is similarly extended:
1000
100
010
001
),,(z
y
x
zyx d
d
d
dddT
1000
000
000
000
),,(z
y
x
zyx s
s
s
sssS
![Page 48: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/48.jpg)
48
3D Transformations (cont.)
3. The 2D rotation introduced previously is just a 3D rotation
about the z axis.
similarly we have:X
Y
Z
1000
0100
00cossin
00sincos
)(
zR
1000
0cossin0
0sincos0
0001
)(
xR
1000
0cos0sin
0010
0sin0cos
)(
yR
![Page 49: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/49.jpg)
49
More Rotations
We have shown how to rotate about one of the principle axes, i.e. the
axes constituting the coordinate system. There are more we can do,
for example, to perform a rotation about an arbitrary axis:
X
Y
Z
P2(x2, y2 , z2)
P1(x1, y1 , z1)
We want to rotate an object about an
axis in space passing through (x1, y1, z1)
and (x2, y2, z2).
![Page 50: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/50.jpg)
50
Rotating About An Arbitrary AxisY
Z
P2
P1
1). Translate the object by
(-x1, -y1, -z1): T(-x1, -y1, -z1)
X
Y
ZP2
P1
2). Rotate the axis about x so that
it lies on the xz plane: Rx()
X
X
Y
ZP2
P1
3). Rotate the axis about y so
that it lies on z: Ry ()
X
Y
ZP2
P1
4). Rotate object about z by :
Rz()
![Page 51: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/51.jpg)
51
Rotating About An Arbitrary Axis (cont.)After all the efforts, don’t forget to undo the rotations and the translation!
Therefore, the mixed matrix that will perform the required task of rotating an
object about an arbitrary axis is given by:
M = T(x1,y1,z1) Rx(-)Ry(-) Rz() Ry() Rx()T(-x1,-y1,-z1)
Finding is trivial, but what about ?
The angle between the z axis and the
projection of P1 P2 on yz plane is .
X
Y
Z
P2
P1
![Page 52: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/52.jpg)
52
conclusion
snml
rihg
qfed
pcba1) Left_up 3*3 sub matrix:
scale, rotate, shear
2) [p q r]’: translate
3) [l m n] : projection
4) s : Global scale factor
![Page 53: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/53.jpg)
53
Viewing in 3D
![Page 54: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/54.jpg)
54
Projections
Display device (a screen) is 2D… How do we map 3D objects to 2D space?
2D to 2D is straight forward… 2D window to world.. and a viewport on the 2D surface. Clip what won't be shown in the 2D window, and map the
remainder to the viewport.
3D to 2D is more complicated… Solution : Transform 3D objects on to a 2D plane using
projections
![Page 55: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/55.jpg)
55
Projections
In 3D… View volume in the world Projection onto the 2D projection plane A viewport to the view surface
Process… 1… clip against the view volume, 2… project to 2D plane, or window, 3… map to viewport.
![Page 56: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/56.jpg)
56
Projections
Conceptual Model of the 3D viewing process
![Page 57: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/57.jpg)
57
![Page 58: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/58.jpg)
58
![Page 59: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/59.jpg)
59
Projections
Projections: key terms… Projection from 3D to 2D is defined by straight projection
rays (projectors) emanating from the 'center of projection', passing through each point of the object, and intersecting the 'projection plane' to form a projection.
![Page 60: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/60.jpg)
60
Types of projections
2 types of projections perspective and parallel.
Key factor is the center of projection. if distance to center of projection is finite : perspective if infinite : parallel
![Page 61: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/61.jpg)
61
Perspective v Parallel
Perspective: visual effect is similar to human visual system... has 'perspective foreshortening'
size of object varies inversely with distance from the center of projection.
angles only remain intact for faces parallel to projection plane.
Parallel: less realistic view because of no foreshortening however, parallel lines remain parallel. angles only remain intact for faces parallel to projection
plane.
![Page 62: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/62.jpg)
62
Perspective Projections
Any parallel lines not parallel to the projection plane, converge at a vanishing point. There are an infinite number of these, 1 for each of the
infinite amount of directions line can be oriented.
If a set of lines are parallel to one of the three principle axes, the vanishing point is called an axis vanishing point. There are at most 3 such points, corresponding to the
number of axes cut by the projection plane.
![Page 63: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/63.jpg)
63
Perspective Projections
Example: if z projection plane cuts the z axis: normal to it, so only z
has a principle vanishing point, as x and y are parallel and have none.
Can categorise perspective projections by the number of principle vanishing points, and the number of axes the projection plane cuts.
![Page 64: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/64.jpg)
64
Perspective Projections
2 different examples of a one-point perspective projection of a cube.(note: x and y parallel lines do not converge)
![Page 65: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/65.jpg)
65
Perspective Projections
Two-point perspective projection: This is often used in architectural, engineering
and industrial design drawings. Three-point is used less frequently as it adds little
extra realism to that offered by two-point perspective projection.
![Page 66: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/66.jpg)
66
Perspective Projections
Two-point perspective projection:
![Page 67: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/67.jpg)
67
Perspective Projections
p (x,y,z)
z
y
Projection plane
ps(xs,ys)C
d
By similar triangles:
p(x,y,z)
z
x
Projection plane
ps(xs,ys)C
d
d
x
dz
x s
dzx
xs
1
dzy
ys
1
![Page 68: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/68.jpg)
68
Perspective Projections
1
.
1/100
0000
0010
0001
1
0 z
y
x
dd
z
y
x
s
s
1
0
1
1
1
0
dzydz
x
d
z
y
x
s
s
s
s
![Page 69: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/69.jpg)
69
Parallel Projections
2 principle types: orthographic and oblique.
Orthographic : direction of projection = normal to the projection plane.
Oblique : direction of projection != normal to the projection plane.
![Page 70: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/70.jpg)
70
Parallel Projections
Orthographic (or orthogonal) projections: front elevation, top-elevation and side-elevation. all have projection plane perpendicular to a principle axes.
Useful because angle and distance measurements can be made...
However, As only one face of an object is shown, it can be hard to create a mental image of the object, even when several view are available.
![Page 71: 1 2D Transformations 几何变换. 2 What is a transformation? A transformation is an operation that transforms or changes a shape (line, drawing etc.) There](https://reader036.vdocuments.pub/reader036/viewer/2022081421/56649e8a5503460f94b8f9c3/html5/thumbnails/71.jpg)
71
Parallel Projections
Orthogonal projections: