How can I find the minimal circle include some given points?

时光毁灭记忆、已成空白 提交于 2019-11-29 03:07:15

问题


I have given some points (2D-coordinates) and want to find the smallest circle, that includes all of this points. The algorithm doesn't have to be very efficient (while it would be nice naturally).


回答1:


This is the so-called Smallest Enclosing Balls problem (in your case, Smallest Enclosing Circle), a.k.a. Miniball. There are several algorithms and implementations out there for this problem – all of the following are linear-time solutions (i.e., given n balls, they run in O(n) if you consider the dimension d fixed, d=2 in your case):

  • For 2D and 3D, Gärtner's implementation is probably the fastest.

  • For higher dimensions (up to 10,000, say), take a look at https://github.com/hbf/miniball, which is the implementation of an algorithm by Gärtner, Kutz, and Fischer (note: I am one of the co-authors).

  • For very, very high dimensions, core-set (approximation) algorithms will be faster.

Note: If you are looking for an algorithm to compute the smallest enclosing sphere of spheres, you will find a C++ implementation in the Computational Geometry Algorithms Library (CGAL). (You do not need to use all of CGAL; simply extract the required header and source files.)



来源:https://stackoverflow.com/questions/3102547/how-can-i-find-the-minimal-circle-include-some-given-points

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!