0% found this document useful (0 votes)
13 views38 pages

Homogenous Coordinates and Composite Transformations

The document discusses 2D geometric transformations, including homogeneous representations and matrix representations for translation, rotation, and scaling. It explains how to efficiently process transformation sequences using composite transformation matrices and provides formulas for inverse transformations. Additionally, it covers general pivot point rotation and fixed point scaling methods.

Uploaded by

Vikas Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views38 pages

Homogenous Coordinates and Composite Transformations

The document discusses 2D geometric transformations, including homogeneous representations and matrix representations for translation, rotation, and scaling. It explains how to efficiently process transformation sequences using composite transformation matrices and provides formulas for inverse transformations. Additionally, it covers general pivot point rotation and fixed point scaling methods.

Uploaded by

Vikas Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Objectives

 Homogenenous Representations and


Coordinates
 2D Composite Transformations

2D Geometric Transformations 1
Matrix Representations and Homogeneous
Coordinates

 Many graphics applications involve


sequences of geometric transformations
 Animations- An animation, for example, might
require an object to be translated and rotated at
each increment of the motion.
 Design and picture construction applications –
here we perform translations, rotations, and
scaling to fit the picture components into their
proper positions.

2D Geometric Transformations 2
Matrix Representations and Homogeneous
Coordinates
 We will now consider how the matrix
representations discussed in the previous
sections can be reformulated so that
transformation sequences can be efficiently
processed

2D Geometric Transformations 3
 Rotation - 𝑃′ = 𝑅. 𝑃
 Scaling - 𝑃′ = 𝑆. 𝑃
 Translation - 𝑃′ = 𝑃 + 𝑇

2D Geometric Transformations 4
Matrix Representations and
Homogeneous Coordinates (cont.)
 P’ = M1 · P + M2
 P and P’ are column vectors
𝑥′ 𝑎 𝑏 𝑥 𝑡1
P'= ′ , 𝑀1 = P= 𝑦 𝑀2 =
𝑦 𝑐 𝑑 𝑡2
 M1 is a 2 by 2 array containing multiplicative
factors
 M2 is a 2 element column matrix containing
translational terms

2D Geometric Transformations 5
Matrix Representations and Homogeneous
Coordinates (cont.)
 P’ = M1 · P + M2
 For translation M1 is the identity matrix
𝑥′ 1 0 𝑥 𝑡1
′ = . 𝑦 + 𝑡
𝑦 0 1 2
 For rotation M2 is the pivot point
𝑥′ 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 𝑥 𝑥𝑟
′ = . 𝑦 + 𝑦
𝑦 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑟
 For scaling M2 is the fixed point
𝑥′ 𝑆𝑥 0 𝑥 𝑥𝑓
′ = 0 𝑆𝑦 . 𝑦 + 𝑦𝑓
𝑦

2D Geometric Transformations 6
Matrix Representations and
Homogeneous Coordinates (cont.)
 All transformation equations can be expressed as
𝑎 𝑏 𝑡1
matrix multiplications. = 𝑐 𝑑 𝑡2
ℎ1 ℎ2 ℎ
 It becomes the three element representations –
 (𝑥ℎ , 𝑦ℎ ,ℎ) is the homogenous coordinates
 ℎ is the homogenous parameter which is a non-
zero value.
 h is the homogeneous parameter such that x =
xh/h, y = yh/h,

2D Geometric Transformations 7
Matrix Representations and Homogeneous
Coordinates (cont.)

𝑎 𝑏 𝑡1
 Now M = 𝑐 𝑑 𝑡2 and P’ = M· P
ℎ1 ℎ2 ℎ

2D Geometric Transformations 8
Matrix Representations and
Homogeneous Coordinates (cont.)
 To produce a sequence of operations, 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
transformations, without calculating
intermediate coordinate values

2D Geometric Transformations 9
Matrix Representations and
Homogeneous Coordinates (cont.)
 Multiplicative and translational terms for a 2D
geometric transformation can be combined
into a single matrix if we expand the
representations to 3 by 3 matrices
 We can use the third column for translation terms,
and all transformation equations can be
expressed as matrix multiplications

2D Geometric Transformations 10
Matrix Representations and
Homogeneous Coordinates (cont.)
 2D Translation Matrix
 x' 1 0 tx   x
 y '  0 1 t y    y 
  
 1  0 0 1   1 

