I am trying to use scipy (0.10.1) for a quick hack to visualize a convex hull.
I can get the convex hull using the following code:
vecs = [[-0.094218, 51.478927], [-0.09348, 51.479364], [-0.094218, 51.478927], ... [-0.094218, 51.478927], [-0.094321, 51.479918], [-0.094218, 51.478927], [-0.094222, 51.478837], [-0.094241, 51.478388], [-0.094108, 51.478116], [-0.09445, 51.480279], [-0.094256, 51.478028], [-0.094326, 51.500511]] hull = scipy.spatial.Delaunay(vecs).convex_hull
the resulting array is as follows:
[[56, 9], [16, 1], [56, 1], [55, 9], [53, 55], [53, 16]]
numbers are vertex indices. My problem , they are not ordered . I need them to be in CW or CCW order to easily visualize them in KML.
Is there an easy way to get scipy.spatial to calculate the correct clock order?
python scipy geometry computational-geometry convex-hull
Anony-mousse
source share