-
Notifications
You must be signed in to change notification settings - Fork 2
/
circle.cpp
66 lines (54 loc) · 1.11 KB
/
circle.cpp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
#include <iomanip>
#include <math.h>
#include "point.h"
#include "circle.h"
using namespace std;
#define PI 3.14159265358979323846
Circle::Circle():Point()
{
}
Circle::Circle(double x, double y, double radius, double r, double g, double b):Point(x,y)
{
SetColour(r,g,b);
Radius = radius;
}
Circle::Circle(Point c, double radius, double r, double g, double b)
{
X = c.GetX();
Y = c.GetY();
Radius = radius;
R = r;
G = g;
B = b;
}
Circle::~Circle()
{
}
double Circle::GetRadius()
{
return Radius;
}
void Circle::SetRadius(double radius)
{
Radius = radius;
}
void Circle::Draw()
{
std::cout << "Drawing a circle" <<std::endl;
}
// This function is redundant however provides better readability
void Circle::Move(double x, double y)
{
Point::Move(x,y);
}
ostream& operator<<(ostream& os, const Circle& c)
{
os << setw(10) << setprecision(3) << c.X << ' ';
os << setw(10) << c.Y << ' ';
os << setw(10) << c.Radius << ' ';
os << setw(10) << c.R << ' ';
os << setw(10) << c.G << ' ';
os << setw(10) << c.B;
return os;
}