2D Translation: Positioning of an Object

C Graphics » 2D Translation: Positioning of an Object

Translation means repositioning of an object from place to another in a straight path by adding a translation factor or distance tx and ty. Together (tx,ty) are named as translation vector.

Suppose, there is a point on the coordinate (x,y), in order to move this point to a new position, we have to add something which can be considered as translation vector (tx,ty). The resultant point we would get is (x1,y1).

A = (x,y)        , Point that  need to be translated

V= (tx,ty)       , This tells how much we have to move that point X

B = (x1,y1)       , The new point after translation

x1 = x+ tx

y1 =y+y1

 

C Program to show the working of translation

Program:

 

Output:

 


You must be logged in to take the quiz.

error: Content is protected !!