Geometrical Transformations in Computer Graphics, Exams of Database Programming

An introduction to geometrical transformations in computer graphics, including translations, rotations, scaling, and reflections. The document also covers the importance of these transformations in graphics, the basics of matrices, and the representation of 2D and 3D transformations using homogeneous coordinates.

Typology: Exams

2020/2021

Uploaded on 06/17/2021

mame-magnaw
mame-magnaw 🇪🇹

4 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Graphics Addisu M. AMU – CSIT
6/17/21
Chapter 5
Geometrical
Transformation
Institute of Technology
Computer Science and IT
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Geometrical Transformations in Computer Graphics and more Exams Database Programming in PDF only on Docsity!

Chapter 5

Geometrical

Transformation

Institute of Technology Computer Science and IT

What are they?

 (^) changing something to something else via rules  (^) transformation maps points to other points and/or vectors to other vectors (x, y, z) -> (x’, y’, z’)

Basic transformation: translate, rotate,

scale, shear, reflection,…

Why are they important to

graphics?

 (^) moving objects on screen / in space  (^) specifying the camera’s view of a 3D scene  (^) mapping from model space to world space General Transformation 2

Shifts all points by the same amount

from one coordinate location to another,

t x & t y

  • (^) original coordinate position (x, y) to move point to new position (x’, y’) x’ = x + t x , y’= y + t y 2D Translation 4 x x x p   pt y y y

p   p  t

  • (^) Have to find out the transformation equation for rotation of a point P when the pivot point is at origin of coordinates
  • (^) From the fig: Point is rotating from P(x, y) to P’(x’, y’) based on origin. Coordinates of the point P in the polar coordinates are 2D Rotations 5

Changing the size of an object  scale multiplies each coordinate of each point by a scale factor scale factor can be different for each coordinate (e.g. for x & y coordinates)

If all scale factors are equal we call it

uniform scaling , whereas S x = S y

if they are different we call it non-

Scaling 7

To scale a point P by scale factors S x and S y we apply the scaling matrix S: Contd… 8          y x S S S 0 0                            y x y x y x p p S S p p 0 0 x x x p   S p y y y p   S p

Basic transformations can be expressed in the general matrix form: P’ = M1. P + M With coordinate positions P and P' represented as column vectors. Matrix M is a 2 by 2 array containing multiplicative factors, and M2 is a two-element column matrix containing translational terms. For translation M1 is the identity matrix. For rotation or scaling: M2 contains the translational terms associated with the pivot point or scaling fixed point. To produce a sequence of transformations with these equations, such as scaling followed by rotation then translation, we must calculate the transformed coordinate’s one step at a time. First, coordinate positions are scaled, then these scaled coordinates are rotated, and finally the rotated coordinates are translated. A more efficient approach would be to combine the transformations so that the final coordinate positions are obtained directly from the initial coordinates, thereby eliminating the calculation of intermediate coordinate values. To be able to do this, we need to reformulate the above equation. To eliminate the matrix addition associated with the translation terms in M2. Matrix Representation and Homogeneous Coordinates 10

We can combine the multiplicative and translational terms for two- dimensional geometric transformations in to a single matrix representation by expanding the 2 by 2 matrix representations to 3 by 3 matrices. This allows us to express all transformation equations as matrix multiplications , providing that we also expand the matrix representations for coordinate positions. To express any two-dimensional transformation as a matrix multiplication, we need three variable coordinates. So we represent each Cartesian coordinate position (x, y) with the homogeneous coordinate triple (x, y, h), where y = x = Thus a general homogeneous coordinate representation can also be written as (h.x, h .y, h). For two-dimensional geometric transformations, we can choose the homogeneous parameter h to be any nonzero value. A convenient choice is simply to set h = 1. Each two-dimensional position is represented with homogeneous coordinates (x, y, 1). Now we will see the basic transformation using 3 X 3 matrixes. Cont., 11

Rotations can also be expressed using

homogenous coordinates

Contd… 13             0 0 1 sin cos 0 cos sin 0     R                                   0 0 1 1 sin cos 0 cos sin 0 1 y x y x p p p p     P R P Abbrevatio n p p p x x y ' ( ). cos sin        cos  sin  y y x p   pp

2D scaling with homogenous coordinate

Contd….

14            0 0 1 0 0 0 0 y x S S S                                  0 0 1 1 0 0 0 0 1 y x y x y x p p S S p p x x x p ^  S p y y y p   S p AbbrevationP ' S ( Sx , Sy ). P

Perform rotation about pivot point (2,2) translating by (-2,-2) to origin, rotating about the origin and then translating by (2,2) back to the pivot point Therefore, using homogenous coordinates we can compose all 3 matrices into one composite transformation, C : C = T 2

RT

1 P’ = T 2

RT

1

P

Contd… 16

Translation

Two successive translation:

OR

Contd…

17 6/17/21 (^) Computer Graphics Addisu M. AMU – CSIT

T(tx2, ty2). T(tx1, ty1) = T(tx1 + tx2, ty

+ ty2)

Contd…

19

Contd…

20