Question: c++ program Create the point class as shown in the text with (private and public sections) a. data members are the one listed in the
c++ program
Create the "point" class as shown in the text with (private and public sections)
a. data members are the one listed in the text book plus the new ones below
Methods in the text: shift, rotate90, rotations_needed, distance, middle
b. Default "constructor" with two arguments for x and y coordinates
c. Add the following methods:
Translation: (x,y) translated to (x,y) by adding x to x and y to y value (x,y) = (x+x, y+y) where x & y are int + or or 0 values
Scaling: (x, y) = (xx, yy) (multiply) where m > 1 makes larger, m 0.0 to 1.0 makes smaller
Rotation: ( d) = ( x cos d y sin d, x sin d+ y cos d) whered is the degrees to rotate.
Shearing: (x, y) = (x+x, y) to shear in the x direction
(x, y+y) to shear in the y direction
Write a main program that will test the above implementation of points class and that will convince me your points class is correct. Test all methods in the Points class and show results.
Also, set up a box with 4 points: (2,2) (2,5) (4,5) (4,2)
1. Print out the points for the box.
2. Print out the points for the box after Translating it x=2 and y=1 distance.
3. Continuing with new set of box points, print out the box after scaling x by 2 and y by 0.5
4. Original box pts: print out the box after rotating the box by 30 degrees then print again after rotation another 60 degrees. (Note: degrees may need to be converted to radians?)
5. Original box pts: print out the box after shearing in the x direction 1.5
6. Original box pts: print out the box after shearing in the y direction 1.7
Print out and label each of the outputs above.
For each output of each box, also draw a picture of the new box (nice accurate boxes)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
