两圆相交问题 2 circles intersection

The question is: Given the coordinates and radius of 2 circles, how could we figure out the 2 intersection points of them?

 

Sure, it could be easily done by using the formula of root. And there are many other methods also. None of them is hard to figure out. (Although the formula of root requires great patience to verify the super long formula sentences.)

 

I have been engaged with this problem in my research recently. At first, I applied the formula of root thing. And I got some error because the inaccuracy of the outcome intersections. I thought it could be: 1st, the algorithm, since I noticed that some intermediate variable got astronomical large during the compuation. 2nd, the inaccuracy of the essence of float number. Since float number is always an approximation of real number.

 

Base on my first thought, I did the following changes:

 

1) Apply another method. I implemented another algorithm which I thought would be better. (Actually, I don't know the exact answer so there is no way I can tell an outcome is good or not.) I did get different answer to the 1st algorithm, but the difference is trival, if not neglectable. The results only differ in 10^-13, which I believe is not significant to this problem I am dealing with. So, that's not about the algorithm. (But the 2nd one is faster really.)

 

2) Using the data type "Decimal" in VB.NET, which provides more accuracy. When comparing to the data type "Single", the results differs in 10^-7. It could be the case, so let me double check here:

 

Reformulated problem: We randomly pick 1000 real numbers from (0,1). If the differenceany pair of the numbers is less than 10^7, error will occur. So the question is, what's the error probability?

 

Apparently, the Pr for the 1st number DOES NOT violate the restrication is

 

 (1-10^-7)^999  ~= 0.99990010498490 (Got it from matlab, no time for fancy Pr computing. ^_^)

 

To make it easier, suppose each one has the same Pr. So the Pr of all 1000 numbers are correct is:

 

 0.99990010498490 ^1000 = 0.90492790183237

 

We thus know the error Pr is around 10%. Hooray! That's pretty high. It could be the reason after all. So how about the error Pr of Decimal? It would be some where around 10*-9. We will change them all to Decimal and see what we can get.

 

 

本程序是两圆相交求交点,输入信息为两圆的圆心坐标和半径值。如有更好的算法,欢迎交流!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值