0% found this document useful (0 votes)
40 views21 pages

Seminar

2-d transformation involves operations like translation, rotation, scaling, and shearing of points in a coordinate plane. These transformations can be represented using 3x3 matrices. Multiple transformations can be applied by multiplying the corresponding matrices in the appropriate order.

Uploaded by

Arpit Shrivastav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views21 pages

Seminar

2-d transformation involves operations like translation, rotation, scaling, and shearing of points in a coordinate plane. These transformations can be represented using 3x3 matrices. Multiple transformations can be applied by multiplying the corresponding matrices in the appropriate order.

Uploaded by

Arpit Shrivastav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Computer Graphics

2-d transformation.

Submitted to :- Mrs. priyanka sharma Submitted by:- arpit shrivastava


Lect. C.s.e dept. Branch:- computer science
Roll number:- 0914cs071015
Batch:- 2007-2011
Coordinates
A point is represented by a pair of real
numbers (x, y)
There are two axes which serve as a reference
for measuring distance of each point from the
origin
Conventionally the X and Y axes are
perpendicular to each other. But need not be.
The coordinates give the length of projections
of the point onto the two axes
Coordinate Geometry
The coordinates of the
point depend upon the Y
location of the origin and
the direction of the axes
Coordinates change not
only when the point y P
moves to a new position,
but also when there is a x
X
change in the origin/axes O
Types of Transformation
Translation
Rotation
Scaling
Shearing

In each case, it can be either the point or the


reference (origin + axes)
Translation of a point

Translate the point Y


by (a, b)
y' P'
(x + a, y + b) are the b
a b
coordinates of the y P
new point in the old
a
(same) coordinate x x'
X
system.
p' = p + t
Translation of Axes
Translate the axes by Y
(-a, -b). Y'

New coordinates are y


y' P
(x + a, y + b).
(x + a, y + b) are the a x
X
coordinates of the b
X'
x'
same point in new
coordinate system. p' = p + t
Transformations in reverse
Translating the axes by (a, b) is the same as
translating each point by (-a, -b)
Similarly scaling the axes (zooming in) is the
same as zooming out of each point
Rotating the axes by an angle θ is the same as
rotating each point by the reverse angle -θ.
Coordinates under Scaling
x' = s x, y' = s y.
s is the scale factor. Y

Point undergoes shift


when scaling with
respect to the origin!
To scale shapes “in
place”, translate to X
origin, scale, and p' = s p
translate back.
Rotation of a point about Origin

Y x = r cos y = r sin 


y' P'
x' = r cos 
r cos  cos r sin sin 
y P y' = r sin 
 r
 r sin cos r cos  sin 
x X
x'
Rotation: Matrix Notation

Y
R()
y' P'
x' cos  -sin  x
=
y' sin  cos  y
y P

 X
x' x
NewCoords = Matrix * OldCoord
p' = M p
Rotation of Coordinate Axes
x' = r cos () =
Y' Y r cos  cos  + r sin  sin 
P y' = r sin () =
y P
r cos  sin  + r sin  cos 
X'
y'
 x'
R(-)
 X
x x' cos  sin  x
= y
y' -sin  cos 
Rotation about a arbitrary point.
First of all we will translate the point to the
origin.
Then we’ll rotate the point with a given
angle.
Then we’ll inverse translate the point to
the origin.
[Obj’]=[inverse translation] * [rotation] *
[translation] * [obj]
Opposite Rotation of Axes
Y Y' x' = r cos  cos  - r sin  sin 
y' P
y' = r cos  sin  + r sin  cos 
X
y
 x

R()
X'
x'
x' cos  -sin  x
= y
y' sin  cos 
Equivalent Matrices
Y
Y
Y'
y' P' y'

y P
y P

 
x X X
x'  x
x' cos  -sin  x x'
= y
y' sin  cos 
X'
Multiple Transformations
Translation followed by rotation of a point
p΄ = R(p + t)
Rotation followed by translation of a point
p΄ = t + Rp
They are not identical
Rotation followed by translation followed by scaling
p΄ = s(t + Rp)
Cumbersome jumble of additions and multiplications !!
Homogeneous Coordinates

Represent 2D coordinates using 3-vectors.


The last number w is sort of a “scaling
constant.”
Multiple representations for each point.
Multiplying x, y, and w by a non-zero k
doesn’t change the point. x x/w
p= y = y/w
w 1
Reflection of a line about a given
axis [equation of the line given as
y=mx+b].
First of all we’ll translate the line by
(0,-b).
By using the slope we’ll calculate θ & we’ll
rotate the line by an angle -θ .
Now we’ll reflect the line.
After reflection we’ll perform inverse
rotation on the line by an angle θ .
And finally we’ll inverse translate the line
by (0,b)
1 0 0 cos  -sin  0 1 0 0
Obj’ = 0 1 b sin  cos  0 0 -1 0
0 0 1 0 0 1 0 0 1

cos  sin  0 1 0 0
-sin 
0
cos  0
0 1
0
0
1 -b
0 1
* Obj
Transformations: Uniform Form

x x/w cos  -sin  0


p= y = y/w R() = sin  cos  0
w 1 0 0 1

1 0 a s 0 0
T= 0 1 b S= 0 s 0
0 0 1 0 0 1

p' = M1 M2 M3 p
Shearing Transformation

Add part of X to Y
and vice versa! 1 shx 0
Squares turn into
parallelograms! shy 1 0
May be applied in 0 0 1
one direction only.
Summary

Rotations, translation, scaling, shearing


represented using a 3x3 matrix.
Composite transformations obtained by
multiplying matrices together.

You might also like