📄 dialog34.cpp
字号:
*(c3+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=149;j>l;j--)
{
if(c3[j]<c3[j-1])
{
int temp=c3[j-1];
c3[j-1]=c3[j];
c3[j]=temp;
}
}
}
int r1=0,r2=0,r3=0;
for(int h=0;h<k;h++)
{
if(h<120)
{
if(c1[r1]<c2[r2]&&c1[r1]<c3[r3])
{
r1++;
}
if(c2[r2]<c1[r1]&&c2[r2]<c3[r3])
{
r2++;
}
if(c3[r3]<c1[r1]&&c2[r2]>c3[r3])
{
r3++;
}
}
else
{
if(h<130)
{
if(c2[r2]<c3[r3])
{
r2++;
}
if(c2[r2]>c3[r3])
{
r3++;
}
}
else
r3++;
}
}
if(r2<r1||r2<r3)count++;
}
/////////////////////////////////
int tt5=0;
for(i=200;i<300;i++)
{
int l;
int c1[120];
int c2[130];
int c3[150];
int j=0;
for(j=0;j<120;j++)
{
int x1,x2,y1,y2;
x1=*(onep+2*j);y1=*(onep+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c1+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=119;j>l;j--)
{
if(c1[j]<c1[j-1])
{
int temp=c1[j-1];
c1[j-1]=c1[j];
c1[j]=temp;
}
}
}
for(j=0;j<130;j++)
{
int x1,x2,y1,y2;
x1=*(towp+2*j);y1=*(towp+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c2+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=129;j>l;j--)
{
if(c2[j]<c2[j-1])
{
int temp=c2[j-1];
c2[j-1]=c2[j];
c2[j]=temp;
}
}
}
for(j=0;j<150;j++)
{
int x1,x2,y1,y2;
x1=*(threep+2*j);y1=*(threep+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c3+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=149;j>l;j--)
{
if(c3[j]<c3[j-1])
{
int temp=c3[j-1];
c3[j-1]=c3[j];
c3[j]=temp;
}
}
}
int r1=0,r2=0,r3=0;
for(int h=0;h<k;h++)
{
if(h<120)
{
if(c1[r1]<c2[r2]&&c1[r1]<c3[r3])
{
r1++;
}
if(c2[r2]<c1[r1]&&c2[r2]<c3[r3])
{
r2++;
}
if(c3[r3]<c1[r1]&&c2[r2]>c3[r3])
{
r3++;
}
}
else
{
if(h<130)
{
if(c2[r2]<c3[r3])
{
r2++;
}
if(c2[r2]>c3[r3])
{
r3++;
}
}
else
r3++;
}
}
if(r3<r2||r3<r1)count++;
}
////////////////////////////////////
ct[i1]=((double)(300-count))/300;
rt[i1]=((double)(0))/300;
et[i1]=((double)(count))/300;
double runtime;
QueryPerformanceCounter(&litmp);//获得终止值
qt2=litmp.QuadPart;
runtime=(double)(qt2-qt1)/dff;
tt[i1]=runtime;
CString tmp;
tmp.Format("%d",zt[i1]);
m_l.SetItemText (i1, 0, tmp);
tmp.Format("%3.4f",ct[i1]);
m_l.SetItemText (i1, 1, tmp);
tmp.Format("%3.4f",rt[i1]);
m_l.SetItemText (i1, 2, tmp);
tmp.Format("%3.5f",runtime);
m_l.SetItemText (i1, 4, tmp);
tmp.Format("%3.4f",et[i1]);
m_l.SetItemText (i1, 3, tmp);
if(i1%2!=0)
{
m_l.flag[i1]=true;
}
}///////////////for
}//if
if(m_b3.down)
{
for(int i1=0;i1<20;i1++)
{
int x,y;
LARGE_INTEGER litmp;
LONGLONG qt1,qt2;
double dff;
QueryPerformanceFrequency(&litmp);//获得时钟频率
dff=(double)litmp.QuadPart;
QueryPerformanceCounter(&litmp);//获得初始值
qt1=litmp.QuadPart;
int r=300-10*i1;
zt[i1]=r;
int i=0;
srand( (unsigned)time( NULL ) );
i=0;
while(i<130)
{
x=(int)(rand()%200);
y=(int)(rand()%200);
BOOL flag=false;
if((x-100)*(x-100)+(y-100)*(y-100)<10000)
{
for(int j=0;j<i;j++)
{
if(*(towp+2*j)==x&&*(towp+2*j+1)==y)
{
flag=true;
j=i;
}
}
if(!flag)
{
*(towp+2*i)=x;
*(towp+2*i+1)=y;i++;
}
}
}
///////////////////////////////
i=0;
while(i<150)
{
x=(int)(rand()%200)+int((r/2)*1.732);
y=(int)(rand()%200);
BOOL flag=false;
if((x-100-int((r/2)*1.732))*(x-100-int((r/2)*1.732))+(y-100)*(y-100)<10000)
{
for(int j=0;j<i;j++)
{
if(*(threep+2*j)==x&&*(threep+2*j+1)==y)
{
flag=true;
j=i;
}
}
if(!flag)
{
*(threep+2*i)=x;
*(threep+2*i+1)=y; i++;
}
}
}
////////////////////////////////////////////////////////////
i=0;
/////////////////////////////////////////////
i=100;
while(i<200)
{
x=(int)(rand()%200);
y=(int)(rand()%200);
BOOL flag=false;
if((x-100)*(x-100)+(y-100)*(y-100)<10000)
{
for(int j=100;j<i;j++)
{
if(*(test+2*j)==x&&*(test+2*j+1)==y)
{
flag=true;
j=i;
}
}
if(!flag)
{
*(test+2*i)=x;
*(test+2*i+1)=y; i++;
}
}
}
/////////////////////////////////////////
i=200;
while(i<300)
{
x=(int)(rand()%200)+int((r/2)*1.732);
y=(int)(rand()%200);
BOOL flag=false;
if((x-100-int((r/2)*1.732))*(x-100-int((r/2)*1.732))+(y-100)*(y-100)<10000)
{
for(int j=200;j<i;j++)
{
if(*(test+2*j)==x&&*(test+2*j+1)==y)
{
flag=true;
j=i;
}
}
if(!flag)
{
*(test+2*i)=x;
*(test+2*i+1)=y;i++;
}
}
}
///////////////////////////////////////just
int k=83;
int k1=51;
//////////////////////////////////////////////////////
int count1=0,count2=0,count3=0,rjcount1=0,rjcount2=0,rjcount3=3;
////////////////////////////////////
/////////////////////////////////
for(i=100;i<200;i++)
{
int l;
int c1[120];
int c2[130];
int c3[150];
int j=0;
for(j=0;j<130;j++)
{
int x1,x2,y1,y2;
x1=*(towp+2*j);y1=*(towp+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c2+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=129;j>l;j--)
{
if(c2[j]<c2[j-1])
{
int temp=c2[j-1];
c2[j-1]=c2[j];
c2[j]=temp;
}
}
}
for(j=0;j<150;j++)
{
int x1,x2,y1,y2;
x1=*(threep+2*j);y1=*(threep+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c3+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=149;j>l;j--)
{
if(c3[j]<c3[j-1])
{
int temp=c3[j-1];
c3[j-1]=c3[j];
c3[j]=temp;
}
}
}
int r1=0,r2=0,r3=0;int h;
r1=0;r2=0;r3=0;
for( h=0;h<k;h++)
{
if(h<130)
{
if(c2[r2]<c3[r3])
{
r2++;
}
if(c3[r3]<c2[r2])
{
r3++;
}
}
else
r3++;
}
if(r2<k1&&r3<k1)rjcount3++;
if(r3>=k1)count3++;
}
/////////////////////////////////
int tt5=0;
for(i=200;i<300;i++)
{
int l;
int c1[120];
int c2[130];
int c3[150];
int j=0;
for(j=0;j<130;j++)
{
int x1,x2,y1,y2;
x1=*(towp+2*j);y1=*(towp+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c2+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=129;j>l;j--)
{
if(c2[j]<c2[j-1])
{
int temp=c2[j-1];
c2[j-1]=c2[j];
c2[j]=temp;
}
}
}
for(j=0;j<150;j++)
{
int x1,x2,y1,y2;
x1=*(threep+2*j);y1=*(threep+2*j+1);x2=*(test+2*i);y2=*(test+2*i+1);
*(c3+j)=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
for(l=0;l<k;l++)
{
for(j=149;j>l;j--)
{
if(c3[j]<c3[j-1])
{
int temp=c3[j-1];
c3[j-1]=c3[j];
c3[j]=temp;
}
}
}
int r1=0,r2=0,r3=0;int h;
for(h=0;h<k;h++)
{
if(c2[r2]<c3[r3])
{
r2++;
}
if(c3[r3]<c2[r2])
{
r3++;
}
}
if(r2<k1&&r3<k1)rjcount3++;
if(r2>=k1)count3++;
}
////////////////////////////////
ct[i1]=((double)(200-count3-rjcount3))/200;
rt[i1]=((double)(rjcount3))/200;
et[i1]=((double)(count3))/200;
double runtime;
QueryPerformanceCounter(&litmp);//获得终止值
qt2=litmp.QuadPart;
runtime=(double)(qt2-qt1)/dff;
tt[i1]=runtime;
CString tmp;
tmp.Format("%d",zt[i1]);
m_l.SetItemText (i1, 0, tmp);
tmp.Format("%3.4f",ct[i1]);
m_l.SetItemText (i1, 1, tmp);
tmp.Format("%3.4f",rt[i1]);
m_l.SetItemText (i1, 2, tmp);
tmp.Format("%3.5f",runtime);
m_l.SetItemText (i1, 4, tmp);
tmp.Format("%3.4f",et[i1]);
m_l.SetItemText (i1, 3, tmp);
if(i1%2!=0)
{
m_l.flag[i1]=true;
}
}//////for
}//////if
m_b4.flagv=false;GetDlgItem(IDC_BUTTON4)->EnableWindow(true);
m_b5.flagv=false;GetDlgItem(IDC_BUTTON5)->EnableWindow(true);
m_b6.flagv=false;GetDlgItem(IDC_BUTTON6)->EnableWindow(true);
m_b7.flagv=false;GetDlgItem(IDC_BUTTON7)->EnableWindow(true);
/////////////////////////////////////////
}
void CDialog34::OnButton4()
{
// TODO: Add your control notification handler code here
if(f4)return;
f4=true;f5=false;f6=false;f7=false;
strcpy(m_1.mychar,"圆心间距离与正确率关系曲线");
m_b4.down=false;
CRect rectldj;
GetDlgItem(IDC_STATIC2)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
GetDlgItem(IDC_STATIC3)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
}
void CDialog34::OnButton5()
{
// TODO: Add your control notification handler code here
if(f5)return;
f5=true;f4=false;f6=false;f7=false;
strcpy(m_1.mychar,"圆心间距离与错误率关系曲线");
m_b5.down=false;
CRect rectldj;
GetDlgItem(IDC_STATIC2)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
GetDlgItem(IDC_STATIC3)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
}
void CDialog34::OnButton6()
{
// TODO: Add your control notification handler code here
if(f6)return;
f6=true;f5=false;f4=false;f7=false;
strcpy(m_1.mychar,"圆心间距离与拒判率关系曲线");
m_b6.down=false;
CRect rectldj;
GetDlgItem(IDC_STATIC2)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
GetDlgItem(IDC_STATIC3)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
}
void CDialog34::OnButton7()
{
// TODO: Add your control notification handler code here
if(f7)return;
f7=true;f5=false;f6=false;f4=false;
strcpy(m_1.mychar,"圆心间距离与拒判率关系曲线");
m_b7.down=false;
CRect rectldj;
GetDlgItem(IDC_STATIC2)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
GetDlgItem(IDC_STATIC3)->GetWindowRect(rectldj);ScreenToClient(rectldj);
InvalidateRect(rectldj,true);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -