2D Transformation

C Graphics » 2D Transformation

Transformation

Transformation can be defined as repositioning of coordinates, size or orientation of an object. There are various types of transformations namely translation, rotation scaling, etc. A transformation can be 2D and 3D. In this, We will study about 2D transformation that forms using (x,y) coordinates


Translation

A translation is a repositioning of an object along a straight line by adding a translation factor to the original coordinates of the given object.
A translation factor is also known as the translation vector.
Suppose, (x,y) is a position of an object. (tx,ty) is a translation vector that to be added to the given coordinate (x,y). After adding them, the object would be placed at a new coordinate.

x’=x+tx ,

y’=y+ty

Rotation

Rotation can be defined as moving an object in a circular path at a given angle theta. if there is a positive angle, it would rotate in anticlockwise whereas if it appears to a negative angle, the object would rotate in clockwise. The point at which an object about to rotate is known as a pivot point.

x’= x cosθ – y sinθ

y’= x sinθ + y cosθ

Scaling

Scaling is a redefining the size of an object or changing the size of an object by multiplying scaling factor to it.
x’ = x*Sx ,

y’=y.Sy

Reflection

Reflection has nothing to do with size, it is a repositioning of an object relative to xy quadrants that produce a mirror image.

Shear

Shearing is a process of slanting the edges of an object. it can be of two types x shear and y shear
In x-shear, we don’t touch y-coordinates, but changes are made to x coordinate which produces a  right or left tilted object
In y shear, we don’t touch x coordinate, instead, changes are made to x coordinate which produces a right or left tilted object


You must be logged in to take the quiz.

error: Content is protected !!