简体   繁体   English

查找点是否在由一组点生成的凸包中

[英]Finding Whether A Point Is In The Convex Hull Generated By A Set Of Points

I need to calculate convex hull from a set of points. 我需要从一组点计算凸包。

Dimensions of points is usually 10 ~ 30D 点的尺寸通常为10〜30D

Size of the set is small, usually 2 ~ 10 套装的尺寸很小,通常为2〜10

And the task I need is to judge whether a point is inside the convex hull constructed from the point set. 我需要的任务是判断一个点是否在根据该点集构造的凸包内。

What are some algorithms to perform that, or are there any existing libraries that I could use? 有什么算法可以执行该操作,或者我可以使用任何现有的库?

Note:this raw sketch of algorithm, it requires revision.It can output wrong result (see comments below) 注意:此原始算法草图需要修改,可能输出错误结果(请参见下面的注释)

The following is one of a number of possible solutions to your problem. 以下是针对您的问题的多种可能解决方案之一。

Let D - dimension of your space, N - count of your points. 令D-您的空间尺寸,N-您的点数。 You can use following algorithm: 您可以使用以下算法:

You should compute projection convex hull for each coordinate plane of your space. 您应该为空间的每个坐标平面计算投影凸包。 You will get D convex hulls. 您将获得D个凸包。 Complexity of this step is D * N * log N 此步骤的复杂度为D * N * log N

Then you should test, whether each projection of you point is located inside each appropriated convex hull. 然后,应该测试点的每个投影是否位于每个适当的凸包内。 Complexity of this step is D * N (using native algorithm) 此步骤的复杂度为D * N(使用本机算法)

Overall execution complexity = D * N * Log N. 总体执行复杂度= D * N * LogN。

Note: basic idea of this algorithm is to boil down computing convex hull on plane with following testing of location of point. 注意:该算法的基本思想是通过对点的位置进行测试,将计算出的凸包分解为平面。

PS Of course, you can get some degenerate cases, where convex hull can be line segment or just point. PS当然,您可能会得到一些退化的情况,其中凸包可以是线段或仅是点。 But these cases can be easlity treated 但是这些情况可以缓和

PPS This algorithm only allows to check whether point lies inside convex hull or on its boundary PPS此算法仅允许检查点是否位于凸包内或其边界上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM