mirror of
https://github.com/RustyRaptor/Programs.git
synced 2026-12-03 23:55:24 -07:00
copied formula from Circle2 Fixes #6
This commit is contained in:
1 parent
841a1f08fb
commit
a6a09826a6
1 file changed
+7
-5
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user