or, P’ = T(tx,ty)·P

2D Geometric Transformations 11
Matrix Representations and
Homogeneous Coordinates (cont.)
 2D Rotation Matrix

 x' cos   sin  0  x 


 y '   sin  cos  0   y 
  
 1   0 0 1  1 

or, P’ = R(θ)·P

2D Geometric Transformations 12
Matrix Representations and
Homogeneous Coordinates (cont.)
 2D Scaling Matrix
 x'  s x 0 0  x 
 y '   0 sy 0   y 
  
 1   0 0 1  1 

or, P’ = S(sx,sy)·P

2D Geometric Transformations 13
Each point is now represented by a triple: (x, y, W)
x/W, y/W are called the Cartesian
coordinates of the homogeneous points.
Two homogeneous 
coordinates (x1, y1, w1) & (x2,2y, w2)
may represent the same point, iff they are multiples of one
another: (1,2,3) & (3,6,9).
There is no unique homogeneous representation of a point.

All triples of the form (tx,


ty, tW) form a line in x,y,W
space.

Cartesian coordinates
are just the plane w=1 in
this space.

W=0, are the points at infinity


Inverse Transformations

 2D Inverse Translation Matrix


1 0  tx 
T 1  0 1  t y 
0 0 1 
 By the way:
1
T *T  I

15
Inverse Transformations (cont.)

 2D Inverse Rotation Matrix


 cos  sin  0
R 1 
  sin  cos  
0
 0 0 1

 And also:

1
R *R  I

2D Geometric Transformations 16
Inverse Transformations (cont.)

 2D Inverse Rotation Matrix:


 If θ is negative  clockwise
 In
1
R *R  I
 Only sine function is affected
 Therefore we can say
1
R R T

17
Inverse Transformations (cont.)

 2D Inverse Scaling Matrix


1 
s 0 0
 x 
1
S 1
0 0
 sy 
0 0 1
 
 
 Of course:
1
S *S  I
2D Composite Transformations

 We can setup a sequence of transformations


as a composite transformation matrix by
calculating the product of the individual
transformations
 P’=M2·M1·P
=M·P

2D Geometric Transformations 19
2D Composite Transformations
(cont.)
 Composite 2D Translations
 If two successive translation are applied to a point P,
then the final transformed location P' is calculated as

P '  T(t x2 , t y2 )  T(t x1 , t y1 )  P  T(t x1  t x2 , t y1  t y2 )  P

1 0 t 2 x  1 0 t1x  1 0 t1x  t 2 x 
0 1 t   0 1 t   0 1 t  t 
 2y   1y   1y 2y 

0 0 1  0 0 1  0 0 1 

2D Geometric Transformations 20
2D Composite Transformations
(cont.)
 Composite 2D Rotations

P'  R(1   2 )  P

cos  2  sin  2 0 cos 1  sin 1 0 cos(1   2 )  sin(1   2 ) 0


 sin  cos  0    sin  cos  0   sin(   ) cos(   ) 0
 2 2   1 1   1 2 1 2 
 0 0 1  0 0 1  0 0 1

2D Geometric Transformations 21
2D Composite Transformations
(cont.)
 Composite 2D Scaling

S (sx2 , s y2 )  S (sx1 , s y1 )  S (sx1  sx2 , s y1  s y2 )

 s2 x 0 0  s1x 0 0  s1x  s2 x 0 0
0 s2 y 0   0 s1 y 0   0 s1 y  s2 y 0

 0 0 1  0 0 1  0 0 1

2D Geometric Transformations 22
2D Composite Transformations
(cont.)
 Don’t forget:
 Successive translations are additive
 Successive scalings are multiplicative

2D Geometric Transformations 23
General Pivot Point Rotation

 Steps:
1. Translate the object so that the pivot point is
moved to the coordinate origin.
2. Rotate the object about the origin.
3. Translate the object so that the pivot point is
returned to its original position.

2D Geometric Transformations 24
General Pivot Point Rotation

2D Geometric Transformations 25
2D Composite Transformations
(cont.)
 General 2D Pivot-Point Rotation
1 0 xr  cos   sin  0 1 0  xr 
0 1 yr    sin  cos  0  0 1  yr 

