Блог пользователя wao.uchiha

Автор wao.uchiha, 11 лет назад, По-английски

Hi all, I am currently thinking about an interesting geometry problem: Give N point (xi,yi) find a circle that it eclose at least 3 points and its radius is minium as possible. Print the result exactly 5 digits after the dot. I can solve the easy version of it with the limits 3<=N<=1000 and -30000<=xi,yi<=30000: http://vn.spoj.com/problems/TRIPOD/ But wth the hard version 3<=N<=100000 and -2100000000<=xi,yi<=2100000000: http://vn.spoj.com/problems/TRIPOD2/ I have no idea, can anyone show me the way to solve it?

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

I know an easy-to-prove but hard-to-implement O(n * log n) solution.

Very short outline: you need to build a Delaunay triangulation and check all the triangles of it.

If there were no three points lying on a same straight line and no four points that can be inscribed into a circle, the solution would be exactly what I've mentioned above, but since this is not true, you'll need to deal with some special cases.

  • »
    »
    11 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

    Can you provide a proof? I know that maximal radius should be minimal, but why minimal radius will be as minimal as possible?

    • »
      »
      »
      11 лет назад, # ^ |
      Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

      Yes, I can.

      Let's add additional constraints I've mentioned above: we don't have three points lying on the same straight line and we don't have four points lying on the same circle.

      Let's first solve a very easy case of our problem: we have only 3 points. Obviously, for obtuse triangle the center of the enclosing circle will be located at the center of the largest side, otherwise it'll coincide with the center of the circumcircle.

      Let's formulate the problem in another terms: we have a function f(x, y), which equals to the distance between (x, y) and the third nearest point to it. We need to find the global minimum of this function.

      Let's notice a fact that for arbitrary (x, y) three nearest points to it lie in Voronoi's cells that form a connected area. It can be easily proved by contradiction. But this cells not only form a connected area, but are pairwise adjacent, due to our constraints (it's pretty obvious, but if you need a proof — I'll leave it as a task for you).

      But since for each (x, y) three nearest points lie in adjacent Voronoi's cells, these points belong to a triangle of the Delaunay triangulation. Q.E.D.

      UPD. I've made a huge mistake. It's not true that the cells of the three nearest points are pairwise adjacent. So, the proof and the solution are incorrect and we need to find how to deal with the problem I've found. My best solution now is again O(N2)

      Counterexample:

      6
      -2 0
      2 0
      -5 1
      5 -1
      0 8
      0 -8
      
»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

@Alexander: Thanks for hide. It seem your algorithm is too hard for me, can you tell me a easier solution or give some information about Delaunay triangulation?

  • »
    »
    11 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I gave you the easiest solution I've come up with. About Delaunay triangulation (and its connection to Voronoi's diagram) you should read Wikipedia and look for links there. Also, Google will help you :).

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
  • »
    »
    11 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    As far as I understood from the paper we can find minimal enclosing circle to all points, not some three. Am I wrong?

    • »
      »
      »
      11 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Ahh, ok. I think I should read the question first :) I assumed by the tittle that it was the standard 'Minimum Enclosing Circle' problem

      • »
        »
        »
        »
        11 лет назад, # ^ |
          Проголосовать: нравится +8 Проголосовать: не нравится

        I feel that the Closest Pair of Points problem can be adapted to work: - Recurse on the left - Recurse on the right - Min radii so far is d - Be clever and think how to combine left and right (1 from left and 2 from right, and the other way, 'move' using a box of 4d x 4d, etc..)