geometric transformations
DESCRIPTION
GEOMETRIC TRANSFORMATIONS. Review of Mathematical Preliminaries Points:. Vectors : directional lines. P 1 (x 1 ,y 1 ). P 0 (x 0 ,y 0 ). 1 . A vector has a direction and a length: Length: |V|=(x 2 + y 2 ) 1/2 A unit vector: |V| = 1 e.g.: Normalize a vector: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/1.jpg)
GEOMETRIC TRANSFORMATIONS
Yingcai Xiao
![Page 2: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/2.jpg)
Roadmap to Geometric Transformations
Start with 2D GT Extend to 3D GTPreview mathematicsExpress GT in four type of
notations◦Algebraic◦Matrix◦Logical◦Visual
![Page 3: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/3.jpg)
Review of Mathematical Preliminaries
Mathematical NotationsPoints:
0
00
yx
P
1
11 y
xP
Vectors: directional lines
P1(x1,y1)
P0(x0,y0)
01
0110 yy
xxPPV
Vy
Vx
yx
V
![Page 4: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/4.jpg)
1. A vector has a direction and a length: Length: |V|=(x2 + y2)1/2 A unit vector: |V| = 1 e.g.:
Normalize a vector:
2. Add two vectors
01
x
10
y
VV
v
v
yx
V
w
w
yx
W
wv
wv
yyxx
WV
3. Scalar Multiplication
yx
yx
V
![Page 5: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/5.jpg)
4. Dot product of two vectors scalar,
wvwv yyxxWV
WVWV
)cos(
V
W
•
V W if = 90 => cos = 0 => V W = 0. if < 90 => cos > 0 => V W > 0. if > 90 => cos < 0 => V W < 0.
5.Normal: a unit vector perpendicular to a surface
![Page 6: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/6.jpg)
. Lines y = mx+b e.g.: y = x; ax+by+c=0
Let f(x,y) = ax + by + cA point p(xp,yp) is on the line if f(xp,yp) = 0.When b < 0:p(xp,yp) is above the line if f(xp,yp) < 0.p(xp,yp) is below the line if f(xp,yp) > 0.When b > 0:p(xp,yp) is above the line if f(xp,yp) > 0.p(xp,yp) is below the line if f(xp,yp) < 0.
![Page 7: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/7.jpg)
Parametric Form: P(t)=P0+t(P1-P0); 0 <= t <= 1
P1(x1,y1)
P0(x0,y0)
P(t)=P0+t(P1-P0)
y(t)x(t)
y0
x0
y1
x1 t *(
y0
x0
)(*)(*
)()(
01
01
0
0
yytxxt
yx
tytx
![Page 8: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/8.jpg)
Where,x(t) = x0 + t * (x1 – x0)y(t) = y0 + t * (y1 – y0)0 <= t <= 1
x(t) = (1-t) * x0 + t * x1 y(t) = (1-t) * y0 + t * y10 <= t <= 1
![Page 9: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/9.jpg)
2D Transformations Translate a point The algebraic representation of translation of point P(x,y) by D(dx,dy) is x’= x + dx y’= y + dy Its “matrix” representation is
x’
y’
d x
d y
x
y
Its logical representation is
P’ = P + D Its visual representation is
P’ (x’,y’)
P(x,y) D(dx,dy)
![Page 10: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/10.jpg)
To move a shape: translate every vertex of the shape
0 5 10
5
10
X
Y
Before Translation
(4,5) (7,5)
After Translation
0 5 10
5
10
X
Y
(7,1)(10,1)
![Page 11: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/11.jpg)
Scaling (relative to the origin) Scale a point P(x,y) by S(sx, sy)
Algebraic: x’=sx* x
y’=sy* y
Matrix:
s
s
y
x
0
0
S
yx
ss
yx
y
x
00
''
Logic: P’ = SP or P’ = S(sx, sy)P
Scale a line P0P1 (scale each point) P0’=SP0
P1’=SP1
![Page 12: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/12.jpg)
Scale a shape: scale every vertex of the shape. Visual representation
0 5 10
5
10
X
Y
Before Scaling
(4,5) (7,5)
0 5 10
5
10
X
Y
After Scaling
(2,5/4)
(7/2,5/4)
Uniform Scaling: sx=sy
![Page 13: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/13.jpg)
Rotate (around the origin)Positive angles are measured counterclockwise from x axis to y axis. Rotate point (x,y) around the originAlgebraic representation:
x’ = x * cos - y * siny’ = x * sin + y * cos
Matrix representation:
Logic representation:
P’ = R P
![Page 14: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/14.jpg)
Visual representation
0 5 10
5
10
X
Y
0 5 10
5
10
X
Y
Rotate a shape: rotate every vertex of the shape
After Before
0 5 10
5
10
X
Y
(2.1, 4.9)
(4.9, 7.8)
0 5 10
5
10
X
Y
(5,2) (9,2)
Before Rotation After Rotation
![Page 15: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/15.jpg)
Summary Translation: P’ = P + D Scaling: P’ = S P Rotation: P’ = R P
1yx
wywxw
yx
Homogeneous Coordinates: P(x,y,w) (x,y) to (x,y,w) :
(x,y,w) to (x,y)
1
/
/
w y
w x
w
y
x
![Page 16: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/16.jpg)
),(
1001001
dydx
dydxT
' P T P
1 0 0
1 0
0 1
dy
dx
1
y
x
1
dy y
dx x
y’= y + dyw’=1x’= x + dx
P’’ = T(dx2 , dy2)P’ = T(dx2 , dy2) T(dx1 , dy1) P = T(dx2+dx1, dy2+dy1) P
![Page 17: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/17.jpg)
Scaling P’=S(Sx, Sy)P
11000000
W''
yx
ss
yx
y
x
P’’ = S(Sx2 , Sy2)P’ = S(Sx2 , Sy2)S(Sx1 , Sy1) P = S(Sx2Sx1, Sy2Sy1)P
![Page 18: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/18.jpg)
P’’=R(2)R(1)PP”=R(2+1)P
Rotation P’=R()P
1 1 0 0
0 cos sin
0 sin cos
1
' '
y
x
y
x
![Page 19: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/19.jpg)
Shear Transformation: SHx(a) and SHy(b) P’=SHx(a)P
110001001
'''
yxa
wyx
Shear in x against y by a (or an angle). x’ = x+ay y’ = y w’=1
![Page 20: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/20.jpg)
P’=SHy(b)P
110001001
'''
yx
bwyx
Shear in y against x by b (or an angle). x’=x y’=y + bx w’=1.
![Page 21: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/21.jpg)
0 5 10
5
10
X
Y
0 5 10
5
10
X
Y
Sheared in x Sheared in y
0 5 10
5
10
X
Y
Before Shear
![Page 22: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/22.jpg)
Rigid-body Transformation: T and R.change: location, orientation; not change: size, angle between elements.Affine Transformation: S, SHchange: size, location, angle; not change: line (parallelism).Note: uniform scaling is between the two. It
changes size but not angle.So far, our S, R, SH are all around the origin.
![Page 23: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/23.jpg)
Composition of 2D Transformation
Rotate the house around P1For every vertex (P) on the object: P’ = T(P1)R()T(-P1)Py y
x
After translation
of P1 to origin
y
xAfter rotation
y
x
P1
After translation
To P1
![Page 24: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/24.jpg)
Scale and rotate the house around P1 and move it to P2y
xP1
Original
house
y
xP1
Translate P1
to originy
x
Scale
y
x
Rotate
y
x
P2
Translate to
final position P2
![Page 25: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/25.jpg)
For every vertex (P) on the object: P’ = T(P2) R()S(Sx,Sy)T(-P1)P. Swap the order of operations: not permitted, except uniform scaling (sx=sy) can be swapped
with rotation.
![Page 26: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/26.jpg)
Window-to-Viewport Transformationworld-coordinate: inches, feet etc & screen-coordinate: pixels
y
World coordinates
Windowx
y
Screen coordinatesWindow
x
y
World coordinatesWindow x
y
Screen coordinates
Viewport 1 x
Viewport 2
Window in
world coordinates
Window translated
to origin
Window scale to
size of viewportTranslated by (u,v)
to final position
Maximum range of
screen coordinates
![Page 27: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/27.jpg)
Matrix Representation of 3D Transformation
x
y
z
Translation:
1 0 00 1 0
( , , )0 0 10 0 0 1
dxdy
T dx dy dzdz
Scaling: 0 0 00 0 0
( , , )0 0 00 0 0 1
x
yx y z
z
ss
S s s ss
![Page 28: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/28.jpg)
Rotation, around Z-axis:
cos sin 0 0sin cos 0 0
( )0 0 1 0 0 0 0 1
Rz
Rotation, around X-axis:
1 0 0 00 cos sin 0
( )0 sin cos 0 0 0 0 1
Rx
Rotation, around Y-axis:
cos 0 sin 00 1 0 0
( )-sin 0 cos 0 0 0 0 1
Ry
![Page 29: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/29.jpg)
Projection: Project 3D objects on to a 2D surface
(0,0,0)
d z
z
P( x, y, z )x
P’(xp, yp, zp)
xp
Projection Plane (View Plane)
( / ) 1p
p
x x d x xxd z d z d z d
( / ) 1p
p
y y d y yyd z d z d z d
![Page 30: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/30.jpg)
xp= x’ / w’ = x / (z/d + 1)yp= y’ / w’ = y / (z/d + 1)
1 0 0 0'0 1 0 0'0 0 0 0'
1' 10 0 1
x xy yz zw
d
''' 0' ( / ) 1
x xy yzw z d
![Page 31: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/31.jpg)
Foreshortening: The size of the projected object becomes
smaller when the object moves away from the eye.
z
P’1
P’2
P1 P2
Perspective Projection: the projection that has the foreshortening effect.
' '
1 0 0 00 1 0 0
; ' ;0 0 0 010 0 1
per perM P M P
d
![Page 32: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/32.jpg)
0
For computer-aided design (CAD), we can not have foreshortening. A meter long object should always measures to 1 meter regardless where it is.
Parallel Projection: d , lines of sight become parallel
View Plan
z
P1
P2
(0,0,0)
0
1 0 0 00 1 0 0
;0 0 0 00 0 0 1
par p pM x x y y
![Page 33: GEOMETRIC TRANSFORMATIONS](https://reader035.vdocument.in/reader035/viewer/2022062411/56813679550346895d9e08d9/html5/thumbnails/33.jpg)
Summary2D GTHomogeneous coordinates3D GTRigid body transformationAffine transformation Perspective Projection &
Foreshortening Parallel Projection