DECLARE SUB project (w#, l#) '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'Produces an IntelliCAD script file representing each star as a 'donut with zero internal radius, plotted on a stereographic equatorial 'projection. Expects to find a file 'called yale65.txt with star coordinates in the same directory. ' 'comment out the declarations below to use in FirstBasic CLS DEFDBL A-Z INPUT "filename : ", dxfname$ OPEN "o", 1, dxfname$ + ".scr" 'CALL init(dxfname$) '========== put your basic program below,============= '========== using the dfx subroutines. ============= 'define some constants pi = 4 * ATN(1) rads = pi / 180 degs = 180 / pi ramin = -2.5 ramax = 2.5 decmin = -30 decmax = 60 unitr = 100000# 'radius of unit circle Ox = 0# * unitr 'centre of construction in centre of box Oy = 0# * unitr minlong = -37.5 * rads 'most westerly longitude maxlong = 37.5 * rads 'easterly longitude minlat = -30 * rads 'southern lat maxlat = 60 * rads 'northern lat w = 0 l = 0 'Load all 9096 stars from the yale bright star catalog 'omitting the nebula - basic does not like tabs in the file 'so replace tabs with spaces A$ = "YALE65" OPEN A$ + ".TXT" FOR INPUT AS #2 FOR i = 1 TO 9096 INPUT #2, r, d, m 'sort the RA and dec coordinates for current segment 'get ra as w first rahrs = INT(r / 10000) ramins = INT((r - rahrs * 10000) / 100) rasecs = (r - rahrs * 10000 - ramins * 100) radec = (rahrs + ramins / 60 + rasecs / 3600) 'kludge for 'round the back' ra IF radec > 21 THEN radec = radec - 24 'stars plotted around base meridian w = (radec - (ramax + ramin) / 2) w = w * 15 * rads 'now sort the dec decname = SGN(d) d = ABS(d) dhrs = INT(d / 10000) dmins = INT((d - dhrs * 10000) / 100) dsecs = (d - dhrs * 10000 - dmins * 100) ddec = decname * (dhrs + dmins / 60 + dsecs / 3600) l = ddec * rads IF (w > minlong) AND (w < maxlong) AND (l > minlat) AND (l < maxlat) THEN CALL project(w, l) 'PRINT w, l IF INT(m) = 7 THEN magn = .5 IF INT(m) = 6 THEN magn = .75 IF INT(m) = 5 THEN magn = 1! IF INT(m) = 4 THEN magn = 1.5 IF INT(m) = 3 THEN magn = 2 IF INT(m) = 2 THEN magn = 3 IF INT(m) = 1 THEN magn = 4 IF INT(m) = 0 THEN magn = 6 IF INT(m) = -1 THEN magn = 8 IF INT(m) = -2 THEN magn = 10 PRINT #1, "donut" 'donut command PRINT #1, USING "##.#######"; 0 PRINT #1, USING "##.#######"; .002 * unitr * magn PRINT #1, USING "######.#######\ \######.#######"; -w * unitr; ","; l * unitr PRINT #1, "" 'blank line to finish command END IF NEXT i CLOSE #2 PRINT #1, "_STOPSCRIPT" CLOSE #1 PRINT "done" END '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUB project (w, l) ' this subroutine takes the latitude and longitude of a point ' on the celestial sphere in radians and returns the ' coordinates of the ' projection of the point in the projection plane. Note pass ' by value here, the subroutine modifies the values in w, l x = COS(l) * SIN(w) y = SIN(l) z = COS(l) * COS(w) x1 = x / (1 + z) y1 = y / (1 + z) w = x1 l = y1 END SUB