* * $Id: igpkfa.F,v 1.1.1.1 1996/02/14 13:10:37 mclareni Exp $ * * $Log: igpkfa.F,v $ * Revision 1.1.1.1 1996/02/14 13:10:37 mclareni * Higz * * #include "higz/pilot.h" *CMZ : 1.14/09 25/05/92 10.38.31 by O.Couet *-- Author : O.Couet FUNCTION IGPKFA(XCUR,YCUR,N,XP,YP) *.===========> *. *. This function decides if a given fill area is picked or not . *. If picked IGPKFA=1 *. If not picked IGPKFA=0 *. *. _Input parameters: *. *. REAL XCUR : X coordinate of the cursor *. REAL YCUR : Y coordinate of the cursor *. INTEGER N : Number of point in the fill area *. REAL XP(N) YP(N) : Fill area coordinates *. *..==========> (O.Couet) #include "higz/higraf.inc" DIMENSION XP(*),YP(*) *.______________________________________ * IGPKFA=0 NBI=0 * DO 10 I=2,N+1 I2=I I1=I-1 IF(I.EQ.N+1)I2=1 * * Line segment parallel to oy * IF(XP(I1).EQ.XP(I2))THEN IF(YP(I1).LT.YP(I2))THEN YI=YP(I1) YIP=YP(I2) ELSE YI=YP(I2) YIP=YP(I1) ENDIF IF((YI.LT.YCUR).AND.(YCUR.LT.YIP))THEN NBI=NBI+1 IF(NBI.GT.NPMAX)GOTO 70 XGRAF(NBI)=XP(I1) ENDIF GOTO 10 ENDIF * * Line segment parallel to ox * IF(YP(I1).EQ.YP(I2))THEN IF(YP(I1).EQ.YCUR)THEN NBI=NBI+1 IF(NBI.GT.NPMAX)GOTO 70 XGRAF(NBI)=XP(I1) NBI=NBI+1 IF(NBI.GT.NPMAX)GOTO 70 XGRAF(NBI)=XP(I2) ENDIF GOTO 10 ENDIF * * Other line segment * A=(YP(I1)-YP(I2))/(XP(I1)-XP(I2)) B=(YP(I2)*XP(I1)-XP(I2)*YP(I1))/(XP(I1)-XP(I2)) IF(XP(I1).LT.XP(I2))THEN XI=XP(I1) XIP=XP(I2) ELSE XI=XP(I2) XIP=XP(I1) ENDIF XIN=(YCUR-B)/A IF((XI.LT.XIN).AND.(XIN.LT.XIP))THEN NBI=NBI+1 IF(NBI.GT.NPMAX)GOTO 70 XGRAF(NBI)=XIN ENDIF 10 CONTINUE * * Sorting of the x coordinates intersections * INV=0 M=NBI-1 20 CONTINUE DO 30 I=1,M IF(XGRAF(I+1).LT.XGRAF(I))THEN INV=INV+1 RLL=XGRAF(I) XGRAF(I)=XGRAF(I+1) XGRAF(I+1)=RLL ENDIF 30 CONTINUE M=M-1 IF(INV.EQ.0)GOTO 40 INV=0 GOTO 20 * * Place of the x cursor coordinates * 40 NB=0 DO 50 I=1,NBI IF(XCUR.LT.XGRAF(I))GOTO 60 NB=NB+1 50 CONTINUE 60 IF(MOD(NB,2).NE.0)THEN IGPKFA=1 ENDIF GOTO 999 * 70 CALL IGERR('Too many points','IGPKFA') * 999 END