/** * Returns a new infinite bounding sphere. * @return a new infinite bounding sphere. */ public static BoundingSphere infinite() { BoundingSphere bs = new BoundingSphere(); bs.setInfinite(); return bs; }
/** * Expands this sphere to include the specified bounding sphere. * Changes only the radius, if necessary, not the center of this sphere. * @param bs the bounding sphere. */ public void expandRadiusBy(BoundingSphere bs) { if (!isInfinite()) { if (!bs.isInfinite()) { if (!bs.isEmpty()) { if (!isEmpty()) { double dx = bs._x-_x; double dy = bs._y-_y; double dz = bs._z-_z; double d = sqrt(dx*dx+dy*dy+dz*dz); double r = d+bs._r; if (r>_r) _r = r; } else { _r = bs._r; _x = bs._x; _y = bs._y; _z = bs._z; } } } else { setInfinite(); } } }