I used Scipy Delaunay
to compute the 3D convex hull of a set of points, and I'd like to get a list of all its external sides (triangles defined by 3 points), anybody knows how to get that information?
Thanks
code:
import scipy.spatial
import numpy as np
import csv
"""loading colors"""
colors = np.array([(XYZRGB(rank, name, X, Y, Z))
for rank, name, X, Y, Z in csv.reader(open('colorshort.csv'))])
"""doing geometry"""
tri = scipy.spatial.Delaunay(colors[:,[2,3,4]], furthest_site=False)
# Delaunay triangulation
indices = tri.simplices
# indices of vertices
vertices = colors[indices]
# the vertices for each tetrahedron
If you look at help(tri)
you'll see a list of all the attributes of tri
. I think the attribute you are looking for is tri.convex_hull
, which gives the indices of the points belonging to the convex hull. So to get the actual vertices you would use
colors[tri.convex_hull]