最小面积三角形从给定的一组点。

时间:2021-10-26 11:30:22

Given a set of n points, can we find three points that describe a triangle with minimum area in O(n^2)? If yes, how, and if not, can we do better than O(n^3)?

给定一组n个点的,我们能找到三分,描述一个三角形与O(n ^ 2)最低区在哪里?如果是,如何,如果没有,我们可以做得更好比O(n ^ 3)?

I have found some papers that state that this problem is at least as hard as the problem that asks to find three collinear points (a triangle with area 0). These papers describe an O(n^2) solution to this problem by reducing it to an instance of the 3-sum problem. I couldn't find any solution for what I'm interested in however. See this (look for General Position) for such a paper and more information on 3-sum.

我发现一些论文状态,这个问题至少是一样难的问题要求找到三个共线的点(一个三角形面积0)。这些论文描述一个O(n ^ 2)解决这个问题通过减少3-sum问题的一个实例。但是我找不到任何解决方法来解决我感兴趣的问题。看这个(寻找一般的位置)这样的论文和更多关于3和的信息。

3 个解决方案

#1


5  

There are O(n2) algorithms for finding the minimum area triangle.

有O(n2)算法来寻找最小面积三角形。

For instance you can find one here: http://www.cs.tufts.edu/comp/163/fall09/CG-lecture9-LA.pdf

例如,您可以在这里找到http://www.cs.tufts.edu/compg - 163/ fall09/clecture9 - la.pdf

If I understood that pdf correctly, the basic idea is as follows:

如果我正确理解了pdf,基本思路如下:

  1. For each pair of points AB you find the point that is closest to it.

    对于每一对AB点,你都能找到离它最近的点。

  2. You construct a dual of the points so that lines <-> points. Line y = mx + c is mapped to point (m,c)

    你构造一个点的对偶,使线<->点。直线y = mx + c映射到点(m,c)

  3. In the dual, for a given point (which corresponds to a segment in original set of points) the nearest line vertically gives us the required point for 1.

    在对偶中,对于给定的点(它对应于原始点集合中的线段),最近的直线垂直地给出了1的所需点。

Apparently 2 & 3 can be done in O(n2) time.

显然2和3可以在O(n2)时间内完成。

Also I doubt the papers showed 3SUM-hardness by reducing to 3SUM. It should be the other way round.

同时我也怀疑这些论文通过减少到3个而显示出3个萨姆的硬度。应该是相反的。

#2


2  

There's an algorithm that finds the required area with complexity O(n^2*log(n)).

有一个算法,找到所需的面积与复杂度O(n ^ 2 * log(n))。

For each point Pi in set do the following(without loss of generality we can assume that Pi is in the origin or translate the points to make it so).

对于集合中的每个点,做以下操作(在不丢失通用性的情况下,我们可以假设圆周率在原点,或者将点转化为原点)。

Then for each points (x1,y1), (x2,y2) the triangle area will be 0.5*|x1*y2-x2*y1| so we need to minimize that value. Instead of iterating through all pairs of remaining points (which gives us O(N^3) complexity) we sort those points using predicate X1 * Y2 < X2 * Y1. It is claimed that to find triangle with minimal area we need to check only the pairs of adjacent points in the sorted array.

对于每个点(x1,y1), (x2,y2)三角形的面积是0。5*|x1*y2-x2*y1 *|所以我们需要最小化这个值。而不是遍历所有成对的剩余点(这让我们O(N ^ 3)复杂性)我们这些点使用谓词X1 * Y2 < X2 * Y1。为了找到面积最小的三角形,我们只需要检查排序数组中相邻点的对。

So the complexity of this procedure for each point is n*log(n) and the whole algorithm works in O(n^2*log(n))

所以这个过程的复杂性为每个点是n * log(n)和整个算法在O(n ^ 2 * log(n))

P.S. Can't quickly find the proof that this algorithm is correct :(, hope will find it it later and post it then.

P.S.不能很快找到证明这个算法是正确的证据:(,希望以后能找到并贴出来。)

#3


