def b_minidisk(self, points, npts, boundary, nbnd):
        """
        A recursive minimum enclosing disk algorithm. Based on E. Welzl,
        "Smallest enclosing disks (balls and ellipsoids)", 1991.

        This code borrows some patterns from the applet source here:
        http://www.sunshine2k.de/stuff/Java/Welzl/Welzl.html

        @param points: A random array of non-duplicating points.
        @param npts: The position in the point array for searching.
        @param boundary: The farthest outliers on or in the smallest disk.
        @param nbnd: The index of the boundary list for the next boundary point.
        @return: A L{Roeck.Circle} minimum enclosing disk for the points.
        """
        if npts == 1 and nbnd == 0:
            disk = Roeck.Circle([points[0]])
        elif npts == 1 and nbnd == 1:
            disk = Roeck.Circle([points[0],boundary[0]])
        elif npts == 0 and nbnd == 2:
            disk = Roeck.Circle(boundary[0:2])
        elif nbnd == 3:
            disk = Roeck.Circle(boundary)
        else:
            self.rec+=1
            disk = self.b_minidisk(points, npts - 1, boundary, nbnd)
            
            if not disk.contains(points[npts-1]):
                boundary[nbnd] = points[npts - 1]

                self.rec+=1
                disk = self.b_minidisk(points, npts - 1, boundary, nbnd + 1)

        self.rec-=1
        return disk
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/calculators.py/Roeck.b_minidisk/original