Algorithm to cover maximal number of points with one circle of given radius

后端 未结 10 1517
Happy的楠姐
Happy的楠姐 2020-12-23 14:19

Let\'s imagine we have a plane with some points on it. We also have a circle of given radius.

I need an algorithm that determines such position of the circle that it

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 14:45

    Edited to better wording, as suggested :

    Basic observations :

    • I assume the radius is one, since it doesn't change anything.
    • given any two points, there exists at most two unit circles on which they lie.
    • given a solution circle to your problem, you can move it until it contains two points of your set while keeping the same number of points of your set inside it.

    The algorithm is then:

    • For each pair of points, if their distance is < 2, compute the two unit circles C1 and C2 that pass through them.
    • Compute the number of points of your set inside C1 and C2
    • Take the max.

提交回复
热议问题