Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and write a Point class, simulating a 2-dimensional point. The Point class needs to implement the following as member functions in c++: return the

Design and write a Point class, simulating a 2-dimensional point. The Point class needs to implement the following as member functions in c++:

  1. return the distance from the point to the origin
  2. return the angle the point makes with the positive x-axis (Hint: the atan2() function is good at finding this - see the docs, here: http://www.gnu.org/software/libc/manual/html_node/Inverse-Trig-Functions.html.)
  3. Translate the point in 2D space: to move a Point with coordinates (x,y) by an amount ( dx, dy ), so that the new coordinates are (x+dx, y+dy)
  4. rotate the point through a certain angle about the origin
  5. rotate the point through a certain angle about another point [ Hint: to rotate your point (x,y) about a point (x0, y0) try translating the point by an amount (-x0,-y0), then rotating it about the origin, then translating it back by an amount (+x0,+y0). ]
  6. A printxy() functions, which prints the point's x and y coordinates nicely on screen.
  7. A printpolar() functions, which prints the point's polar coordinates (r and theta) nicely on screen.

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago