Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Implement a program that performs basic 2D geometrical transformations on points in a 2D coordinate space. The coordinate can be defined as a structure
2. Implement a program that performs basic 2D geometrical transformations on points in a 2D coordinate space. The coordinate can be defined as a structure typedef struct float x: float yi l coordinate; A point in the 2D coordinate space can be declared as a variable. Erample coordinate pointA 1.0, 2.5) Transformations to be implemented as three functions a. Horizontal shift: xNew = Original + horisontalrset b. Vertical shift: the _ original + verticaloret c. Rotation: rNew = cos(angle-Original + sinfangle)*Original yNew =-sin(angle)*xOrigina1+ cos(angle)"Original: Test the functions with two different points. Implement the mein ) function that: . declares a variable theTriangle (its type shall be defined as a top level nested struct with three . uses functions for three basic transformations on triangles. As you declare a new data type for triangles nodes of type coordinate) you may need to define a set of new functions, which will utilize the low level functions defined earlier for coordinates in order to manipulate triangles (shift horizontally, shift vertically and rotate). At this stage, your program sbould support geometrical transformations with points and rectangles. Add a definition of rectangle data type and provide a set of functions to shift horizontally, shift vertically and rotate rectangles. Test the program The next step is to split the program into the following modules: main.c point.h, triangle.c rectangle.c triangleh, rectangle.h, point .c Test the program again
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started