Question: ( Geometry: find the bounding rectangle ) IN C + + A bounding rectangle is the minimum rectangle that encloses a set of points in
Geometry: find the bounding rectangle IN C
A bounding rectangle is the minimum rectangle that encloses a set of points in a twodimensional plane, as shown in Figure d Write a function that returns a bounding rectangle for a set of points in a twodimensional plane, as follows:
const int SIZE ;
RectangleD getRectangleconst double pointsSIZE int numberOfPoints;
Write another function that returns a pointer to the bounding rectangle as follows:
RectangleD getRectanglePointerconst double pointsSIZE int numberOfPoints;
The RectangleD class is defined in Programming Exercise When you create a new submission, you'll notice a template code that includes an implementation of the RectangleD class. Your task is to fill in the missing parts.
THE CODE:
This exercise uses the RectangleD class in Exercise
#ifndef RECTANGLEDH
#define RECTANGLEDH
class RectangleD
public:
RectangleD;
RectangleDdouble x double y double width, double height;
double getX const;
double getY const;
double getWidth const;
double getHeight const;
The rest in Exercise are not used in this exercise. They can be omitted
private:
double x y; Center of the rectangle
double width, height;
;
#endif
RectangleD::RectangleD
x y ;
width height ;
RectangleD::RectangleDdouble x double y double width, double height
thisx x;
thisy y;
thiswidth width;
thisheight height;
double RectangleD::getX const
return x;
double RectangleD::getY const
return y;
double RectangleD::getWidth const
return width;
double RectangleD::getHeight const
return height;
MyRectangleD getRectangleconst double pointsSIZE int numberOfPoints;
const int SIZE ;
double minXconst double pointsSIZE int numberOfPoints
Return the code to return the minimum ycoordinate in points
double maxXconst double pointsSIZE int numberOfPoints
Return the code to return the maximum xcoordinate in points
double minYconst double pointsSIZE int numberOfPoints
Return the code to return the minimum ycoordinate in points
double maxYconst double pointsSIZE int numberOfPoints
Return the code to return the maximum ycoordinate in points
RectangleD getRectanglePointerconst double pointsSIZE int numberOfPoints
Write your code to return a point to a RectangleD object that is the minimum bounding rectangle for the points
Hint: invoke minX, minY, maxX, and maxY to find the minimum x y and maximum x y for the bounding rectangle.
RectangleD getRectangleconst double pointsSIZE int numberOfPoints
Write your code to return a RectangleD object that is the minimum bounding rectangle for the points
Hint: invoke minX, minY, maxX, and maxY to find the minimum x y and maximum x y for the bounding rectangle.
#include
using namespace std;
int main
double points;
cout "Enter five points: ;
Write your code to read five points
RectangleD boundingRectangle getRectanglepoints;
cout "The bounding rectangle's center boundingRectangle.getX
boundingRectangle.getY width boundingRectangle.getWidth
height boundingRectangle.getHeight endl;
RectangleD boundingRectangleP getRectanglePointerpoints;
cout "The bounding rectangle's center boundingRectanglePgetX
boundingRectanglePgetY width boundingRectanglePgetWidth
height boundingRectanglePgetHeight endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
