Sei sulla pagina 1di 3

2.

Scaling:-

Changing the size of an object is accomplished by a transformation called scaling. Scaling an


object is implemented by scaling the X AND Y coordinates of each vertex in the object. Changing the size
of the an object is accomplished by a transformation called scaling. An object is implementing by scaling
the X and Y coordinate of each in the object. This is accomplished by a multiplying X coordinates by Sx ,
the scale factor of X axis and Y coordinates by Sy, the scale factor of Y axis. The transformation equation
for scaling is

X= X*Sx

Y= Y*Sy

If the scaling factors are less than one the object will smaller. If the scaling factors are greater than one,
the object factor will appear larger. If Sx=Sy=1, the object is unchanged.

3.Rotation:-

Rotation is a transformation that causes point P to be move relative to a central point without
changing the distance of P from that origin. This transformation is accomplished by applying the rotation
equation to each vertex of object. A rotation is specified by providing angle, b, indicating how many
degrees of rotation are desired .This angle may be either positive or negative. A positive angle indicates
a counter clockwise rotation about the origin.

The transformation equation for rotation

X=Xcosb Ysinb

Y= Xcosb + Ysinb

These equation can be easily derived from the figure above, in which a rotation by B

Transformation P1(X,Y) into P2(X,Y).Because the rotation is about the origin, the distance from the
origin to P1 and P2 labeled r in the figure, are equal.
By simple trigonometry, we find that

X= r*cosA and Y= r*sinA

sin(A+B) =Y/r and cos(A+B)=X/r

Substitution using the double angle formula

sin(A+B)=sinA*cosB+cosA*sinB

cos(A+B)=cosA*cosB-sinA*sinB

We see that

X/r=( X/r)*cosB-( Y/r)*sinB

Y/r=( Y/r)*cosB+( X/r)*sinB

And then

X=X*cosB-YsinB

Y=YcosB+XsinB

Thus,

X=XcosB YsinB

Y=XsinB + YcosB

4. Reflection

To reflect the 2D graphical object we use the standard matrix which consider the cases like x=0,
y=0, x=y and x=-y and then multiply the standard matrix with coordinate matrix and get the new
reflected points.

Matrix Representation of two Dimensional Transformation:-

To use a matrix representation, a two dimensional point is represent homogeneous coordinates by


a triple (X,Y,W) instead of (X,Y).Triples of coordinates typically represent points in 3 space, but here it is
used to represent points in 2 space. Usually W is fixed at 1. Now we can use 3 X 3 matrices to represent
the basic transformation functions. Applying a transformation to a point is accomplished by multiplying
the homogenous coordinates of the point by appropriate transformation matrix.

2.1Translation
The matrix for translation is :

And the equations for the translation become

2.2 Scale

The matrix for scaling

To get the new transformed points we multiply the coordinate matrix with standard matrix.

2.3Rotation

The matrix for rotation

The standard matrix for rotation is multiply with original coordinate to get new transformed points.

Potrebbero piacerti anche