1
可能重複:
Finding if a circle is inside another circle檢查了一圈完全包含了一圈
我如何確定一個圓完全包含另一個圓(在Java中)
public class Circle {
//x and y define the top left rectangular region bounding this circle
private int x, y, radius;
}
public boolean circleContainsCircle(Circle big, Circle small) {
...
}
你有什麼思維過程?我看到一個完全空白的檢查方法。 – Srinivas
return dist(small.x,small.y,big.x,big.y)+ small.radius <= big.radius; – irrelephant
很容易 public boolean circleContainsCircle(Circle big,Circle small)double maxOffset = Math.sqrt((small.x - big.x)*(small.x - big.x)+(small.y - big .y)*(small.y - big.y))+ small.radius; return maxOffset
iMysak