0 0 1   0 0 1 0 0 1 

cos   sin  xr (1  cos )  yr sin 


  sin  cos  yr (1  cos )  xr sin  
 0 0 1 

2D Geometric Transformations 26
General Fixed Point Scaling

 Steps:
1. Translate the object so that the fixed point
coincides with the coordinate origin.
2. Scale the object about the origin.
3. Translate the object so that the pivot point is
returned to its original position.

2D Geometric Transformations 27
General Fixed Point Scaling
(cont.)

(xr, yr) (xr, yr)

2D Geometric Transformations 28
General Fixed Point Scaling
(cont.)
• General 2D Fixed-Point Scaling:

1 0 𝑥𝑓 𝑠𝑥 0 0 1 0 − 𝑥𝑓 𝑠𝑥 0 𝑥𝑓 (1 − 𝑠𝑥 )
0 1 𝑦𝑓 . 0 𝑠𝑦 0 . 0 1 − 𝑦𝑓 = 0 𝑠𝑦 𝑦𝑓 (1 − 𝑠𝑦 )
001 0 0 1 00 1 0 0 1

𝐓(𝑥𝑓 , 𝑦𝑓 ) ⋅ 𝐒(𝑠𝑥 , 𝑠𝑦 ) ⋅ 𝐓(−𝑥𝑓 , −𝑦𝑓 ) = 𝐒(𝑥𝑓 , 𝑦𝑓 , 𝑠𝑥 , 𝑠𝑦 )

2D Geometric Transformations 29
2D Composite Transformations
(cont.)
 General 2D scaling directions:
 Above: scaling parameters were along x and y
directions
 What about arbitrary directions?
 Answer: See next slides

2D Geometric Transformations 30
General 2D Scaling Directions

Scaling parameters s1 and s2 along orthogonal directions defined by the


angular displacement θ. 2D Geometric Transformations 31
General 2D Scaling Directions
(cont.)
 General procedure:
1. Rotate so that directions coincides with x and y
axes
2. Apply scaling transformation 𝑆 𝑠1 , 𝑠2
3. Rotate back
 The composite matrix:
𝑠1 cos2 Θ + 𝑠2 sin2 Θ 𝑠2 − 𝑠1 cos Θ sin Θ 0
𝑅 −1 Θ ∗ 𝑆 𝑠1 , 𝑠2 ∗ 𝑅 Θ = 𝑠2 − 𝑠1 cos Θ sin Θ 𝑠1 sin2 Θ + 𝑠2 cos2 Θ 0
0 0 1

2D Geometric Transformations 32
2D Composite Transformations
(cont.)
 Matrix Concatenation Properties:
 Matrix multiplication is associative !
 M3· M2· M1= (M3· M2 ) · M1 = M3· ( M2 · M1 )
 A composite matrix can be created by multiplicating left-
to-right (premultiplication) or right-to-left
(postmultiplication)
 Matrix multiplication is not commutative !
 M2 · M1 ≠ M1 · M2

2D Geometric Transformations 33
2D Composite Transformations
(cont.)
 Matrix Concatenation Properties:
 But:
 Two successive rotations
 Two successive translations
 Two successive scalings
 are commutative!

2D Geometric Transformations 34
Reversing the order

in which a sequence of transformations is performed may


affect the transformed position of an object.
In (a), an object is first translated in the x direction, then
rotated counterclockwise through an angle of 45°.
In (b), the object is first rotated 45° counterclockwise, then
translated in the x direction
2D Geometric Transformations 35
Other 2D Transformations (cont.)
 Shear
 An x-direction shear relative to the x axis
1 shx 0 x'  x  shx  y
0 1 
 0 y'  y
0 0 1
 An y-direction shear relative to the y axis

 1 0 0
 sh 
1 0
 y
 0 0 1 2D Geometric Transformations 36
Other 2D Transformations (cont.)
 Shear
 x-direction shear relative to other reference lines
1 shx  shx * yref 
0 1 0 
 
0 0 1 

x'  x  shx *  y  yref 


y'  y
2D Geometric Transformations 37
Example

A unit square (a) is transformed to a shifted parallelogram


(b) with shx = 0.5 and yref = −1 in the shear matrix
2D Geometric Transformations 38

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy