64,654
社区成员
发帖
与我相关
我的任务
分享
void areashape(double judx,double judy,int dm2)
{
double judx1,judy1,judx2,judy2,id;
for(int i6=0;i6 <coar[dm2].n;i6++) //请问你这个coar[dm2].n,这个coar[],是哪里来的?C++中任何对象,使用的前都必须先定义
//所以,不管你下面的逻辑怎样,这个肯定是错的了
{
if(i6!=coar[dm2].n-1)
{
judx1=coar[dm2].coexbefore[i6].x;
judy1=coar[dm2].coexbefore[i6].y;
judx2=coar[dm2].coexbefore[i6+1].x;
judy2=coar[dm2].coexbefore[i6+1].y;
}
else
{
judx1=coar[dm2].coexbefore[i6].x;
judy1=coar[dm2].coexbefore[i6].y;
judx2=coar[dm2].coexbefore[i6-1].x;
judy2=coar[dm2].coexbefore[i6-1].y;
}
id=(judx-judx1)*(judx-judx2);
if(id <0)
{
double a1,b1,c1,a2,b2,c2;
a1=judy2-judy1;
b1=-(judx2-judx1);
c1=judy2*judx1-judy1*judx2;
a2=1;b2=0;c2=judx;
intersection(a1,b1,c1,a2,b2,c2);
jiaopointx=xcoord;
jiaopointy=ycoord;
break;
}
}
if(jiaopointy>judy)
{
lx2=judx; //lx2在lx4下面
ly2=judy;
lx4=jiaopointx;
ly4=jiaopointy;
}
else
{
lx2=jiaopointx;
ly2=jiaopointy;
lx4=judx;
ly4=judy;
}
}
int
dm2)