Skip to content

Instantly share code, notes, and snippets.

@mnrn
Last active September 15, 2020 03:08
Show Gist options
  • Select an option

  • Save mnrn/cf6fbd7953a26902da5b1852c704122e to your computer and use it in GitHub Desktop.

Select an option

Save mnrn/cf6fbd7953a26902da5b1852c704122e to your computer and use it in GitHub Desktop.
Pythonでの凸包計算
import numpy as np
from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
if __name__ == '__main__':
points = np.loadtxt('points.csv', delimiter=' ')
plt.scatter(points[:, 0], points[:, 1])
hull = ConvexHull(points)
for simplex in hull.simplices:
plt.plot(points[simplex, 0], points[simplex, 1], 'k-')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment