20 lines
451 B
JavaScript
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;
|
|
}
|
|
} |