Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I've been working on a C++ program that involves classes. I have completed the program, but I need help in one of the specs

Hello, I've been working on a C++ program that involves classes. I have completed the program, but I need help in one of the specs that says draw a picture of it. I will post the program specs, but like I said, I have it coded, I will supply the output that needs to be drawn by hand. Thank you for your time.

Create the "point" class as shown in the text with

  1. 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

  1. Default "constructor" with two arguments for x and y coordinates
  1. 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

  1. ( d) = ( x cos d y sin d, x sin d + y cos d) where d 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?)

  1. 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) (This is where you take the output of the program and plot the points on paper and show everything the output is doing.)

Here is the output that needs to be hand drawn:

Box is - A: (2,2) B: (2,5) C: (4,5) D: (4,2)

Translating x=2 , y=1 A: (4,3) B: (4,6) C: (6,6) D: (6,3)

Scaling x=2 , y=.5 A: (8,1.5) B: (8,3) C: (12,3) D: (12,1.5)

Rotate 30 degree0.52381 A: (6.17709,5.30034) B: (5.42681,6.59922) C: (8.89049,8.59995) D: (9.64077,7.30107)

Rotate 60 degree A: (-1.50506,7.99905) B: (-3.00506,7.9981) C: (-3.00759,11.9981) D: (-1.50759,11.999)

Shering x direction 1.5 A: (-0.00505766,7.99905) B: (-1.50506,7.9981) C: (-1.50759,11.9981) D: (-0.00758664,11.999)

Shering y direction 1.7 A: (-0.00505766,9.69905) B: (-1.50506,9.6981) C: (-1.50759,13.6981) D: (-0.00758664,13.699)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago