资源简介
这里给出一个已知两点坐标和圆心角,求圆心坐标的程序源码,供大家参考,代码涉及大量数学推导,求解出唯一的圆心坐标,
代码片段和文件信息
void CircleCenter(double x1double y1double x2double y2double centerAngledouble &xdouble &y)
{
double L=sqrt(pow((x1-x2)2)+pow((y1-y2)2)); //弦长
double R=0.5*L/sin(0.5*centerAngle);//圆弧半径
if(x1 == x2)
{
y = (y1 + y2) / 2;
if(y1 > y2 && centerAngle > PI )
x = x1 - sqrt(R*R-pow((y2 - y1)/22));
else
x = x1 + sqrt(R*R-pow((y2 - y1)/22));
}
else
{
double c1 = (x
评论
共有 条评论