org.apache.commons.math3.geometry.enclosing

## Class WelzlEncloser<S extends Space,P extends Point<S>>

- java.lang.Object
- - org.apache.commons.math3.geometry.enclosing.WelzlEncloser<S,P>

- Type Parameters:
    `S` - Space type.
    `P` - Point type.
  All Implemented Interfaces:
    Encloser<S,P>

      public class WelzlEncloser<S extends Space,P extends Point<S>>
      extends Object
      implements Encloser<S,P>

  Class implementing Emo Welzl algorithm to find the smallest enclosing ball in linear time.

  The class implements the algorithm described in paper Smallest Enclosing Disks (Balls and Ellipsoids) by Emo Welzl, Lecture Notes in Computer Science 555 (1991) 359-370. The pivoting improvement published in the paper Fast and Robust Smallest Enclosing Balls, by Bernd Gärtner and further modified in paper Efficient Computation of Smallest Enclosing Balls in Three Dimensions by Linus Källberg to avoid performing local copies of data have been included.

  Since:
    3.3
  Version:
    $Id: WelzlEncloser.java 1591835 2014-05-02 09:04:01Z tn $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WelzlEncloser(double tolerance, SupportBallGenerator<S,P> generator)` Simple constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `EnclosingBall<S,P>` | `enclose(Iterable<P> points)` Find a ball enclosing a list of points.
    `P` | `selectFarthest(Iterable<P> points, EnclosingBall<S,P> ball)` Select the point farthest to the current ball.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WelzlEncloser

          public WelzlEncloser(double tolerance,
                       SupportBallGenerator<S,P> generator)

      Simple constructor.
      Parameters:
        `tolerance` - below which points are consider to be identical
        `generator` - generator for balls on support

  - ### Method Detail

    - #### enclose

          public EnclosingBall<S,P> enclose(Iterable<P> points)

      Find a ball enclosing a list of points.
      Specified by:
        `enclose` in interface `Encloser<S extends Space,P extends Point<S>>`
      Parameters:
        `points` - points to enclose
      Returns:
        enclosing ball

    - #### selectFarthest

          public P selectFarthest(Iterable<P> points,
                         EnclosingBall<S,P> ball)

      Select the point farthest to the current ball.
      Parameters:
        `points` - points to be enclosed
        `ball` - current ball
      Returns:
        farthest point

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.