In this program we will perform Rotation about an Arbitrary Point i.e. the shape which we will rotate won't move to different position instead it will be at a fixed position on a point.
Here, first we translate the shape to Origin.
Then rotate it about the given angle and translate it back to it's original position i.e. the fixed point.
Translation: Translation is defined as moving the object from one position to another position along straight line path.
Rotation: A rotation repositions all points in an object along a circular path in the plane centered at the pivot point. We rotate an object by an angle theta.
New coordinates after rotation depend on both x and y
• x’ = xcosθ -y sinθ
• y’ = xsinθ+ ycosθ
Code:
If you can't see the code, then Enable JavaScript in you browser
Output:
Here, first we translate the shape to Origin.
Then rotate it about the given angle and translate it back to it's original position i.e. the fixed point.
Translation: Translation is defined as moving the object from one position to another position along straight line path.
Rotation: A rotation repositions all points in an object along a circular path in the plane centered at the pivot point. We rotate an object by an angle theta.
New coordinates after rotation depend on both x and y
• x’ = xcosθ -y sinθ
• y’ = xsinθ+ ycosθ
Code:
If you can't see the code, then Enable JavaScript in you browser
Output:
Note: Just copy the files "CGA.bgi" & "EGAVGA.bgi" from bgi folder to bin. So, if you have copied these 2 files then you can skip writing "C:\\tc\\bgi" in initgraph with just ""(2 double quotes)
piszeQsconnu Angie Andrews https://wakelet.com/wake/V1qc8RxPccSZL8qXwjxHC
ReplyDeletecurekdedoub
moganMgeo-yu Darrel Hamer WiFi Analyzer
ReplyDeleteNorton Security
Eset NOD 32
riatincticte