Calculating the intersections of two circles on a sphere



Calculating the intersections of two circles on a sphere. George Huxtable.

Here are details about my programmable-calculator program to derive the lat and long for each crossing of two circles. It is implemented on a Casio programmable pocket calculator, FX730P or FX795P, dating from the 1980s. It could easily be adapted to run on other machines.

The trig routines are preset to operate in degrees. The version of bastard-Basic that's used has just 26 possible variables, denoted by the letters A to Z. The program lines are numbered. Internally, it calculates in bcd (binary coded decimal) , a decimal digit at a time, rather than in true binary, and works to a precision of 12 decimal places.

For many functions, there is no requirement to enclose the atgument in brackets, so for example, ACSU is the arc-cosine of variable U. A subroutine specified by GOSUB does no more than specify an order of executing insructions, all variables being effectively Global.

Declinations and latitudes are taken to be positive-North. Both GHAs and longitudes are treated as increasing Westerly from Greenwich, 0 to 360 degrees, though if preferred the final displayed long, for values > 180, could be converted to E.

The program starts at line 20 with a block which reads in, via the keyboard, the following quantities, in decimal degrees-

dec1 into B,

GHA1 into C,

alt1 into D,

dec2 into E,

GHA2 into F,

alt2 into G.

then as follows, from line 80-

80 H=SIND*COSF/COSB-SING*COSC/COSE

90 I= TANE*COSC-TANB*COSF

100 J=COSF*SINC-COSC*SINF

110 K=SIND*SINF/COSB-SING*SINC/COSE

120 L=TANE*SINC-TANB*SINF

130 M= -H*I -K*L

140 N= (H*I+K*L)*(H*I+K*L)-(I*I+L*L+J*J)*(H*H+K*K-J*J) Discriminant of quadratic in (sin lat).

145 IF N1;GOTO330 Northmost solution for sin lat1 on first pass.

165 P=ASNP:W=1:GOSUB 180 This is lat1; go to block at 180 to find long1.

170 P=(M-SQRN)/O:IF ABS(P)>1;GOTO 330 Southmost solution for sin lat2 on second pass.

175 P=ASNP:W=-1:GOSUB180 With lat2; to block at 180 again, for long2.

177 GOTO 20 All done and back to starting point.

180 S=SIND/(COSP*COSB)-TANB*TANP:IF ABS(S)>1;GOTO 320 Start of block to find long.

185 R=360*FRAC(1+(C+W*ACSS)/360) 2 alternative longs for circle 1.W switches scan

195 S=360*FRAC(1+(C-W*ACSS)/360) order on 2nd pass.

200 U=SING/(COSP*COSE)-TANE*TANP:IF ABS(U)>1;GOTO 320

205 T=360*FRAC(1+(F+W*ACSU)/360) 2 alternative longs for circle 2.

215 U=360*FRAC(1+(F-W*ACSU)/360)

230 IF ABS(ABS(R-T)-180)>179.9999;V=R:GOTO 280 These four lines look at longs of each pair of

240 IF ABS(ABS(R-U)-180)>179.9999;V=R:GOTO 280 candidate intersections with the lat. parallel to

250 IF ABS(ABS(S-T)-180)>179.9999;V=S:GOTO 280 test which pairs are nearly the same or (just

260 IF ABS(ABS(S-U)-180)>179.9999;V=S:GOTO 280 perhaps) nearly 360 different.

270 PRINT "LONG ERROR";GOTO 20

280IF P ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download