已知一段弧的起点和终点以及其凸度,求其圆心
int getCenter(ads_point startPoint,ads_point endPoint,double bulge,ads_point& center){
if (bulge==0.0)
{
ads_point_set(startPoint,center);
return 0;
}
ads_point startPt,endPt;
if (bulge<0.0)
{
ads_point_set(endPoint,startPt);
ads_point_set(startPoint,endPt);
bulge=bulge*(-1.0);
}
else
{
ads_point_set(startPoint,startPt);
ads_point_set(endPoint,endPt);
}
double distStartToEnd,distX,distY,radius;
distStartToEnd=ads_distance(startPt,endPt);
distX=distStartToEnd/2.0;
distY=bulge*distX;
radius=((distX*distX)+(distY*distY))/(2.0*distY);
double tmpAng;
ads_point tmpPt;
tmpAng=ads_angle(startPt,endPt);
ads_polar(startPt,tmpAng,distX,tmpPt);
ads_polar(tmpPt,(tmpAng+(_PI/2.0)),(radius-distY),center);
return 1;
};
谢谢分享!学习了 感谢
页:
[1]