Alphashape produces unexpected multipolygons for big point clouds

194 Views Asked by At

I'm using:

  • Alpha Shape Toolbox version 1.3.1;
  • Python version 3.10.9;
  • Operating System Windows 10.

While making an alphashape for a group of 2D points, unexpected results with a MultiPolygon are obtained. I expected in each case a single Polygon.

Example 1: 2 polygons Example 2: many polygons Example 2: many polygons (zoomed in) (Points are grey, single polygons of the extracted MultiPolygon each have a different color)

Unfortunately I cannot include the list of points as it's way too long (885 points for example 1 and 1.5 mio for example 2)

Am I doing something wrong? Or is there a limit of pointcount, that alphashape can handle?

import alphashape
import numpy as np
import matplotlib.pyplot as plt

points = np.loadtxt('points_for_alphashape.txt')
shape = alphashape.alphashape(points, alpha=0.5)
print(type(shape))
plt.scatter(*zip(*points), c='gray', s=0.1)
for shape in shape.geoms:
    x,y = shape.exterior.xy
    plt.plot(x,y)
plt.show()
0

There are 0 best solutions below