-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (40 loc) · 1.04 KB
/
main.cpp
File metadata and controls
50 lines (40 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include "Geometry.h"
using namespace std;
int main() {
Point p1(-1,-2);
Point p2(10,-2);
cout << p1.getX() << endl;
LineSegment l(p1, p2);
cout << l.getXmin() << " " << l.getXmax() << endl;
cout << l.length() << endl;
p2.translate(0,2);
Rectangle r(p1,p2);
r.rotate();
cout << r.getYmin() << " " << r.getYmax() << endl;
cout << r.area() << endl;
Point p3(1,2,3);
Circle c(p3, 2);
cout << c.area() << endl;
c.scale(10);
cout << c.area() << endl;
auto pp1 = make_shared<Point>(0,0);
auto pp2 = make_shared<Point>(0,19);
auto pp3 = make_shared<Point>(59,19);
auto pp4 = make_shared<Point>(59,0);
auto pp5 = make_shared<Point>(55,19);
auto pp6 = make_shared<Point>(30,0);
auto lp = make_shared<LineSegment>(*pp2,*pp3);
auto rp = make_shared<Rectangle>(*pp4,*pp5);
auto cp = make_shared<Circle>(*pp6,10);
Scene s;
s.addObject(pp1);
s.addObject(lp);
s.addObject(rp);
s.addObject(cp);
cout << s;
cout << endl;
rp->rotate();
cp->translate(0,-5);
cout << s;
}