chapter 5 geometric transformations. topics 5.1 basic two-dimensional geometric transformations 5.2...
TRANSCRIPT
![Page 1: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/1.jpg)
Chapter 5
Geometric Transformations
![Page 2: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/2.jpg)
Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse Transformations 5.4 Two-Dimensional Composite Transformations 5.5 Other Two-Dimensional Transformations 5.6 Raster Methods for Geometric Transformations 5.7 OpenGL Raster Transformations 5.8 Transformations between Two-Dimensional Coordinate Systems 5.9 Geometric Transformations in Three-Dimensional Space 5.10 Three-Dimensional Translation 5.11 Three-Dimensional Rotation 5.12 Three-Dimensional Scaling 5.13 Composite Three-Dimensional Transformations 5.14 Other Three-Dimensional Transformations 5.15 Transformations between Three-Dimensional Coordinate Systems 5.16 Affine Transformations 5.17 OpenGL Geometric-Transformation Functions 5.18 Summary
![Page 3: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/3.jpg)
5.1 Basic Two-Dimensional Geometric Transformations
Operations that are applied to the geometric description of an object to change its position, orientation, or size are called geometric transformations.
Geometric transformations can be used to describe how objects might move around in a scene during an animation sequence or simply to view them from another angle.
![Page 4: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/4.jpg)
geometric transformations Translation Rotation Scaling Reflection shearing
![Page 5: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/5.jpg)
![Page 6: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/6.jpg)
Two-Dimensional Translation
We perform a translation on a single coordinate point by adding offsets to its coordinates so as to generate a new coordinate position.
To translate a two-dimensional position, we add translation distances, tx and ty to the original coordinates (x,y) to obtain the new coordinate position (x’,y’),
y
x
tyy
txx
'
'
![Page 7: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/7.jpg)
x
y
),( ''' yxP
),( yxP
y
xP
T
'
''
y
xP
y
x
t
tT
TPP
t
t
y
x
y
x
y
x
'
'
'
The two-dimensional translation equations in the matrix form
yt
xt
y
x
tyy
txx
'
'จากรู�ป
ให้
และ
จะได้
![Page 8: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/8.jpg)
Two-Dimensional Rotation
We generate a rotation transformation of an object by specifying a rotation axis and a rotation angle.
A two-dimensional rotation of an object is obtained by repositioning the object along a circular path in the xy plane.
Parameters for the two-dimensional rotation are The rotation angle θ A position (x,y) – rotation point (pivot
point)
![Page 9: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/9.jpg)
cossinsincos)sin(
sinsincoscos)cos('
'
rrry
rrrx
sin
cos
ry
rx
The two-dimensional rotation
x
y
),( ''' yxO
)0,0(P
),( yxO
Polar coordinate system
cossin
sincos'
'
yxy
yxx
![Page 10: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/10.jpg)
'
''
y
xO
ORO
y
x
y
x
'
'
'
cos sin
sin- cos
The two-dimensional rotation
y
xO
โดยที่��
matrixRotation cos sin
sin- cos
R
x
y
),( ''' yxO
)0,0(P
),( yxO
และ
![Page 11: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/11.jpg)
Ex. 1
0.5
1.0
![Page 12: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/12.jpg)
rrr
rrr
yyyxxy
xyyxxx
cos)(sin)(
sin)(cos)('
'
Rotation of a point about an arbitrary pivot position
x
y),( ''' yxO
),( rr yxP
),( yxO
PORO
y
x
yy
xx
y
x
r
r
r
r
*'
'
'
cos sin
sin - cos
โดยที่��
'
'*
yy
xxO
![Page 13: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/13.jpg)
Two-Dimensional Scaling
To alter the size of an object, we apply a scaling transformation.
A simple two-dimensional scaling operation is performed by multiplying object positions (x,y) by scaling factors sx and sy to produce the transformed coordinates (x’,y’).
y
x
syy
sxx
'
'
PSP
y
x
s
s
y
x
y
x
'
'
'
0
0
![Page 14: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/14.jpg)
Any positive values can be assigned to the scaling factors. Values less than 1 reduce the size of
object; Values greater than 1 produce
enlargements. Uniform scaling – scaling values have the
same value Differential scaling – unequal of the
scaling factor
![Page 15: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/15.jpg)
3P f
f
f
y
x
y
x
PSPSP
y
x
-s
s
y
x
s
s
y
x
*'
'
'
1 0
0 1
0
0
Scaling relative to a chosen fixed point
x
y1P
2P),( fff yxP
)1(
)1('
'
yfy
xfx
sysyy
sxsxx
![Page 16: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/16.jpg)
5.2 Matrix Representations and Homogeneous Coordinates
Many graphics applications involve sequences of geometric transformations.
Hence we consider how the matrix representations can be reformulated so that such transformation sequence can be efficiently processed.
Each of three basic two-dimensional transformations (translation, rotation and scaling) can be expressed in the general matrix form
![Page 17: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/17.jpg)
P and P ’ = column vectors, coordinate position
M1 = 2 by 2 array containing multiplicative factors, for translation M1 is the identity matrix
M2 = two-element column matrix containing translational terms, for rotation or scaling M2 contains the translational terms associated with the pivot point or scaling fixed point
21' MPMP
![Page 18: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/18.jpg)
y
x
t
t
y
x
y
x
10
01'
'
r
r
r
r
r
r
r
r
y
x
y
x
y
x
y
x
y
x
yy
xx
y
x
cos sin
sin- cos
cos sin
sin- cos
cos sin
sin- cos
'
'
'
'
f
f
y
x
y
x
y
x
-s
s
y
x
s
s
y
x
1 0
0 1
0
0 '
'
21' MPMP
Translation
Rotation
Scaling
![Page 19: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/19.jpg)
To produce a sequence of transformations such as scaling followed by rotation then translation, we could calculate the transformed coordinates one step at a time.
A more efficient approach is to combine the transformations so that the final coordinate positions are obtained directly from the initial coordinates, without calculating intermediate coordinate values.
![Page 20: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/20.jpg)
Homogeneous Coordinates
Multiplicative and translational terms for a two-dimensional geometric transformations can be combined into a single matrix if we expand the representations to 3 by 3 matrices.
Then we can use the third column of a transformation matrix for the translation terms, and all transformation equations can be expressed as matrix multiplications.
![Page 21: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/21.jpg)
But to do so, we also need to expand the matrix representation for a two-dimensional coordinate position to a three-element column matrix.
A standard technique for accomplishing this is to expand each two-dimensional coordinate-position representation (x,y) to a three-element representation (xh,yh,h), called homogeneous coordinates, where the homogeneous parameter h is a nonzero value such that
,h
yy
h
xx hh
![Page 22: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/22.jpg)
A convenient choice is simply to set h=1. Each two-dimensional position is then
represented with homogeneous coordinate (x,y,1).
The term “homogeneous coordinates” is used in mathematics to refer to the effect of this representation on Cartesian equations.
![Page 23: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/23.jpg)
![Page 24: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/24.jpg)
PttTP
y
x
t
t
y
x
yx
y
x
),(
11 0 0
10
01
1
'
'
'
PRP
y
x
y
x
)(
11 0 0
0 cos sin
0 sin- cos
1
'
'
'
PssSP
y
x
s
s
y
x
yx
y
x
),(
11 0 0
0 0
0 0
1
'
'
'
Translation
Rotation
Scaling
![Page 25: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/25.jpg)
5.3 Inverse Transformations
1 0 0
- 10
- 011
y
x
t
t
T
1 0 0
0 cos sin
0 sin cos 1
R
1 0 0
0 1
0
0 0 1
1
y
x
s
s
S
Inverse translation matrix
Inverse rotation matrix
Inverse scaling matrix
![Page 26: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/26.jpg)
5.4 Two-Dimensional Composite Transformations
Using matrix representations, we can set up a sequence of transformations as a composite transformation matrix by calculating the product of the individual transformations.
Thus, if we ant to apply two transformations to point position P, the transformed location would be calculated as
PMP
PMMP
'
12'
![Page 27: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/27.jpg)
(a) (b)
(c)(d)
(1,1) (2,1)
(1,3) (2,3)
(3,2)
(-2,-1) (-1,-1)
(-1,1)(-2,1)
(-1.23,-1.87)
(-0.37,-1.37)
(-1.37,0.37)(-2.23,-0.13)
(1.77,0.13)
(2.63,0.63)
(1.63,2.37)
(0.77,1.87)
![Page 28: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/28.jpg)
Composite Two-dimensional Translations
),(),(),(
1 0 0
1 0
0 1
1 0 0
1 0
0 1
1 0 0
1 0
0 1
matrixation transformcomposite
)},(),({
}),({),(
21211122
21
21
1
1
2
2
1122'
1122'
yyxxyxyx
yy
xx
y
x
y
x
yxyx
yxyx
ttttTttTttT
tt
tt
t
t
t
t
PttTttTP
PttTttTP
![Page 29: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/29.jpg)
Composite Two-dimensional Rotations
)()()(
matrixation transformcomposite
)}()({
})({)(
2112
12'
12'
RRR
PRRP
PRRP
![Page 30: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/30.jpg)
![Page 31: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/31.jpg)
Composite Two-dimensional Scaling
),(),(),(
1 0 0
0 0
0 0
1 0 0
0 0
0 0
1 0 0
0 0
0 0
matrixation transformcomposite
21211122
21
21
1
1
2
2
yyxxyxyx
yy
xx
y
x
y
x
ssssSssSssS
SS
SS
S
S
S
S
![Page 32: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/32.jpg)
General Two-dimensional Pivot-Point Rotation
A transformation sequence for rotating an object about a sepcified pivot point using the rotation matrix R(θ). Translate the object so that the pivot-point
position is moved to the coordinate origin. Rotate the object about the coordinate
origin. Translate the object so that the pivot point
is returned to its original position.
![Page 33: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/33.jpg)
(xr,yr) (xr,yr)
(xr,yr) (xr,yr)
(a) (b)
(c) (d)
![Page 34: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/34.jpg)
),,(),()(),(
1 0 0
sincos1 cos sin
sincos1 sin- cos
1 0 0
- 1 0
- 0 1
1 0 0
0 cos sin
0 sin- cos
1 0 0
1 0
0 1
rrrrrr
rr
rr
r
r
r
r
yxRyxTRyxT
θxθ)-(y
θyθ)-(x
y
x
y
x
![Page 35: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/35.jpg)
General Two-dimensional Fixed-Point Scaling
A transformation sequence to produce a two-dimensional scaling with respect to a selected fixed position (xf,yf). Translate the object so that the fixed point
coincides with the coordinate origin. Scale the object with respect to the coordinate
origin. Use the inverse of the translation in step (1) to
return the object to its original position.
![Page 36: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/36.jpg)
(xf,yf) (xf,yf)
(xf,yf) (xf,yf)
(a) (b)
(c) (d)
![Page 37: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/37.jpg)
)),(,,(),(),(),(
1 0 0
1 1
1 0
1 0 0
- 1 0
- 0 1
1 0 0
0 0
0 0
1 0 0
1 0
0 1
yxffffyxff
yfy
xfx
f
f
y
x
f
f
ssyxSyxTssSyxT
)-s(ys
)-s(xs
y
x
s
s
y
x
![Page 38: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/38.jpg)
General Two-dimensional Scaling Directions
We can scale an object in other directions by rotating the object to align the desired scaling directions with the coordinate axes before applying the scaling transformation.
Suppose we want to apply scaling factors with values specified by parameters s1 and s2 in the directions shown in fig.
x
y
s1
s2
![Page 39: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/39.jpg)
1 0 0
0 )(
0 )(
)(),()(R 22
2112
122
22
1
211-
CossSinsSinCosss
SinCosssSinsCoss
RssS
The composite matrix resulting from the product of
- rotation so that the directions for s1 and s2 coincide with the x and y axes- scaling transformation S(s1,s2)- opposite rotation to return points to their original orientations
![Page 40: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/40.jpg)
y
x x
y
(1,1)(0,1)
(1,0)(0,0) (0,0)
(3/2,1/2)
(1/2,3/2)
(2,2)
s1= 1 s2=2
![Page 41: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/41.jpg)
Matrix Concatenation Properties
Transformation products may not be commutative.
The matrix product M2M1 is not equal to M1M2. This means that if we want to translate and
rotate an object, we must be careful about the order in which the composite matrix is evaluated.
Reversing the order in which a sequence of transformations is performed may affect the transformed position of an object.
![Page 42: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/42.jpg)
1 Translation
2 Rotation
2 Translation1 Rotation
![Page 43: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/43.jpg)
General Two-dimensional Composite Transformations and Computational Efficiency
11 0 0
1
'
'
y
x
trsrsrs
trsrsrs
y
x
yyyyx
xxyxx
rs** are the multiplicative rotation-scaling terms (rotation angles, scaling factors)
trsx and trsy are the translation terms (translation distances, pivot-point and fixed-point coordinates, rotation angles, scaling parameters)
![Page 44: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/44.jpg)
Scale and rotate about its centroid coordinates (xc,yc)
and translate
Example
1 0 0
sin)cos1( cos sin
sin)cos1( sin- cos
),,,(),,(),(
yxcycyx
xycxcyx
yxccccyx
tsxsyss
tsysxss
ssyxSyxRttT
![Page 45: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/45.jpg)
Two-dimensional Rigid-body Transformation
1 0 0
yyyyx
xxyxx
trrr
trrr
If a transformation matrix includes only translation and rotation parameters, it is a rigid-body transformation matrix.
r** are the multiplicative rotation terms (rotation angles) trx and try are the translation terms (translation
distances, pivot-point and fixed-point coordinates, rotation angles)
![Page 46: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/46.jpg)
5.5 Other Two-Dimensional Transformations
Reflection For a two-dimensional reflection, the
image is generated relative to an axis of reflection by rotating the object 180º about the reflection axis.
![Page 47: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/47.jpg)
Reflection about the line y=0 (the x axis)
1 0 0
0 1- 0
0 0 1
![Page 48: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/48.jpg)
Reflection about the line x=0 (the y axis)
1 0 0
0 1 0
0 0 1
![Page 49: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/49.jpg)
Reflection about any reflection point in the xy plane
Reflection point
1 0 0
0 1- 0
0 0 1
![Page 50: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/50.jpg)
Reflection about the reflection axis y=x
1 0 0
0 0 1
0 1 0
1. Rotate the line y=x with respect to the original through a 45 angle
2. Reflection with respect to the x axis
3. Rotate the line y=x black to its original position with a counterclockwise rotation through 45
![Page 51: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/51.jpg)
Reflection about the reflection axis y=-x
1 0 0
0 0 1-
0 1- 0
1. Clockwise rotate the line y=-x with respect to the original through a 45 angle
2. Reflection with respect to the y axis
3. Rotate the line y=-x black to its original position with a counterclockwise rotation through 45
y = -x
![Page 52: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/52.jpg)
Shear A transformation that distorts the
shape of an object such that the transformed shape appears as if the object were composed of internal layers that had been caused to slide over each other is called a shear.
![Page 53: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/53.jpg)
An x-direction shear
matrixtiontransforma
shx
1 0 0
0 1 0
0 1
y
(1,1)(0,1)
(1,0)(0,0)
y
(0,0)
(3,1)(2,1)
shx = 2
(1,0)
![Page 54: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/54.jpg)
We can generate x-direction shears relative to other reference lines
matrixtiontransforma
y-shsh refxx
1 0 0
0 1 0
1
y
(1,1)(0,1)
(1,0)(0,0)
y
(0,0)
(2,1)(1,1)
shx = ½
yref = -1(1/2,0)
yref = -1 yref = -1
(3/2,0)
![Page 55: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/55.jpg)
![Page 56: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/56.jpg)
A y-direction shears relative to the line x=xref is generated with
matrixtiontransformax-shsh refyy
1 0 0
1
0 0 1
y
(1,1)(0,1)
(1,0)(0,0)
y
(0,0)
(1,2)
(0,3/2)
shy = ½
xref = -1
(1,1)
xref = -1 xref = -1
(0,1/2)
![Page 57: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/57.jpg)
![Page 58: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/58.jpg)
Shear operations can be expressed as sequences of basic transformations.
The x-direction shear matrix
can be represented as a composite transformation involving a series of rotation and scaling metrices.
1 0 0
0 1 0
0 1 xsh
![Page 59: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/59.jpg)
![Page 60: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/60.jpg)
5.6 Raster Methods for Geometric Transformations
Functions that manipulate rectangular pixel arrays are called raster operations and moving a block of pixel values from one position to another is termed a block transfer, a bitblt or a pixblt.
All bit settings in the rectangular area are copied as a block into another part of the frame buffer.
We can erase the pattern at the original location by assigning the background color to all pixels within that block.
![Page 61: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/61.jpg)
![Page 62: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/62.jpg)
(c) (b) (a)
1 2 3
4 5 6
7 8 9
10 11 12
10 7 4 1
11 8 5 2
12 9 6 3
12 11 10
9 8 7
6 5 4
3 2 1
Array rotations that are not multiples of 90º
The original array is shown in (a),
the positions of the array elements after a 90º counterclockwise rotation are shown in (b), and
the position of the array elements after a 180º rotation are shown in (c).
![Page 63: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/63.jpg)
5.7 OpenGL Raster Transformations
A translation of a rectangular array of pixel-color values from one buffer area to another can be accomplished in OpenGL as a copy operation:
glCopyPixels(xmin, ymin, width, height, GL_COLOR);
This array of pixels is to be copied to a rectangular area of a refresh buffer whose lower-left corner is at the location specified by the current raster position.
![Page 64: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/64.jpg)
We can rotate a block of pixel-color values in 90-degree increments by first saving the block in an array,
glReadPixels(xmin, ymin, width, height, GL_RGB, GL_UNSIGNED_BYTE, colorArray);
then rearranging the elements of the array and placing it back in the refresh buffer.
glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, colorArray);
We set the scaling facters with
glPixelZoom(sx,sy);
![Page 65: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/65.jpg)
5.8 Transformations between Two-Dimensional Coordinate Systems
y
x
x ’
xn
yn
y ’
θ
A Cartesian x’y’ system specified with coordinate origin (xn,yn) and orientation angle θ in a Cartesian xy reference frame.
![Page 66: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/66.jpg)
To transform object descriptions from xy coordinates to x’y’ coordinates, we set up a transformation that superimposes the axes onto the x’y’ axes.
This is done in two steps: Translate so that the origin (xn,yn) of the x’y’
system is moved to the origin (0,0) of the xy system.
Rotation the x’ axis onto the x axis.
![Page 67: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/67.jpg)
y
x
x ’
xn
yn
y ’
θ
y
x
x ’
y ’
θ
P
P
x
y
y ’
x ’
1 0 0
1 0
0 1
),( )1 n
n
nn y
x
yxTnTranslatio
![Page 68: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/68.jpg)
y
x
x ’
y ’
θ
P
x
y
y ’
x ’
1 0 0
0 cos sin-
0 sin cos
)( 2.1)
)2
R
rotationclockwise
y
x
y ’
P
x
y
),()( '', nnyxxyyxTRMmatrixcomposite
![Page 69: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/69.jpg)
OR 2.2) An alternate method for
describing the orientation of the x’y’ coordinate system is to specify a vector V that indicates the direction for the positive y’ axis.
We can specify vector V as a point in the xy reference frame relative to the origin of the xy system, which we can convert to the unit vector,
y
x
x ’
xn
yn
y ’
θ
PV),(
V
Vyx vvv
![Page 70: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/70.jpg)
We obtain the unit vector u along the x’ axis by applying a 90º clockwise rotation to vector v
The matrix to rotate the x’y’ system into coincidence with the xy system can be written as
),(),( yxxy uuvvu
100
0
0
vv
uu
R yx
yx
![Page 71: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/71.jpg)
OR In the case that we
coordinates of P0 and P1 are known,
y
x
x ’
xn
yn
y ’
θ
PV
),(P-P
P-P
01
01yx vvv
P1
P0
![Page 72: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/72.jpg)
(xf,yf) (xf,yf)
(xf,yf)
(a) (b)
(e)
(xf,yf)
(c)
(xf,yf)
(d)
![Page 73: Chapter 5 Geometric Transformations. Topics 5.1 Basic Two-Dimensional Geometric Transformations 5.2 Matrix Representations and Homogeneous Coordinates](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649eb35503460f94bba6e5/html5/thumbnails/73.jpg)
(xf,yf)
(f)
(xf,yf)