Example #1
0
  public static SphericalRegion getEnclosingSphere(RectangularBox box) {
    Point3f centre =
        new Point3f(
            (box.getHighestXValue() + box.getLowestXValue()) / 2,
            (box.getHighestYValue() + box.getLowestYValue()) / 2,
            (box.getHighestZValue() + box.getLowestZValue()) / 2);

    float radius =
        centre.distance(
            new Point3f(box.getLowestXValue(), box.getLowestYValue(), box.getLowestZValue()));

    SphericalRegion newSphere = new SphericalRegion(centre.x, centre.y, centre.z, radius);

    return newSphere;
  }