Beispiel #1
0
def main(num_groups=1, group_size=100_000):
    kwargs = dict(num_groups=num_groups, group_size=group_size, seed=1)
    # generate random normally distributed clusters of points, 200 X 2 numpy array.
    points = generate_test_points(**kwargs)
    lmax = get_estimated_lmax(**kwargs)
    polylidar_kwargs = dict(alpha=0.0, lmax=lmax)
    polygons, timings = extractPolygonsAndTimings(points, **polylidar_kwargs)
    print(timings)
Beispiel #2
0
def polylidar_edgegrowth(reps=3, n_val=n_val_test):
    records = []
    polylidar_kwargs = dict(xyThresh=0.0, alpha=2.0)
    for n in n_val:
        valmax = int(math.sqrt(n))
        points = gen_points(xmax=valmax, ymax=valmax)
        true_n = points.shape[0]
        polygons, times = extractPolygonsAndTimings(points, **polylidar_kwargs)
        # triangles = len(delaunay.triangles) / 3
        # edges = len(delaunay.triangles)
        # borderedges = len(polygons[0].shell)
        # records.append(dict( n=true_n, n_copy=true_n, triangles=triangles, edges=edges, borderedges=borderedges))
    return records
def polylidar_timings(reps=3, n_val=n_val_good):
    records = []
    polylidar_kwargs = dict(xyThresh=0.0, alpha=2.0)
    for n in n_val:
        valmax = int(math.sqrt(n))
        points = gen_points(xmax=valmax, ymax=valmax)
        true_n = points.shape[0]
        for j in range(reps):
            polygons, times = extractPolygonsAndTimings(
                points, **polylidar_kwargs)
            record = dict(n=true_n,
                          delaunay=times[0],
                          region=times[1],
                          polygon=times[2])
            records.append(record)
            print(record)
    return records
def get_polygon(points,
                noise=2.0,
                alpha=0.0,
                xyThresh=0.0,
                add_noise=False,
                **kwargs):
    if add_noise:
        points = points + np.random.randn(points.shape[0], 2) * noise

    polylidar_kwargs = {"alpha": alpha, 'xyThresh': xyThresh}
    # Timing should start here
    # t0 = time.time()
    polygons, timings = extractPolygonsAndTimings(points, **polylidar_kwargs)
    # end = (time.time() - t0) * 1000
    # Timing should end here
    polygons = convert_to_shapely_polygons(polygons,
                                           points,
                                           return_first=False)
    return polygons, timings
Beispiel #5
0
def main(n=10_000_000):
    valmax = int(math.sqrt(n))
    polylidar_kwargs = dict(xyThresh=0.0, alpha=2.0)
    points = gen_points(xmax=valmax, ymax=valmax)
    polygons, times = extractPolygonsAndTimings(points, **polylidar_kwargs)
    print(times)