44 lines
939 B
C++
44 lines
939 B
C++
#include <iostream>
|
|
#include "point.h"
|
|
#include "circle.h"
|
|
|
|
using std::cout, std::endl;
|
|
|
|
|
|
int main()
|
|
{
|
|
Point p = {7, -1};
|
|
Point q = {-4, 2};
|
|
cout << "Point p = " << p << endl;
|
|
cout << "Point q = " << q << endl;
|
|
cout << "p + q = " << p + q << endl;
|
|
|
|
|
|
Circle a {{4, 1}, 3};
|
|
Circle b;
|
|
// b = a;
|
|
|
|
cout << "Circle a: center: " << a.getCenter() << " radius: " << a.getRadius() << endl;
|
|
cout << "Circle b: center: " << b.getCenter() << " radius: " << b.getRadius() << endl;
|
|
|
|
cout << "Area of a = " << a.getArea() << endl;
|
|
cout << "Distance from point p to circle a = " << a.getDistance(p) << endl;
|
|
|
|
|
|
|
|
cout << "Collisions:" << endl;
|
|
if (a.isColliding(b))
|
|
cout << "Yes, a is colliding b" << endl;
|
|
else
|
|
cout << "No, a isn't colliding b" << endl;
|
|
|
|
|
|
|
|
cout << "Moving b by {1, 1}:" << endl;
|
|
b.move({1, 1});
|
|
if (a.isColliding(b))
|
|
cout << "Yes, a is colliding b" << endl;
|
|
else
|
|
cout << "No, a isn't colliding b" << endl;
|
|
|
|
}
|