Starting from:

$24.99

780B Problem Set 7- member function for Shape class Solution

IsContained Function
Write a member function for Shape class that take a coordinate point as input (or x and y values) and determines if that point is inside the shape. The function declaration should look a lot like this: bool isContained(Point2D testPnt, bool isInclusive = true); bool isContained(float testX, float testY, bool isInclusive = true);

As part of testing your function, add something into ShapeManager class so that when you are in Edit Mode, something happens (a sound, a color change, etc.) when you right-click inside the current shape. In the code I am sharing, this part is already implemented as a “ding” when the right-click is in the shape and “buzzer” when it is out. If you go your own route, you can do whatever seems right.
We will discuss the algorithm (ray casting) in lecture.
Deliverables
6 files (zipped together):
ShapeManager.h and ShapeManager.cpp
Shape2D.h and Shape2D.cpp
Line2D.h and Line2D.cpp (no change, probably)

Learning Objectives
Use of classes and objects in C++.
Implementing algorithms developed by others.
Adapting code written by others.

More products