나는 집합 점을 가지고 있고 볼록 선체를 찾고 싶습니다. 내가 그들을 scipy.spatial (ConvexHull 또는 Delaunay)에 줄 때, 나는 원래 점들을 되 돌린다. 건설에 의해, 이것은 사실이 아니어야한다.scipy.spatial의 볼록 선체 루틴은 원래 점 집합을 다시 나타냅니다.
여기에 누룩 식 배열로 the points이 있습니다. 주어진 2D 예에서 수행으로, 분명히 이러한 점 중 일부는 볼록 선체 내부하며 spatial.ConvexHull (점) 또는 spatial.Delaunay (점)을 통해 제거해야
import pickle
from scipy import spatial
import matplotlib.pyplot as plt
points = pickle.load(open("points.p", "rb"))
hullpoints = spatial.ConvexHull(points).points
# plot points
fig = plt.figure()
ax = fig.gca(projection='3d')
# ax.plot(points[:, 0], points[:, 1], points[:, 2], 'r.') # original points
ax.plot(hullpoints[:, 0], hullpoints[:, 1], hullpoints[:, 2], 'r.') # convex hull of points
# set labels and show()
ax.set_xlabel('Player 1')
ax.set_ylabel('Player 2')
ax.set_zlabel('Player 3')
plt.show()
: 내 코드는 아래와 같습니다 here.
왜 원래 세트를 다시 얻는 지 아는 사람이 있습니까? 나는 외력을 찾아 외곽 점을 찾아 내고 그 외양만을 구술 할 수 있지만 궁극적 인 목표는 외형에 대한 외형을 점으로 근사화 한 것입니다.하지만 scipy.spatial이이를 수행 할 수 있어야합니다.
그것은 아마'hull.points [np.unique (hull.simplices)]'그는 볼록 선체에 독특한 포인트의 실제 목록을 얻기 위해 전화를하고 싶어. – Jaime
그게 다야! 정말 고마워. – benten