package de.frajul.endlessroll.entities.collision.geometry;

import de.frajul.endlessroll.data.Vector;
import de.frajul.endlessroll.entities.Player;
import de.frajul.endlessroll.entities.collision.CollisionDetector;

/**
 * Created by Julian on 01.12.2015.
 */
public class Circle implements Geometry {

    private Vector center;
    private float radius;

    public Circle(Player ball) {
        this(new Vector(ball.getPosition()), ball.getWidth() / 2);
    }

    public Circle(Vector center, float radius) {
        this.center = center;
        this.radius = radius;
    }

    public Vector getCenter() {
        return center;
    }

    public float getRadius() {
        return radius;
    }

    public void setRadius(float radius) {
        this.radius = radius;
    }

    @Override
    public boolean isCollisionWithCircle(Circle circle, CollisionDetector collisionDetector){
        return collisionDetector.isCircleCircleCollision(this, circle);
    }

    @Override
    public boolean isCollisionWithQuad(Quad quad, CollisionDetector collisionDetector){
        return collisionDetector.isCircleQuadCollision(this, quad);
    }

    @Override
    public boolean isCollisionWithTriangle(Triangle triangle, CollisionDetector collisionDetector){
        return collisionDetector.isCircleTriangleCollision(this, triangle);
    }

}
