1*----------------------------------------------------------------------- 2* Copyright (C) 2000-2004 GFD Dennou Club. All rights reserved. 3*----------------------------------------------------------------------- 4 SUBROUTINE SZSGCL(TX0, TY0, TX1, TY1) 5 6 PARAMETER (EPSIL = 1.E-5) 7 8 LOGICAL LMER, LREQA 9 10 EXTERNAL RFPI, LREQA 11 12 SAVE 13 14 15 PI = RFPI() 16 17 TXX = TX0 18 TYY = TY0 19 20 IF(LREQA(ABS(TY0), PI/2, EPSIL) .OR. 21 + LREQA(ABS(TY1), PI/2, EPSIL)) THEN 22 LMER = .TRUE. 23 ELSE 24 TAN0 = TAN(TY0) 25 TAN1 = TAN(TY1) 26 27 IF (TAN0.EQ.0 .AND. TAN1.EQ.0) THEN 28 XLA = 0 29 ELSE 30 XLA = ATAN2(TAN1*COS(TX0)-TAN0*COS(TX1), 31 + TAN0*SIN(TX1)-TAN1*SIN(TX0)) 32 END IF 33 34 DX1 = SZXMOD(TX1-TX0) 35 XLM = SZXMOD(TX0+DX1/2 - XLA) 36 37 CS0 = COS(TX0-XLA) 38 CS1 = COS(TX1-XLA) 39 40 IF (ABS(CS0).GE.ABS(CS1)) THEN 41 ALPHA = TAN0/CS0 42 LMER = .FALSE. 43 ELSE IF (ABS(CS1).NE.0) THEN 44 ALPHA = TAN1/CS1 45 LMER = .FALSE. 46 ELSE 47 LMER = .TRUE. 48 END IF 49 END IF 50 51 IF(LMER) THEN 52 TYY = SIGN(PI/2, (TY0+TY1)) 53 END IF 54 55 RETURN 56*----------------------------------------------------------------------- 57 ENTRY SZQGCY(TX, TY) 58 59 IF (LMER) THEN 60 TY = TYY 61 ELSE 62 TY = ATAN(ALPHA*COS(TX-XLA)) 63 END IF 64 65 RETURN 66*----------------------------------------------------------------------- 67 ENTRY SZQGCX(TY, TX) 68 69 IF (LMER) THEN 70 TX = TXX 71 ELSE 72 IF(ALPHA.EQ.0) THEN 73 TX = TXX 74 ELSE 75 TT = TAN(TY)/ALPHA 76 IF (ABS(TT).GE.1) THEN 77 TX = SIGN(PI, XLM) + XLA 78 ELSE 79 TX = SIGN(ACOS(TT), XLM) + XLA 80 END IF 81 END IF 82 END IF 83 84 RETURN 85 END 86