Last active
September 15, 2020 03:08
-
-
Save mnrn/cf6fbd7953a26902da5b1852c704122e to your computer and use it in GitHub Desktop.
Pythonでの凸包計算
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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