📄 parallel.cc
字号:
{
Flag[h][l] = 0;
}
//individual_vector[i][0] =0;
//individual_vector[i][1] =0;
//int step_x = individual_vector[i][0];
//int step_y = individual_vector[i][1];
int k = 1;
int field = 452;
while(k<=num)
{
for( int j = 0; j < 256; j++ )
{
for( int m = 0; m <128; m++ )
{
if( (Region_Flag[j][m] == 1)&&( k <= num ) )
{
p.x = j;
p.y = m;
//AK = CalAk(p);
//if(AK >= field)
int AK = SingleSpotArea[j][m];
if((AK >= field)&&(Flag[j][m]!=1))
{
individual_vector[i][2*k-2] =j;
individual_vector[i][2*k-1] =m;
Fill(p);
k++;
}
}
}
}
field = field - 3*(i+1);
}
}
}
void Fill(CPoint pt)
{
float dlta = pi/36;
float dltas=0,alfa,r=0;
double S=0;
int len,wide,x,y,maxx=0,minx=260,maxy=0,miny=130;
int **polygon;
bool flag;
polygon = new int*[73];
for(int m=0;m<73;m++)
polygon[m] = new int[2];
polygon[0][0] = 73;
polygon[0][1] = 0;
Shade(pt);
MaxHDis(pt);//已全部换算到256*128分辨率下
AdjustDis(pt);
/* /////////////////////////
FILE *fp;
fp=fopen("f:/lastdata/mresult.txt","w");
fprintf(fp,"%d%c%d\n",pt.x,' ',pt.y);
for(int h=0;h<72;h++)
{
fprintf(fp,"%f\n",m_maxdis[h]);
}
fclose(fp);
//////////////////////////////////*/
for(int i=1;i<73;i++)
{
alfa = (float)(i-1)*dlta;
polygon[i][0] = (int)(pt.x + m_maxdis[i-1]*cos(alfa));
if(maxx<polygon[i][0])
maxx = polygon[i][0];
if(minx>polygon[i][0])
minx = polygon[i][0];
polygon[i][1] = (int)(pt.y + m_maxdis[i-1]*sin(alfa));
if(maxy<polygon[i][1])
maxy = polygon[i][1];
if(miny>polygon[i][1])
miny = polygon[i][1];
}
len = maxx - minx;
wide = maxy - miny;
for(int l=0;l<len;l++)
for(int k=0;k<wide;k++)
{
x = minx + l;
y = miny + k;
//CPoint mpt(x,y);
//flag1 = IsPointInBoundary(mpt);
//if(Region_Flag[x][y]) //这里如果不判断点是否在陆地上,则可以覆盖海面上的点了
//if(flag1==TRUE)
// {
flag = IsPointInPolygon(x,y,polygon,73);
if(flag)
{
if(Flag[x][y]!=1)
Flag[x][y] = 1;
}
// }
}
for(int n=0;n<73;n++)
delete[] polygon[n];
delete[] polygon;
}
float randf()
{
return (float)(rand()/(float)RAND_MAX);
}
void FindTheSource()
{
switch(hehe)
{
case 10:
switch(num)
{
case 16:
source = "1.0/16.txt";
break;
case 17:
source = "1.0/17.txt";
break;
case 18:
source = "1.0/18.txt";
break;
case 19:
source = "1.0/19.txt";
break;
case 20:
source = "1.0/20.txt";
break;
case 21:
source = "1.0/21.txt";
break;
case 22:
source = "1.0/22.txt";
break;
case 23:
source = "1.0/23.txt";
break;
case 24:
source = "1.0/24.txt";
break;
case 25:
source = "1.0/25.txt";
break;
case 26:
source = "1.0/26.txt";
break;
case 27:
source = "1.0/27.txt";
break;
}
break;
case 9:
switch(num)
{
case 16:
source = "0.9/16.txt";
break;
case 17:
source = "0.9/17.txt";
break;
case 18:
source = "0.9/18.txt";
break;
case 19:
source = "0.9/19.txt";
break;
case 20:
source = "0.9/20.txt";
break;
case 21:
source = "0.9/21.txt";
break;
case 22:
source = "0.9/22.txt";
break;
case 23:
source = "0.9/23.txt";
break;
case 24:
source = "0.9/24.txt";
break;
case 25:
source = "0.9/25.txt";
break;
case 26:
source = "0.9/26.txt";
break;
case 27:
source = "0.9/27.txt";
break;
}
break;
case 8:
switch(num)
{
case 16:
source = "0.8/16.txt";
break;
case 17:
source = "0.8/17.txt";
break;
case 18:
source = "0.8/18.txt";
break;
case 19:
source = "0.8/19.txt";
break;
case 20:
source = "0.8/20.txt";
break;
case 21:
source = "0.8/21.txt";
break;
case 22:
source = "0.8/22.txt";
break;
case 23:
source = "0.8/23.txt";
break;
case 24:
source = "0.8/24.txt";
break;
case 25:
source = "0.8/25.txt";
break;
case 26:
source = "0.8/26.txt";
break;
case 27:
source = "0.8/27.txt";
break;
}
break;
case 7:
switch(num)
{
case 16:
source = "0.7/16.txt";
break;
case 17:
source = "0.7/17.txt";
break;
case 18:
source = "0.7/18.txt";
break;
case 19:
source = "0.7/19.txt";
break;
case 20:
source = "0.7/20.txt";
break;
case 21:
source = "0.7/21.txt";
break;
case 22:
source = "0.7/22.txt";
break;
case 23:
source = "0.7/23.txt";
break;
case 24:
source = "0.7/24.txt";
break;
case 25:
source = "0.7/25.txt";
break;
case 26:
source = "0.7/26.txt";
break;
case 27:
source = "0.7/27.txt";
break;
}
break;
case 6:
switch(num)
{
case 16:
source = "0.6/16.txt";
break;
case 17:
source = "0.6/17.txt";
break;
case 18:
source = "0.6/18.txt";
break;
case 19:
source = "0.6/19.txt";
break;
case 20:
source = "0.6/20.txt";
break;
case 21:
source = "0.6/21.txt";
break;
case 22:
source = "0.6/22.txt";
break;
case 23:
source = "0.6/23.txt";
break;
case 24:
source = "0.6/24.txt";
break;
case 25:
source = "0.6/25.txt";
break;
case 26:
source = "0.6/26.txt";
break;
case 27:
source = "0.6/27.txt";
break;
}
break;
case 5:
switch(num)
{
case 16:
source = "0.5/16.txt";
break;
case 17:
source = "0.5/17.txt";
break;
case 18:
source = "0.5/18.txt";
break;
case 19:
source = "0.5/19.txt";
break;
case 20:
source = "0.5/20.txt";
break;
case 21:
source = "0.5/21.txt";
break;
case 22:
source = "0.5/22.txt";
break;
case 23:
source = "0.5/23.txt";
break;
case 24:
source = "0.5/24.txt";
break;
case 25:
source = "0.5/25.txt";
break;
case 26:
source = "0.5/26.txt";
break;
case 27:
source = "0.5/27.txt";
break;
}
break;
case 4:
switch(num)
{
case 16:
source = "0.4/16.txt";
br
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -