圆圈交汇点交汇点、圆圈

2023-09-11 02:04:18 作者:王者杀欲起

我如何计算交会的两个圆点。我希望那里是任意两个,一个或者没有交点在所有情况下。

How do I calculate the intersection points of two circles. I would expect there to be either two, one or no intersection points in all cases.

予有x和中心点的y坐标,和半径为每个圆

I have the x and y coordinates of the centre-point, and the radius for each circle.

在Python的答案会是preferred,但任何工作的算法是可以接受的。

An answer in python would be preferred, but any working algorithm would be acceptable.

推荐答案

您还可能会发现C code。在我的书的计算几何在C中,第8章。 在code( arm.c )可在该链接(也Java中)。但它看起来像你现在有几个code来源。

You may also find C code in my book Computational Geometry in C, Chapter 8. The code (arm.c) is available at that link (also in Java). But it looks like you have several code sources by now.

请注意,有可能为两个圆,以零个,一个,两个,或无限点数相交。据我所看到的,贴code不处理所有的可能性, 但特殊情况下,都不难发现。

Note that it is possible for two circles to intersect in zero, one, two, or an infinite number of points. As far as I can see, the posted code does not handle all possibilities, but the special cases are not difficult to detect.