Friday, 24 April 2020

Chapter 13 // Exercise 5 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2017 and the graphics files found here:
https://github.com/l-paz91/principles-practice/tree/master/Graphics%20Files

Chapter 13 // Exercise 5

Define the functions from exercise 4 for a Circle and an Ellipse. Place the connection points on or outside the shape but not outside the bounding rectangle.

Github: https://github.com/l-paz91/principles-practice/tree/master/Chapter%2013/Exercise%205


Following on from Exercise 4, Circle and Ellipse can now override the function in Shape. North, east, south and west are easy to draw for circle shapes from the center point and the other points can be easily obtained by using some trigonometry. You can just use the radius and given points to mark on the bounding box (Bjarne does allow it) but it's pretty simple to mark on the circle itself.

Ellipse is slightly different in that the radius can differ based on width/height.



No comments:

Post a Comment