mr-crocs-adventures/js/geometry/GeometryCircle.js
2020-01-19 00:45:17 +01:00

20 lines
451 B
JavaScript

import GeometryPoint from "./GeometryPoint.js";
export default class GeometryCircle
{
constructor(x, y, radius)
{
this.position = new GeometryPoint(x, y);
this.radius = radius;
}
getDistanceToCircle(circle)
{
return this.position.getDistanceToPoint(circle.position);
}
hasIntersectionWithCircle(circle)
{
return this.getDistanceToCircle(circle) <= this.radius + circle.radius;
}
}