Question: Program in C++ Write a class called GrowArray Given a list is composed of 2D-points. (X,Y) Read in a file points.dat inside will be a

 Program in C++ Write a class called GrowArray Given a list

Program in C++ Write a class called GrowArray Given a list is composed of 2D-points. (X,Y) Read in a file points.dat inside will be a number of x y pairs. EX: 11 12 19.3 21 33-2 1. Find xmin, xmax, ymin, ymax in a single pass through the data 2. Divide the box defined by the above into a 16 x 16 grid. Let's define n16 to access cell(i,j) where i is the row and j is the column i- (y - ymin) / (ymax-ymin) * (n-1) j- (x -xmin) (xmax-xmin)(n-1) 3. For each point add it to the growarray in (i,j Example Code class Point public: double x,y Point(double x, double y) : x(x), y(y) d: int main() ConvexHull ch(1); // create a 16x16 grid of GrowArray ch.read("points.dat"); ch.printAlllistSizes(); // Print how many are in each list ch.printMinMax(); // Rrint minx, maxx, miny, maxy for the dataset ch.printPerimeterClockWiseOrder(); // p1,p2,p3, p4, 8, p12,016 // for each growarray around the perimeter print xmin, xmax, ymin,ymax // this is the minimum, maximum for the x,y in THAT B0X example shown n=4 | p9 I p10 | p11| p12 | p13l p14 | p15 | p16| Program in C++ Write a class called GrowArray Given a list is composed of 2D-points. (X,Y) Read in a file points.dat inside will be a number of x y pairs. EX: 11 12 19.3 21 33-2 1. Find xmin, xmax, ymin, ymax in a single pass through the data 2. Divide the box defined by the above into a 16 x 16 grid. Let's define n16 to access cell(i,j) where i is the row and j is the column i- (y - ymin) / (ymax-ymin) * (n-1) j- (x -xmin) (xmax-xmin)(n-1) 3. For each point add it to the growarray in (i,j Example Code class Point public: double x,y Point(double x, double y) : x(x), y(y) d: int main() ConvexHull ch(1); // create a 16x16 grid of GrowArray ch.read("points.dat"); ch.printAlllistSizes(); // Print how many are in each list ch.printMinMax(); // Rrint minx, maxx, miny, maxy for the dataset ch.printPerimeterClockWiseOrder(); // p1,p2,p3, p4, 8, p12,016 // for each growarray around the perimeter print xmin, xmax, ymin,ymax // this is the minimum, maximum for the x,y in THAT B0X example shown n=4 | p9 I p10 | p11| p12 | p13l p14 | p15 | p16|

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!