point.x && a[i+1].x<=" /> point.x && a[i+1].x<=" />

全文预览

南师 地理信息系统考研 专业一试题2003-2011

上传者:似水流年 |  格式:doc  |  页数:81 |  大小:0KB

文档介绍
和终点的坐标相同 a[N].y = a[0].y; 10 while(flag!='n' && flag !='N') { printf("Now, please input the Point's coordinate:"); scanf("%f,%f",&point.x,&point.y); for(i=0;i<N;i++) { if((a[i].x>point.x && a[i+1].x<=point.x)||(a[i].x<point.x && a[i+1].x>=point.x)) { x1= a[i].x; y1= a[i].y; x2= a[i+1].x; y2= a[i+1].y; x0= point.x; y0= (y1-y2)*(x0-x1)/(x1-x2) + y1; if(y0==point.y) { up =1; down = 1; left = 1; right = 1; break; } else if(y0>point.y) up= 1; else down = 1; }//if if((a[i].y>point.y && a[i+1].y<=point.y)||(a[i].y<point.y && a[i+1].y>=point.y)) { x1= a[i].x; y1= a[i].y; x2= a[i+1].x; y2= a[i+1].y; y0= point.y; x0= (x1-x2)*(y0-y1)/(y1-y2) + x1; if(x0==point.x) { up =1; down = 1; left = 1; right = 1; break; } else if(x0>point.y) right = 1; else left = 1; }//if }//for if(up && down && left && right)

收藏

分享

举报
下载此文档