 # Programming Problems With 2D and 3D Objects

## Question

Create a library to manage representation (not drawing) of objects in 2d and 3d. This library can be seen as a start of a graphics library, but graphics are not part of the task.

Content library must include a minimum of abstract data types (classes) for
- Create, save, and print 2D and 3D points.
- Adding together two points to create a line.
- Create, save, and print 2D and 3D lines.
- Adding together a line and a point or two lines to create a polygon.
- Create, save, and print 2D and 3D polygons.
- Retracting a polygon and a point or a polygon, and a line or two polygons to create a polygon.

All operations to be performed on the objects we create must be made using operators.

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <cstdlib>
#include "Polygon2D.h"
#include "Line2D.h"
#include "Point2D.h"
#include "Polygon3D.h"
#include "Line3D.h"
#include "Point3D.h"
using namespace std;

void test2D();
void test3D();

int main(int argc, char** argv) {
// test 2d shape
test2D();
// test 3D shapes
test3D();

return 0;
}

void test2D(){

// test input stream
Point2D p;
cout << "Enter 3 2D points ";
for (int i = 0; i < 3; i++) {
cin >> p[i];
}
// test output stream
cout << "3 2D points : \n";
for (int i = 0; i < 3; i++) {
cout << p[i] << "\n";
}

cout << "A line from " << p << " to " << p << "\n";
Line2D l1 = p + p;

cout<< l1 << "\n";

cout << "A polygon is created with point " << p << " and line " << l1 << "\n" ;
Polygon2D pl = l1 + p;

cout << pl << "\n";

// test retracting operator
cout << "A polygon is created by retracting polygon " << pl << " and point " << p << "\n" ;

Polygon2D pl2 = pl - p;

cout << pl2 << "\n";
}...
\$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.