-
Notifications
You must be signed in to change notification settings - Fork 864
Closed
Description
Hi,
I have found a little mistake in Exercise_16_08. The method isIntersect() examines wether the two circles intersect or not. This method gives true also in case of one containing the other. The method can correct like this:
public boolean isIntersect() {
double distance = Math.sqrt(Math.pow(c1.getCenterX() - c2.getCenterX(), 2) +
Math.pow(c1.getCenterY() - c2.getCenterY(), 2));
return distance < c1.getRadius() + c2.getRadius() &&
distance > Math.max(c1.getRadius(), c2.getRadius()) - Math.min(c1.getRadius(), c2.getRadius());
}
Bye,
Csaba
Metadata
Metadata
Assignees
Labels
No labels