Mathematical Theorem (2) - Convex Hull Algorithm

1. Concept

Convex Hull is a concept in computational geometry (graphics).
In a real vector space V, for a given set X, the intersection S of all convex sets containing X is called the convex hull of X.
The convex hull of X can use all points in X ( X 1 , X 2 , . . . , X n ) (X_1, X_2, ..., X_n)X1X2...Xn) to construct a linear combination.
In two-dimensional Euclidean space, the convex hull can be imagined as a polygon that just wraps all points.
Specifically, we need to use the outermost circle in the set to form a polygon, which just contains all the point sets. At this time, we call this polygon a convex hull.
insert image description here

2. Solving algorithm

Since I don't need to explore the specific principles, I only give a related function to solve the area of ​​the convex hull.

from scipy.spatial import ConvexHull
kps = np.array([[1.5, 2], [1.5, 10], [12.5, 2], [12.5, 10], [10, 5], [11, 6], [3, 4], [4, 3]])
area = ConvexHull(kps).volume
print(area)

88.0

Guess you like

Origin blog.csdn.net/REstrat/article/details/127270602