public bool IntersectCircle(PictureBall other) { var dx = X - other.X; var dy = Y - other.Y; var length = Math.Sqrt(dx * dx + dy * dy); return(length < radius + other.radius); }
public bool IntersectSquare(PictureBall other) { for (int i = 0; i < diameter; i++) { for (int j = 0; j < other.diameter; j++) { if (X + i == other.X + j) { for (int k = 0; k < diameter; k++) { for (int l = 0; l < other.diameter; l++) { if (Y + k == other.Y + l) { return(true); } } } } } } return(false); }