请问下面这个C++程序都包含什么函数? #include<iostream> #include<Cmath> using namespace std; #define 10
/*这里计算BA与CD延长后的交点坐标*/{doublecdx,cdy,abx,aby,dax,day,del,du,dv;cdx=c.x-d.x;cdy=c.y-d.y...
/*这里计算BA与CD延长后的交点坐标*/
{
double cdx,cdy,abx,aby,dax,day, del,du,dv;
cdx = c.x-d.x;cdy = c.y-d.y;abx = a.x-b.x;
aby = a.y-b.y;dax = d.x-a.x;day = d.y-a.y;
del = cdx*aby-cdy*abx;
du = dax*aby-day*abx;
dv = cdx*day-cdy*dax;
du /= del;dv /= del;
r.x = d.x-du*cdx;
r.y = d.y-du*cdy;
}
/*这里计算四边形ABCD的面积*/
abcd = area_of_triangle(a,b,c) + area_of_triangle(a,d,c);
/*补充检测四边形,看它的凹凸性*/
abcd1= area_of_triangle(a,b,d) + area_of_triangle(b,d,c);
if(fabs(abcd1-abcd)>EPS)
{
cout<<"凹四边形!不行!"<<endl;
exit(2);
/*异常结束2*/}
/*这里计算△RMN的面积*/
rmn = area_of_triangle(r,m,n);
/*这里是二者相除,看它是否非常接近于4.00*/
cout<<"as a result"<<endl;
cout<<"ABCD:RMN="<<abcd<<":"<<rmn<<"="<<abcd/rmn<<endl;
} 展开
{
double cdx,cdy,abx,aby,dax,day, del,du,dv;
cdx = c.x-d.x;cdy = c.y-d.y;abx = a.x-b.x;
aby = a.y-b.y;dax = d.x-a.x;day = d.y-a.y;
del = cdx*aby-cdy*abx;
du = dax*aby-day*abx;
dv = cdx*day-cdy*dax;
du /= del;dv /= del;
r.x = d.x-du*cdx;
r.y = d.y-du*cdy;
}
/*这里计算四边形ABCD的面积*/
abcd = area_of_triangle(a,b,c) + area_of_triangle(a,d,c);
/*补充检测四边形,看它的凹凸性*/
abcd1= area_of_triangle(a,b,d) + area_of_triangle(b,d,c);
if(fabs(abcd1-abcd)>EPS)
{
cout<<"凹四边形!不行!"<<endl;
exit(2);
/*异常结束2*/}
/*这里计算△RMN的面积*/
rmn = area_of_triangle(r,m,n);
/*这里是二者相除,看它是否非常接近于4.00*/
cout<<"as a result"<<endl;
cout<<"ABCD:RMN="<<abcd<<":"<<rmn<<"="<<abcd/rmn<<endl;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询