Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool intersected(Ball ball) {
- for (int i = 0; i < balls.size(); i++) {
- double dx = balls[i].x - ball.x;
- double dy = balls[i].y - ball.y;
- double distance = sqrt(dx * dx + dy * dy);
- if (distance < balls[i].radius + ball.radius) return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement