A scaling transformation alters size of an object. In the scaling process, we either compress or expand the dimension of the object.
Scaling operation can be achieved by multiplying each vertex coordinate (x, y) of the polygon by scaling factor sx and sy to produce the transformed coordinates as (x’, y’). So, x’ = x * sx and y’ = y * sy. The scaling factor sx, sy scales the object in X and Y direction respectively. So, the above equation can be represented in matrix form: Or P’ = S . P Scaling process: Note: If the scaling factor S is less than 1, then we reduce the size of the object. If the scaling factor S is greater than 1, then we increase size of the object.
Algorithm:
Generally Reflection about any line in Computer Graphics is represented by any line, y = mx + b. The line y = mx + b, can be achieved with a combination of translate-rotate-reflect transformation. In this several transformations Translation, Rotation and Reflection took place. For Instance, consider a line, so what do we do first?
Below is C implementation:
Output:
This article is contributed by Anuj Chauhan. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Recommended Posts:Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |