2 d transformations

27
2D Transformations

Upload: sardar-alam

Post on 05-Jul-2015

145 views

Category:

Software


0 download

DESCRIPTION

2D transformation in Computer Graphics

TRANSCRIPT

Page 1: 2 d transformations

2D Transformations

Page 2: 2 d transformations

• Vector Addition

Page 3: 2 d transformations
Page 4: 2 d transformations

Dot product

• The dot product is the magnitude of 2 vectors which is scalar value

• Or perhaps more importantly for graphics

• Where o is the angle between

• The two vectors

Page 5: 2 d transformations

• Why is dot product important

– It is zero if the 2 vectors are perpendicular

– Cos(90) = 0

Page 6: 2 d transformations

• The dot product can be simplified when it is known that the vector are unit vector

• V1. V2 = cos(ø)

• Because |V1| and |V2| are both 1 then its resulting value will be only based on the cos() of the angle of both

• Saves 6 squares 4 additions and 2 square roots

Page 7: 2 d transformations

cross product

• The cross product of 2 vectors is a vector

• When we are calculating x of resultant vector then we use y,z only …. So on

Page 8: 2 d transformations

cross product

• By other way cross product

• U is the unit vector which brings the direction and it is perpendicular to both vectors

• Why u?

– |V1| and |V2| and sin(o) produces a scalar and the result needs to be vector

Page 9: 2 d transformations

• The direction of u is determined by right hand rule

• Note that you can’t take the cross product of 2 vectors that are parallel to each other

• Sine(0) = sin(180) = 0 produces the vector(0,0,0)– As the magnitude is 0 then

What ever the angle is it will

Become 0

Page 10: 2 d transformations
Page 11: 2 d transformations
Page 12: 2 d transformations

Transformation

Page 13: 2 d transformations

• T(x,y) the translation values

• If P(x,y) after translation P(x’, y’)

• Where x’ = x + Tx

y‘ = y + Ty

Take it as matrix addition

P’ = P + T

When know that both matrices should be equale

Page 14: 2 d transformations

• Rigid boy transformation

• Objects are moved without deformation

• Every point on the object is translated by the same amount

• Typically all endpoints are translated and object is redrawn using new endpoint positions

Page 15: 2 d transformations

Rotation

• We need angle to rotate

Page 16: 2 d transformations
Page 17: 2 d transformations
Page 18: 2 d transformations
Page 19: 2 d transformations
Page 20: 2 d transformations
Page 21: 2 d transformations
Page 22: 2 d transformations

• Rigid body transformation

• Objects are rotated without deformation

• Same angle for each point

• The end points are rotated and redrawn the object

Page 23: 2 d transformations
Page 24: 2 d transformations
Page 25: 2 d transformations
Page 26: 2 d transformations

If Scaling factor

• More then 1 scale up

• Less then 1 scale down

• Equal to 1 nothing

• sx and sy are with same values then uniform

Page 27: 2 d transformations