2016-04-08 9 views
0

x1、y1、x2、y2の中心を持つ2つのサークル(円-1、円-2)は、その後同じサイズでなければなりません。その後、2つの同じ円のパーセンテージでスーパーインポーズレベルを見つける

今私は(パーセントで)CIR1にCIR2のスーパーインポーズの割合を計算したい (EX)CIR2が完全にCIR1をカバーする場合と半分スーパーインポーズがない場合、スコアは、50%がましだろうに行われている場合= 100% を重ねます= 0%で重畳する。

これを行う方法.....?返信用

どれガイド....

+0

http://mathworld.wolfram.com/Circle-CircleIntersection.html –

+0

感謝。理解するのがほとんど難しい。数式距離= Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))を計算する他の方法はありませんか?と1つ.... – user6176116

+0

距離の式で言うことは、いくつかのパーセント値に変換することができます – user6176116

答えて

0
Thanks Andy. 
I got an idea from the link you provide. 
Though the idea is not the best, but it solves the purpose.. 

double radius = 40.0; 
int x1 =100; //first Circle X value 
int y1 = 100; //first Circle Y value 
int x2 = 100; //second Circle X value 
int y2 = 100; //second Circle Y value 

double iDist = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); 
double per = (100.0-(iDist/radius)*100); //get the value in % 
System.out.println("Distance: "+iDist + "("+per+"%)"); 


OUTPUT: 

if values are (100,100) and (100,100) then o/p : 100% 
if values are (100,100) and (120,100) then o/p : 50% 
if values are (100,100) and (140,100) then o/p : 0% 
if values are (100,100) and (600,600) then o/p : percentage in negative value (ex) - 973% 


All the best....! 
関連する問題