REM h8abbc.bas - jackord@kw.igs.net - 3 Nov 07 - BBC Basic v5.50b REM distant sphere moving perpendicular to the viewing direction REM at relativistic speeds REM the co-ord system has x positive to the right, y positive downward, REM and z positive going away from you REM the sphere is transparent with gridlines in blue on the near REM hemisphere (z<=0), and in red on the far hemisphere (z>0) *FLOAT64 INSTALL @lib$+"WINLIB5" REM Initialize Window b1% = FN_button("Plot", 90, 5, 50, 20, FN_setproc(PROCp1), 0) c1% = FN_combobox("", 5, 5, 80, 100, 0, 3) WindowWidth=360 WindowHeight=280 VDU 23,22,WindowWidth;WindowHeight;8,15,16,128 SYS "SetWindowText", @hwnd%, "Relativistic Sphere" SYS "SendMessage", c1%, &143, 0, "v/c=0.0" SYS "SendMessage", c1%, &143, 1, "v/c=0.2" SYS "SendMessage", c1%, &143, 1, "v/c=0.4" SYS "SendMessage", c1%, &143, 1, "v/c=0.6" SYS "SendMessage", c1%, &143, 1, "v/c=0.8" SYS "SendMessage", c1%, &14E, 0, 0 n=120: r=90: xo=360: yo=300 OFF: VDU 5 REPEAT WAIT 1 UNTIL FALSE QUIT DEF PROCp1 SYS "SendMessage", c1%, &147, 0, 0 TO ch1% : REM Get velocity be=.2*ch1%: ga=1/SQR(1-be*be) : REM Beta and Gamma CLS: GCOL 0: MOVE 40, 80 PRINT "Sphere Moving to the Right at v/c="; be FOR i=1 TO 17 : REM Latitude grid th=10*i*PI/180: rr=r*SIN(th) x=r*COS(th): y=rr: z=0 xp=x/ga-be*z : REM Find x co-ord x1=xo+INT(2*xp): y1=yo-INT(2*y) GCOL 9: MOVE x1, y1 FOR j=1 TO n IF j=n/2 THEN GCOL 12 ph=3*j*PI/180 y=rr*COS(ph): z=rr*SIN(ph) xp=x/ga-be*z : REM Find x co-ord x2=xo+INT(2*xp): y2=yo-INT(2*y) DRAW x2, y2 NEXT j NEXT i GCOL 9 FOR i=1 TO 36 : REM Longitude grid IF i=18 THEN GCOL 12 ph=10*i*PI/180 x=-r: y=0: z=0 xp=x/ga-be*z : REM Find x co-ord x1=xo+INT(2*xp): y1=yo-INT(2*y) MOVE x1, y1 FOR j=1 TO n/2 th=3*j*PI/180 x=-r*COS(th): y=r*SIN(th)*COS(ph): z=r*SIN(th)*SIN(ph) xp=x/ga-be*z : REM Find x co-ord x2=xo+INT(2*xp): y2=yo-INT(2*y) DRAW x2, y2 NEXT j NEXT i ENDPROC