两边交叉区域 [英] Area of Intersection between Two Circles

查看:145
本文介绍了两边交叉区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定两个圈:

  • C1 at( x1 ,<$ c $

  • C2( x2 code>, y2 )与 radius2



你如何计算交叉点的面积?当然,所有标准的数学函数( sin cos 等)都是可用的。

解决方案

好的,使用Wolfram链接和Misnomer的提示来看等式14,我使用我列出的变量和这些中心(可以从中派生出来):

  Double r = radius1; 
Double R = radius2;
Double d = distance;
if(R // swap
r = radius2;
R = radius1; ((d * d + r * r - R * R)/(2 * d * r)); b(b * b)
Double part1 = r * r * Math.acos ((d * d + R * R-r * r)/(2 * d * R));(b)b部分2 = R * R * Math.acos (d-r + R)*(d + r-R)*(d-r + R)*(d + r + R));

Double intersectionArea = part1 + part2 - part3;


Given two circles:

  • C1 at (x1, y1) with radius1
  • C2 at (x2, y2) with radius2

How do you calculate the area of their intersection? All standard math functions (sin, cos, etc.) are available, of course.

解决方案

Okay, using the Wolfram link and Misnomer's cue to look at equation 14, I have derived the following Java solution using the variables I listed and the distance between the centers (which can trivially be derived from them):

Double r = radius1;
Double R = radius2;
Double d = distance;
if(R < r){
    // swap
    r = radius2;
    R = radius1;
}
Double part1 = r*r*Math.acos((d*d + r*r - R*R)/(2*d*r));
Double part2 = R*R*Math.acos((d*d + R*R - r*r)/(2*d*R));
Double part3 = 0.5*Math.sqrt((-d+r+R)*(d+r-R)*(d-r+R)*(d+r+R));

Double intersectionArea = part1 + part2 - part3;

这篇关于两边交叉区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