subroutine crosscalc2(i,j1,j2,mpts,iseq, x jxarray,jyarray,ncross,mcross) c parep2:$MDOCS/cl4_check/crosscalc2.sub 9/19/96 c from seedis:sy$seedis:[seedis.map_routines]crosscalc2.sub c look for overlap of two DIFFERENT subpolygons j1 and j2 c of a single polygon i with causeways c j1 or j2 are subpolygons of a polygon with causeways c ncross and mcross are augmented by 1 when intersections are found c jxarray,jyarray are coordinates keyed to ORIGINAL polygon c mcross stores sequence numbers from ORIGINAL polygon c as stored in iseq c 9/16/95 c ncross = no of illegal crossings in this polygon c mcross(1..900) = no of illegal crossings of this segment c sequence number of polygon integer i c position of first subpolygon integer j1 c position of second subpolygon integer j2 c no of pts in subpolygons = mpts(j1) and mpts(j2) integer mpts(11) c position in the original polygon, of the points in subpolygons c = iseq(1,j1) and iseq(1,j2) integer iseq(900,11) c point array for all polygons integer jxarray(2200,900), jyarray(2200,900) c total number of illegal crossings in this polygon integer ncross c number of illegal crossings for each segment of this polygon integer mcross(900) c internal variables c point arrays for one polygon integer jx(900),jy(900) integer jx2(900),jy2(900) c logical unit for debug output iotmsg = 6 c loop over segments of first subpolygon do 1722 kk=1,mpts(j1) c position in original polygon ii=iseq(kk,j1) c kk plus one kkp1=kk+1 if (kk.eq.mpts(j1)) kkp1=1 iip1 = iseq(kkp1,j1) jx(ii)=jxarray(i,ii) jy(ii)=jyarray(i,ii) jx(iip1)=jxarray(i,iip1) jy(iip1)=jyarray(i,iip1) c loop over segments of second subpolygon do 1724 mm=1,mpts(j2) c position in original polygon jj=iseq(mm,j2) c mm plus one mmp1 = mm+1 if (mm.eq.mpts(j2)) mmp1=1 jjp1=iseq(mmp1,j2) jx2(jj)=jxarray(i,jj) jy2(jj)=jyarray(i,jj) jx2(jjp1)=jxarray(i,jjp1) jy2(jjp1)=jyarray(i,jjp1) c coords of two segments xa=jx(ii) ya=jy(ii) xb=jx2(jj) yb=jy2(jj) xc=jx2(jjp1) yc=jy2(jjp1) xd=jx(iip1) yd=jy(iip1) call xsect(xa,ya,xb,yb,xc,yc,xd,yd,xi,yi,f1,f2,iotmsg) if (0.lt.f1.and.f1.lt.1.and.0.lt.f2.and.f2.lt.1) then c count an intersection for both segments mcross(iip1) = mcross(iip1)+1 mcross(jjp1) = mcross(jjp1)+1 ncross = ncross+1 endif c end of point loop mm (or jj) 1724 continue c end of point loop kk (or ii) 1722 continue return end