Example #1
0
    /**
     * Works by computing the centroid, then finding the largest radius. This will not, in general,
     * produce the minimal bounding circle.
     */
    protected void init(GeoArray region) {
      Geo c = Intersection.center(region, new Geo()); // centroid
      Geo storage = new Geo();
      double r = 0.0;
      int length = region.getSize();
      for (int i = 0; i < length; i++) {
        double pr = c.distance(region.get(i, storage));
        if (pr > r) {
          r = pr;
        }
      }

      init(c, r);
    }
Example #2
0
    /**
     * Works by computing the centroid, then finding the largest radius. This will not, in general,
     * produce the minimal bounding circle.
     */
    protected void init(Geo[] region) {
      Geo c = Intersection.center(region); // centroid

      double r = 0.0;
      int length = region.length;
      for (int i = 0; i < length; i++) {
        double pr = c.distance(region[i]);
        if (pr > r) {
          r = pr;
        }
      }

      init(c, r);
    }