Did I find the right examples for you? yes no

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def incr_douglas_peucker(x, y, epsilon, max_indexes=sys.maxint):
    indexes = set([0])
    queue = [(0, len(x) - 1)]
    i = 0
    while i < len(queue):
        left, right = queue[i]
        i += 1
        indexes.add(right)
        if len(indexes) == max_indexes:
            break
        kx, ky = y[left] - y[right], x[right] - x[left]
        c = x[left] * y[right] - x[right] * y[left]
        pivot = left + 1
        max_dist = abs(kx * x[pivot] + ky * y[pivot] + c)
        for j in xrange(left + 2, right):
            dist = abs(kx * x[j] + ky * y[j] + c)
            if dist > max_dist:
                max_dist = dist
                pivot = j
        max_dist /= math.sqrt((x[right] - x[left]) ** 2
                              + (y[right] - y[left]) ** 2)
        if max_dist > epsilon:
            indexes.add(pivot)
            if len(indexes) == max_indexes:
                break
            queue.append((left, pivot))
            queue.append((pivot, right))
    return sorted(indexes)
        


src/i/g/igc2kmz-HEAD/igc2kmz/__init__.py   igc2kmz(Download)
             / (scale.range[1] - scale.range[0])
             for v in values]
        indexes = util.incr_douglas_peucker(self.time_positions, y, 1, 450)
        chart.add_data([self.track.t[i] for i in indexes])
        chart.add_data([values[i] for i in indexes])