Closed vianamp closed 4 years ago
@vianamp your alpha_shape variable there is a Shapely polygon object. I'm not sure this is the sort of thing I'd expect alphashape (the package) to handle. Using some basic mapping, you could probably determine this yourself:
point_to_index = {tuple(point): idx for idx, point in enumerate(points)}
alpha_shape = alphashape.alphashape(points, 5)
indices = {point_to_index[point] for point in alpha_shape.exterior.coords}
where indices
is a set of all your original points
indexes in the alpha_shape
exterior. Note that this probably isn't a sufficient solution as shapely's internal coords are always floats while I'm unsure your points
array is necessarily all floats
Hi. Great job with alphashape!
I am doing
alpha_shape = alphashape.alphashape(points, 5)
, where points is aNx3
numpy array.I found that if I do
alpha_shape.exterior.coords.xy
I can retrieve the coordinates of the points in the alpha shape contour. I was wondering whether there is a way to retrieve instead the original indexes relative topoints
.Many thanks,