| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
简单公式对于非相离非相含的情况
设圆心连线段h与圆交点连线段v相交于O.
我们知道h是v的中垂线。
左边圆圆心O1右边圆圆心O2.
O1在O左边a, O2在O右边b
v的一半长度为c
a*a+c*c = r1*r1
b*b+c*c = r2*r2
a+b = dist (h的长度)
这个很容易求出a,b 注意,可能出现负值,但是这个负值是有意义的。
然后求夹角。
double d = dist(x1-x2,y1-y2);
double t1 = d, t2 = (r1*r1-r2*r2)/d;
double a = (t1+t2)/2, b = (t1-t2)/2;
double alpha = acos(a/r1), beta = acos(b/r2);
double area = alpha*r1*r1 - r1*r1*sin(alpha)*cos(alpha) + beta*r2*r2 - r2*r2*sin(beta)*cos(beta);
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator