copied formula from Circle2 Fixes #6

This commit is contained in:
RustyRaptor committed 2020-12-13 00:04:58 -07:00
1 parent 841a1f08fb
commit a6a09826a6
1 file changed
+7 -5
+7 -5
View File
@@ -8,12 +8,14 @@ public class Circle1 extends Circle
super(x, y, radius);
}
public boolean intersects(Circle other)
{
if (Math.abs(center.x - other.center.x) < radius &&
Math.abs(center.y - other.center.y) < radius)
public boolean intersects(Circle other) {
double d;
d = Math.sqrt(Math.pow(center.x - other.center.x, 2) +
Math.pow(center.y - other.center.y, 2));
if ((radius - other.radius) < d && d < (radius + other.radius))
return true;
return false;
else
return false;
}
}