0

hey plz can anyone do this for me


Task-1:
1. Write a C code that takes a file as input. Say input.txt which has the information about the object to be transformed, type of transformation, etc.
2. Input file can have following different formats.
Case 1:
P # first line defines type of input object, P means point
(60,40) # second line defines input object’s coordinates
T(20,30) # third line defines transformation type
10 # fourth line defines delay in seconds after which results will be drawn
3. C code parses the input file as per above format and draws the input object (in above case it is a point) on screen in WHITE color, waits for the time specified in the delay and then draws the output object in YELLOW color. Wait for a key stroke press event from user, to close the screen.

Task-2:
Extend C code such that every time you draw any object on screen, following is done:-
1. Screen is divided into a grid (like a graph sheet) with dotted lines at an interval of 10 X 10 pixels.
2. Shift the origin from top-left corner of screen to the centre of screen, call this new X-Y coordinate axis.
3. All the objects are to be drawn with respect to this new X-Y coordinate axis. So, redo Task-1 on new X-Y coordinate axis.

Note: Now onwards, all tasks are to be performed with respect to this new X-Y coordinate axis.

Task-3:
Extend the C code to perform rotation and scaling transformations as well given an input point. So third line in input file becomes as follows:
R(30) # rotate by angle 30⁰, if angle > 0 do anti-clockwise rotation else clockwise
S(3,2) # scale by factors 3, 2 in X and Y directions, respectively

Task-4:
Extend the C code to perform reflection on an input point. So third line in input file becomes as follows:
F(x) # reflection about X-axis
F(y) # reflection about Y-axis

Task-5:
Extend the C code to include following input objects:
S: Square
R: Rectangle
C: Circle
E: Ellipse
First line and second line of input will get modified according to the above input object. For each of the above object, any of the transformations (translation, rotation, scaling or reflection) could be applied.

Task-6:
Extend the C code to include any object discussed till now, and perform a sequence of transformation (composite transformation). Third line of input defines the sequence as illustrated in examples:
T(2,3)R(45) # translate by (2,3) and then rotate by 45⁰
S(3,4)T(2,1)R(60) #scale by (3,4), translate by (2,1) and then rotate by 60⁰
T(3,4)R(60)  Ref(x) #translate by (3,4), rotate by 60⁰ and then reflect about x-axis

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by Fbody
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.