#include #include "point_2d.h" #include "point_3d.h" #include "line_2d.h" #include "line_3d.h" #include "polygon_2d.h" #include "polygon_3d.h" int main() { //// DEFAULT CONSTRUCTORS //Create 2D point with default coordinates (0, 0) Point_2D p1; //Create 3D point with default coordinates (0, 0, 0) Point_3D p2; //Create 2D line with default 2D points ((0, 0), (0, 0)) Line_2D l1; //Create 3D line with default 3D points ((0, 0, 0), (0, 0, 0)) Line_3D l2; //Create 2D polygon with default 2D points ((0, 0), (0, 0), (0, 0)) Polygon_2D poly1; //Create 3D polygon with default 3D points ((0, 0, 0), (0, 0, 0), (0, 0, 0)) Polygon_3D poly2; //// CONSTRUCTORS WITH ARGUMENTS //Create 2D point from two coordinates Point_2D p3(1, 1); //Create 3D points from three coordinates Point_3D p4(1, 1, 1); //Create 2D line from two 2D points Line_2D l3(p1, p3); //Create 3D line from two 3D points Line_3D l4(p2, p4); //// OVERLOADED OPERATORS //Create 2D line from two 2D points Line_2D l5 = p1 + p3; //Create 3D line from two 3D points Line_3D l6 = p2 + p4; //Create 2D polygon from two 2D lines Polygon_2D poly3 = l1 + l3; //Create 3D polygon from two 3D lines Polygon_3D poly4 = l2 + l4; //Create 2D polygon from one 2D line and one 2D point Polygon_2D poly5 = l5 + p3; //Create 3D polygon from one 3D line and one 3D point Polygon_3D poly6 = l6 + p4; //Create 2D polygon from one 2D point and one 2D line Polygon_2D poly7 = p3 + l5; //Create 3D polygon from one 3D point and one 3D line Polygon_3D poly8 = p4 + l6; //Create 2D polygon from one 2D polygon and one 2D point Polygon_2D poly9 = poly7 + p3; //Create 3D polygon from one 3D polygon and one 3D point Polygon_3D poly10 = poly8 + p4; //Create 2D polygon from one 2D point and one 2D polygon Polygon_2D poly11 = p3 + poly9; //Create 3D polygon from one 3D point and one 3D polygon Polygon_3D poly12 = p4 + poly6; //Create 2D polygon from one 2D polygon and one 2D line Polygon_2D poly13 = poly5 + l5; //Create 3D polygon from one 3D polygon and one 3D line Polygon_3D poly14 = poly12 + l6; //Create 2D polygon from one 2D line and one 2D polygon Polygon_2D poly15 = l5 + poly5; //Create 3D polygon from one 3D line and one 3D polygon Polygon_3D poly16 = l6 + poly12; //Expand default 2D polygon with one 2D point Polygon_2D poly17; poly17 += p3; //Expand default 3D polygon with one 3D point Polygon_3D poly18; poly18 += p4; //Expand default 2D polygon with one 2D line Polygon_2D poly19; poly19 += l5; //Expand default 3D polygon with one 3D line Polygon_3D poly20; poly20 += l6; //Create 2D polygon from two 2D polygons Polygon_2D poly21 = poly17 + poly19; //Create 3D polygon from two 3D polygons Polygon_3D poly22 = poly18 + poly20; //Expand default 2D polygon with another default 2D polygon Polygon_2D poly23; poly23 += poly23; //Expand default 3D polygon with another default 3D polygon Polygon_3D poly24; poly24 += poly24; //// OUTPUT //DEFAULT CONSTRUCTORS std::cout << "p1: " << p1 << std::endl; std::cout << "p2: " << p2 << std::endl; std::cout << "l1: " << l1 << std::endl; std::cout << "l2: " << l2 << std::endl; std::cout << "poly1: " << poly1 << std::endl; std::cout << "poly2: " << poly2 << std::endl; //CONSTRUCTORS WITH ARGUMENTS std::cout << "p3: " << p3 << std::endl; std::cout << "p4: " << p4 << std::endl; std::cout << "l3: " << l3 << std::endl; std::cout << "l4: " << l4 << std::endl; //OVERLOADED OPERATORS std::cout << "p1 + p3 = l5: " << l5 << std::endl; std::cout << "p2 + p4 = l6: " << l6 << std::endl; std::cout << "l1 + l3 = poly3: " << poly3 << std::endl; std::cout << "l2 + l4 = poly4: " << poly4 << std::endl; std::cout << "l5 + p3 = poly5: " << poly5 << std::endl; std::cout << "l6 + p4 = poly6: " << poly6 << std::endl; std::cout << "p3 + l5 = poly7: " << poly7 << std::endl; std::cout << "p4 + l6 = poly8: " << poly8 << std::endl; std::cout << "poly7 + p3 = poly9: " << poly9 << std::endl; std::cout << "poly8 + p4 = poly10: " << poly10 << std::endl; std::cout << "p3 + poly9 = poly11: " << poly11 << std::endl; std::cout << "p4 + poly6 = poly12: " << poly12 << std::endl; std::cout << "poly5 + l5 = poly13: " << poly13 << std::endl; std::cout << "poly12 + l6 = poly14: " << poly14 << std::endl; std::cout << "l5 + poly5 = poly15: " << poly15 << std::endl; std::cout << "l6 + poly12 = poly16: " << poly16 << std::endl; std::cout << "poly17 += p3: " << poly17 << std::endl; std::cout << "poly18 += p4: " << poly18 << std::endl; std::cout << "poly19 += l5: " << poly19 << std::endl; std::cout << "poly20 += l6: " << poly20 << std::endl; std::cout << "poly17 + poly19 = poly21: " << poly21 << std::endl; std::cout << "poly18 + poly20 = poly22: " << poly22 << std::endl; std::cout << "poly23 += poly23: " << poly23 << std::endl; std::cout << "poly24 += poly24: " << poly24 << std::endl; //Pause std::getchar(); return 0; }