1  

The problem

这个问题

Given a set of n points, can we find three points that describe a triangle with minimum area in O(n^2)? If yes, how, and if not, can we do better than O(n^3)

给定一组n个点的,我们能找到三分,描述一个三角形与O(n ^ 2)最低区在哪里?如果是的,,如果没有,我们可以做得更好O(n ^ 3)

is better resolved in this paper: James King, A Survey of 3sum-Hard Problems, 2004

在这篇论文中是否有更好的解决方法:詹姆斯·金,一项关于3道难题的调查,2004年

#1


5  

There are O(n2) algorithms for finding the minimum area triangle.

有O(n2)算法来寻找最小面积三角形。

For instance you can find one here: http://www.cs.tufts.edu/comp/163/fall09/CG-lecture9-LA.pdf

例如,您可以在这里找到http://www.cs.tufts.edu/compg - 163/ fall09/clecture9 - la.pdf

If I understood that pdf correctly, the basic idea is as follows:

如果我正确理解了pdf,基本思路如下:

  1. For each pair of points AB you find the point that is closest to it.

    对于每一对AB点,你都能找到离它最近的点。

  2. You construct a dual of the points so that lines <-> points. Line y = mx + c is mapped to point (m,c)

    你构造一个点的对偶,使线<->点。直线y = mx + c映射到点(m,c)

  3. In the dual, for a given point (which corresponds to a segment in original set of points) the nearest line vertically gives us the required point for 1.

    在对偶中,对于给定的点(它对应于原始点集合中的线段),最近的直线垂直地给出了1的所需点。

Apparently 2 & 3 can be done in O(n2) time.

显然2和3可以在O(n2)时间内完成。

Also I doubt the papers showed 3SUM-hardness by reducing to 3SUM. It should be the other way round.

同时我也怀疑这些论文通过减少到3个而显示出3个萨姆的硬度。应该是相反的。

#2


2  

There's an algorithm that finds the required area with complexity O(n^2*log(n)).

有一个算法,找到所需的面积与复杂度O(n ^ 2 * log(n))。

For each point Pi in set do the following(without loss of generality we can assume that Pi is in the origin or translate the points to make it so).

对于集合中的每个点,做以下操作(在不丢失通用性的情况下,我们可以假设圆周率在原点,或者将点转化为原点)。

Then for each points (x1,y1), (x2,y2) the triangle area will be 0.5*|x1*y2-x2*y1| so we need to minimize that value. Instead of iterating through all pairs of remaining points (which gives us O(N^3) complexity) we sort those points using predicate X1 * Y2 < X2 * Y1. It is claimed that to find triangle with minimal area we need to check only the pairs of adjacent points in the sorted array.

对于每个点(x1,y1), (x2,y2)三角形的面积是0。5*|x1*y2-x2*y1 *|所以我们需要最小化这个值。而不是遍历所有成对的剩余点(这让我们O(N ^ 3)复杂性)我们这些点使用谓词X1 * Y2 < X2 * Y1。为了找到面积最小的三角形,我们只需要检查排序数组中相邻点的对。

So the complexity of this procedure for each point is n*log(n) and the whole algorithm works in O(n^2*log(n))

所以这个过程的复杂性为每个点是n * log(n)和整个算法在O(n ^ 2 * log(n))

P.S. Can't quickly find the proof that this algorithm is correct :(, hope will find it it later and post it then.

P.S.不能很快找到证明这个算法是正确的证据:(,希望以后能找到并贴出来。)

#3


1  

The problem

这个问题

Given a set of n points, can we find three points that describe a triangle with minimum area in O(n^2)? If yes, how, and if not, can we do better than O(n^3)

给定一组n个点的,我们能找到三分,描述一个三角形与O(n ^ 2)最低区在哪里?如果是的,,如果没有,我们可以做得更好O(n ^ 3)

is better resolved in this paper: James King, A Survey of 3sum-Hard Problems, 2004

在这篇论文中是否有更好的解决方法:詹姆斯·金,一项关于3道难题的调查,2004年