#include <iostream>
#include <math.h>
#include <cstdlib>
#include "circle.h"
#include "point.h"

Circle::Circle(const Point& acenter, float aradius) {
    mCenter = acenter;
    mRadius = aradius;
}
Circle::Circle() {
    mCenter = Point {0, 0};
    mRadius = 1;
}
Circle::Circle(const Circle& circle) {
   mCenter = circle.mCenter;
   mRadius = circle.mRadius;
}
Point Circle::getCenter() const { return mCenter; }
float Circle::getRadius() const { return mRadius; }

void Circle::setCenter(const Point& p) {
    mCenter = p;
}
void Circle::setRadius(float radius) {
    mRadius = radius > 0 ? radius : 0;
}
float Circle::getArea() const {
    return abs(mRadius * mRadius * M_PI);
}
float Circle::getDistance(const Point& p) {
    return mCenter.distance(p) - mRadius; 
}
bool Circle::isColliding(const Circle& c) const {
    return (mCenter.distance(c.getCenter()) - (mRadius + c.getRadius()) > 0) ? false : true;
}
void Circle::move(const Point& p) {
    mCenter = mCenter + p;
}
