public bool IntersectCircle(Circle circle) { var distance = GetDistanceBetweenCircles(circle); // check distance return distance <= circle.Radius + Radius; }
private double GetDistanceBetweenCircles(Circle circle) { var distanceX = Position.X - circle.Position.X; var distanceY = Position.Y - circle.Position.Y; return Math.Sqrt(distanceX * distanceX + distanceY * distanceY); }
public bool ContainsCircle(Circle circle) { // bigger circle cannot be inside smaller one if (circle.Radius > Radius) { return false; } var distance = GetDistanceBetweenCircles(circle); return distance <= Math.Abs(Radius - circle.Radius); }