我在确定 2 个矩形棱镜是否接触或重叠时遇到了一些麻烦。我只有两个矩形棱镜的 highX,Y,Z 和 lowX,Y,Z。这是我到目前为止所拥有的:
public boolean overlaps(AreaSelection other) {
boolean Xs = (lowX <= other.getHighestX()) && (other.getLowestX() <= highX);
boolean Ys = (lowY <= other.getHighestY()) && (other.getLowestY() <= highY);
boolean Zs = (lowZ <= other.getHighestZ()) && (other.getLowestZ() <= highZ);
return (Xs && Ys && Zs);
}
有谁知道这是否正确?如果没有,解决方案是什么?谢谢!