[英]How do i find the smallest point P(x,y) containing triangle from a bunch of points?
This is something a human child can do, but I need a computer to do it :D 这是人类孩子可以做的事情,但是我需要一台电脑来完成它:D
Guess you have a point P(x,y) and you have an array of points A = [P1, P2, P3, …]
假设您有一个点P(x,y),并且有一个点数组A = [P1, P2, P3, …]
What i basically need to get is the 3 points that 我基本上需要得到的是3点
Well, of course I could just bruteforce it by calculating all possible triangles, barycentric interpolate if they're containing the point and compare the areas size of the resulting triangles, but this soon gets very time consuming. 好吧,当然,我可以通过计算所有可能的三角形,如果它们包含点的重心插值并比较所得三角形的面积大小来对其进行蛮力分析,但这很快就非常耗时。
I think this has been done before and is one of those ›if-you-know-the-name-of-the-algorythm-you-know-what-to-implement‹-problems. 我认为这是以前做过的,如果您知道算法的名称,您知道该如何实施‹问题之一。
I should add that if two triangles are reasonably close in size, than any of them would be a good solution, so in that case, the faster solution would be the better one. 我应该补充一点,如果两个三角形的大小相当接近,那么比任何一个三角形都将是一个很好的解决方案,因此在这种情况下,越快的解决方案越好。
Build Delaunay triangulation for given set of points and find triangle containing the point. 为给定的点集构建Delaunay三角剖分 ,并找到包含该点的三角形。
Perhaps it will not the most optimal triangle, but algorithm is well-known and fast. 也许它不是最佳的三角形,但是算法是众所周知的且速度很快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.