Category : Science and Education
Archive   : PLANETS.ZIP
Filename : PLANETS1.PAS

 
Output of file : PLANETS1.PAS contained in archive : PLANETS.ZIP
CONST
DegreesInRadian = 57.295779513;
PiDividedByTwo = 1.570796327;
D = 6; {Decinal places in real printouts}
Num_of_major_planets = 9;
Num_of_minor_planets = 6;
Num_of_planets = 15;
CenterX : integer = 300;
CenterY : integer = 92;
Scale_for_inner_planets = 130;
Scale_for_middle_planets = 40;
Scale_for_outer_planets = 4;

Display_Degrees_in_decimal : Boolean = False;
Daylight_Savings_Correction_Enabled : Boolean = True;
Display_Hour_Angle_in_Degrees : Boolean = False;
Display_RA_in_Degrees : Boolean = False;
Display_Names_on_Plots : Boolean = False;
Zone_correction : Integer = 6;
Longitude : Real = 88.3;
Latitude : Real = 43.1;
Zero : Real = 0;
Screen_Aspect : Real = 2.7;
MenuNumber : Integer = 1;
NumberOfMenus : Integer = 3;
MenuOnScreen : Boolean = True;
ColorMonitor : Boolean = False;
StopTime = 8;
TimeSpeed : Integer = StopTime;
SlowestTime = 2;
FastestTime = 14;
TravelMode : Boolean = False;
Sun_ecliptic_longitude_at_epoch = 278.83354;
Sun_ecliptic_longitude_of_perigee = 282.596403;
Sun_Ecc = 0.016718;
Sun_Epoch = 1980;
Sun_Angular_Diameter = 0.533128;
Moon_mean_longitude_at_epoch = 64.975464;
Moon_longitude_of_perigee_at_epoch = 349.383063;
Moon_longitude_of_node_at_epoch = 151.950429;
Moon_Inc = 5.145396;
Moon_Ecc = 0.0549;
Moon_Angular_Diameter = 0.5181;
Moon_Axis = 384401.0;
Moon_Epoch = 0;

SkyWindowColor : Integer = 1;
PlanetColor : Integer = 1;

TYPE
MSDOS_REGISTERS =
RECORD
AX, BX, CX, DX, BP, SI, DI, DS, ES, FLAGS : word;
END;

Star =
RECORD
c : STRING[3];
l : STRING[3];
n : STRING[9];
r : integer;
d : integer;
END;

VAR
GraphDriver : integer;
GraphMode : integer;
ErrorCode : integer;
SaveSetUpFile : Text;
OrbitFile : Text;
ExitLoop, ok, overwriting : Boolean;
MSDOS_time : MSDOS_REGISTERS;
ch, ch1, LastCommand : Char;
num, PlanetSelected, MinorPlanetSelected : Integer;
start_moon_selected, last_moon_selected : Integer;
day, month, year, day_of_year : Integer;
earth_day : real;
JD : Real;
S1,S2,S3,numstring : string;

planet_long_of_ascend_node : Real;
planet_mean_anomaly : Real;
planet_heliocentric_long : Real;
planet_true_anomaly : Real;
planet_radius_vector : Real;
planet_helio_ecliptic_lat : Real;

earth_long_of_ascend_node : Real;
earth_mean_anomaly : Real;
earth_heliocentric_long : Real;
earth_true_anomaly : Real;
earth_radius_vector : Real;

Sun_mean_anomaly : Real;
Sun_true_anomaly : Real;
Sun_longitude : Real;
Sun_RA : Real;
Sun_DEC : Real;
Sun_Altitude : Real;
Sun_Azimuth : Real;
Sun_Hour_Angle : Real;
Sun_Size : Real;
Sun_LST_Rise : Real;
Sun_LST_Set : Real;
Sun_LCT_Rise : Real;
Sun_LCT_Set : Real;
Sun_Azimuth_Set : Real;
Sun_Azimuth_Rise : Real;

Moon_mean_longitude : Real;
Moon_true_longitude : Real;
Moon_mean_anomaly : Real;
Moon_true_anomaly : Real;
Moon_long : Real;
Moon_radius_vector : Real;
Moon_ascending_node_mean_longitude : Real;
Moon_corrected_anomaly : Real;
Moon_correction_for_equation_of_centre : Real;
Moon_ecliptic_latitude : Real;
Moon_ecliptic_longitude : Real;
Moon_RA : Real;
Moon_DEC : Real;
Moon_Altitude : Real;
Moon_Azimuth : Real;
Moon_Hour_Angle : Real;
Moon_Size : Real;
Moon_Distance : Real;
Moon_Age : Real;
Moon_Position_Angle : Real;
Moon_LST_Rise : Real;
Moon_LST_Set : Real;
Moon_LCT_Rise : Real;
Moon_LCT_Set : Real;
Moon_Azimuth_Set : Real;
Moon_Azimuth_Rise : Real;

GMT : Real; {Greenwich mean time}
GST : Real; {Greenwich Siderial time}
LCT : Real; {Local Civil time}
Lst : Real; {Local Siderial time}

Hour : Integer;
Minute : Integer;
T, B : Real;

projected_heliocentric_long : Real;
projected_radius_vector : Real;

Geocentric_ecliptic_Long : Real;
Geocentric_latitude : Real;

RA : Real; {equatorial coordinates}
DEC : Real;

Phase : Real;
Distance_from_Earth1 : Real;
Distance_from_Earth2 : Real;
Distance_from_Earth : Real;
Diameter : Real;
Magnitude : Real;

Hour_Angle : Real;
Hour_Angle_in_Degrees : Real;
Azimuth : Real;
Altitude : Real;

LST_Rise : Real;
LST_Set : Real;
LCT_Rise : Real;
LCT_Set : Real;
Azimuth_Set : Real;
Azimuth_Rise : Real;

y : Real; {intermediate variable}
x : Real; {intermediate variable}
z : Real; {intermediate variable}
Daylight_savings_start : Real;
Daylight_savings_end : Real;
i,n : Integer;
last_scale_selected : Integer;
OldXpos, OldYpos : ARRAY[0..Num_Of_Planets] OF integer;
SymbolBuffer : ARRAY[0 .. Num_Of_Planets] OF ARRAY[1..300] OF Byte;



{ Trig Functions }


FUNCTION DEGREE(X : Real) : Real;
BEGIN
DEGREE := X * DegreesInRadian
END; {DEGREE}

FUNCTION RADIAN(X : Real) : Real;
BEGIN
RADIAN := X / DegreesInRadian
END; {RADIAN}

FUNCTION SIND(X : Real) : Real;
BEGIN
SIND := Sin(X / DegreesInRadian)
END; {SIND}

FUNCTION COSD(X : Real) : Real;
BEGIN
COSD := Cos(X / DegreesInRadian)
END; {COSD}

FUNCTION TAN(X : Real) : Real;
BEGIN
TAN := Sin(X) / Cos(X)
END; {TAN}

FUNCTION TAND(X : Real) : Real;
BEGIN
TAND := TAN(X / DegreesInRadian)
END; {TAND}

FUNCTION ARCTAND(X : Real) : Real;
BEGIN
ARCTAND := DegreesInRadian * ArcTan(X)
END; {ARCTAND}

FUNCTION ARCTANYX(Y, X : Real) : Real;
VAR
z, zmax : Real;
BEGIN
z := ArcTanD(y / x);
IF (y > 0) AND (x > 0) THEN zmax := 90;
IF (y > 0) AND (x < 0) THEN zmax := 180;
IF (y < 0) AND (x < 0) THEN zmax := 270;
IF (y < 0) AND (x > 0) THEN zmax := 360;
WHILE z > zmax DO z := z - 180;
WHILE z < (zmax - 90) DO z := Z + 180;
ARCTANYX := z;
END; {ARCTANYX}

FUNCTION ARCSIN(X : Real) : Real;
BEGIN
IF X * X >= 1 THEN ARCSIN := PiDividedByTwo ELSE
ARCSIN := ArcTan(X / Sqrt(1 - X * X))
END; {ARCSIN}

FUNCTION ARCSIND(X : Real) : Real;
BEGIN
ARCSIND := DegreesInRadian * ARCSIN(X)
END; {ARCSIND}

FUNCTION ARCCOS(X : Real) : Real;
BEGIN
IF X * X >= 1 THEN ARCCOS := 1 ELSE
ARCCOS := PiDividedByTwo - ArcTan(X / Sqrt(1 - X * X))
END; {ARCCOS}

FUNCTION ARCCOSD(X : Real) : Real;
BEGIN
ARCCOSD := DegreesInRadian * ARCCOS(X)
END;


PROCEDURE Frame(UpperLeftX, UpperLeftY, LowerRightX, LowerRightY :
Integer);
VAR
i : Integer;
BEGIN
IF ColorMonitor
THEN
TextColor(Yellow)
ELSE
TextColor(White);
GoToXY(UpperLeftX, UpperLeftY); Write('Ú');
FOR i := UpperLeftX + 1 TO LowerRightX - 1 DO Write('Ä');
Write('¿');
FOR i := UpperLeftY + 1 TO LowerRightY - 1 DO
BEGIN
GoToXY(UpperLeftX, i); Write('³');
GoToXY(LowerRightX, i); Write('³');
END;
GoToXY(UpperLeftX, LowerRightY);
Write('À');
FOR i := UpperLeftX + 1 TO LowerRightX - 1 DO Write('Ä');
Write('Ù');
TextColor(White);
END { Frame } ;


{ Astronomy Functions }


FUNCTION Minutes(time : Real) : Integer;
BEGIN
Minutes := Abs(Trunc(60 * (Frac(time))))
END;

FUNCTION Seconds(time : Real) : Integer;
BEGIN
Seconds := Abs(Trunc(60 * (Frac(60 * Frac(time)))))
END;

PROCEDURE deg_min_sec(VAR angle : Real);
BEGIN
IF NOT Display_Degrees_in_Decimal
THEN
BEGIN
IF angle < 0 THEN Write('-') ELSE Write(' ');
Write(Abs(Trunc(angle)):3, 'ø ', minutes(angle):2, ''' ',
seconds(angle):2, '"');
END
ELSE
Write(angle:8:4, 'ø ');
END;

PROCEDURE hours_min_sec(VAR angle : Real);
BEGIN
IF NOT Display_Degrees_in_Decimal
THEN
BEGIN
IF angle < 0 THEN Write('-') ELSE Write(' ');
Write(Abs(Trunc(angle / 15)):3, 'h ', minutes(angle / 15):2, 'm '
,
seconds(angle / 15):2, 's');
END
ELSE
Write(angle / 15:8:4, 'h');
END;

FUNCTION Daylight_Savings : Boolean;
BEGIN
Daylight_Savings := (((Month + Day / 100) < Daylight_savings_end) AND
((Month + Day / 100) > Daylight_savings_start) AND
Daylight_savings_Correction_Enabled);
END;

FUNCTION Anomaly(M, Ecc : Real) : Real;
VAR
d : Real;
E : Real;
BEGIN
E := M;
d := E - Ecc * Sin(E) - M;
WHILE Abs(d) > 0.000001 DO
BEGIN
E := E - d / (1 - Ecc * Cos(E));
d := E - Ecc * Sin(E) - M
END;
Anomaly := 2 * ArcTan(Sqrt((1 + Ecc) / (1 - Ecc)) * Tan(E / 2))
END; {Anomaly}

FUNCTION JulianDay(month, day, year : Integer) : Real;
VAR
A, B, C, D : Real;

BEGIN
IF (month = 1) OR (month = 2)
THEN
BEGIN
year := year - 1;
month := month + 12
END;
IF (year > 1582) OR (year = 1582) AND (month > 10) OR (year =
1582) AND (month = 10) AND (day > 15)
THEN
BEGIN
A := Int(year / 100);
B := 2 - A + Int(A / 4)
END
ELSE
BEGIN
B := 0
END;

C := Int(365.25 * year);
D := Int(30.6001 * (month + 1));
JulianDay := B + C + D + day + 1720994.5;
END; {JulianDay}

FUNCTION ECL_TO_RA(L, B : Real) : Real;
VAR
x : Real;
y : Real;
z : Real;
BEGIN
x := COSD(L);
y := SIND(L) * 0.91746406 - TAND(B) * 0.397818676;
z := ArcTanYX(y, x);
ECL_TO_RA := Z;
END; {ECL_TO_RA}

FUNCTION ECL_TO_DEC(L, B : Real) : Real;
BEGIN
ECL_TO_DEC := ARCSIND(SIND(B) * 0.91746406 + COSD(B) * SIND(L)
* 0.397818676);
END;

FUNCTION LST_TO_LCT(Lst, Long : Real;
Year, Day_of_year : Integer;
Zone_Corr : Real) : Real;
VAR
B, T, GST, GMT : Real;
BEGIN
GST := Lst + Long / 15;
IF GST > 24 THEN GST := GST - 24;
IF GST < 0 THEN GST := GST + 24;
T := (JulianDay(1, 0, year) - 2415020.0) / 36525.0;
B := 24 - 6.6460656 - (2400.051262 * T) - (0.00002581 * T * T) +
(24 * (year - 1900));
T := GST - Day_of_Year * 0.0657098 + B;
IF T > 24 THEN T := T - 24;
IF T < 0 THEN T := T + 24;
GMT := T * 0.99727;
LST_TO_LCT := GMT - Zone_Corr;
END;

PROCEDURE make_degrees_in_range(VAR n : Real);
BEGIN
WHILE n > 36000.0 DO
n := n - 36000.0;
WHILE n > 3600 DO
n := n - 3600;
WHILE n > 360 DO
n := n - 360;
WHILE n < - 36000.0 DO
n := n + 36000.0;
WHILE n < - 3600 DO
n := n + 3600;
WHILE n < 0 DO
n := n + 360;
END;

PROCEDURE Make_Hours_in_Range(VAR n : Real);
BEGIN
WHILE n >= 24 DO
n := n - 24;
WHILE n < 0 DO
n := n + 24;
END;


PROCEDURE GoToHiRes;
BEGIN
IF NOT TravelMode {moon plot} THEN
BEGIN
SetGraphMode(GraphMode);
IF ColorMonitor
THEN
CASE LastCommand OF
'V' : SetColor(LightBlue);
'B' : SetColor(LightMagenta);
'Z' : SetColor(LightGreen);
ELSE SetColor(LightCyan);
END
ELSE
SetColor(White);
Window(1, 1, 80, 25);
END;
Textcolor(3);
IF LastCommand = '@' THEN
BEGIN
SetFillStyle(EmptyFill,0);
str(Earth_Day:4:2,S1);
outTextXY(100,0,'Earth_Days = ');
bar(212,0,299,8);
outTextXY(212,0,S1);
str(Earth_Day * Parray[3].rotation /
Parray[PlanetSelected].rotation:4:2,S1);
outTextXY(300,0,'Planet_days = ');
bar(412,0,470,8);
outTextXY(412,0,S1);
END
ELSE
BEGIN
SetFillStyle(EmptyFill,0);
str(month,S1);
str(day,S2);
str(year,S3);
bar(504,0,620,15);
outTextXY(504,0,S1);
outTextXY(520,0,'-');
outTextXY(528,0,S2);
outTextXY(542,0,'-');
outTextXY(550,0,S3);
str(JD:10:0,S1);
bar(504,8,620,25);
outTextXY(504,8,'JD =');
outTextXY(536,8,S1);
str(Hour:2,S1);
str(Minute:2,S2);
outTextXY(504,16,'LCT = ');
bar(552,16,568,35);
outTextXY(552,16,S1);
outTextXY(568,16,'h ');
bar(584,16,600,35);
outTextXY(584,16,S2);
str(Round(Longitude):3,S1);
str(Round(Latitude):2,S2);
outTextXY(504,24,'Long=');
outTextXY(544,24,S1);
outTextXY(568,24,' Lat=');
outTextXY(608,24,S2);
outTextXY(648,24,' ');
END;
END;

PROCEDURE time_window;
VAR
JDay : Integer;
BEGIN
IF NOT TravelMode THEN
BEGIN
Window(58, 2, 78, 10);
ClrScr;
Window(1, 1, 80, 25);
frame(56, 1, 80, 10);
IF ColorMonitor
THEN
TextColor(LightMagenta)
ELSE
TextColor(White);
Window(58, 2, 78, 10);
GoToXY(1, 1);
WriteLn(' ', month, '-', day, '-', year);
END;
LCT := Hour + Minute / 60 + 1 / 120;
GMT := Zone_correction + LCT;
IF Daylight_Savings THEN
GMT := GMT - 1;
IF GMT > 12
THEN
JDay := Day + 1
ELSE
JDay := Day;
JD := Julianday(month, JDay, year);
daylight_savings_start :=
4 + (30 - Round(7 * Frac((Julianday(4, 30, year) + 1.5) / 7))) * 0.01;
daylight_savings_end :=
10 + (31 - Round(7 * Frac((Julianday(10, 31, year) + 1.5) / 7))) * 0.01;
IF NOT TravelMode THEN
BEGIN
WriteLn(' JD =', JD:10:0);
Write('Long = ');
deg_min_sec(Longitude);
WriteLn;
Write('Lat = ');
deg_min_sec(Latitude);
WriteLn;
END;
IF NOT TravelMode THEN
WriteLn(' LCT = ', Hour:2, 'h ', Minute:2, 'm');
Make_Hours_in_Range(GMT);
IF NOT TravelMode THEN
WriteLn(' GMT = ', Trunc(GMT):2, 'h ', minutes(GMT):2, 'm');
T := (JulianDay(1, 0, year) - 2415020.0) / 36525.0;
B := 24 - 6.6460656 - (2400.051262 * T) - (0.00002581 * T * T) +
(24 * (year - 1900));
GST := 0.0657098 * Day_of_year - B + GMT * 1.002738;
Make_Hours_in_Range(GST);
IF NOT TravelMode THEN
WriteLn(' GST = ', Trunc(GST):2, 'h ', minutes(GST):2, 'm');
Lst := GST - Longitude / 15;
Make_Hours_in_Range(Lst);
IF NOT TravelMode THEN
WriteLn(' LST = ', Trunc(Lst):2, 'h ', minutes(Lst):2, 'm');
END; {time_window}

PROCEDURE Make_Planet_Symbol(Xpos, Ypos, PlanetNumber : Integer;
clear : boolean);
BEGIN
IF (OldXpos[PlanetNumber] > 0) AND
(OldYpos[PlanetNumber] > 0) AND
(OldXpos[PlanetNumber] < GetMaxX - 8) AND
(OldYpos[PlanetNumber] < GetMaxY - 8)
THEN
PutImage(OldXpos[PlanetNumber], OldYpos[PlanetNumber],
SymbolBuffer[PlanetNumber],NormalPut);
IF clear AND (OldXpos[PlanetNumber] < GetMaxX - 8) AND
(OldYpos[PlanetNumber] < GetMaxY - 8) AND
(OldXpos[PlanetNumber] > 0) AND
(OldYpos[PlanetNumber] > 0)
THEN
BEGIN
SetViewPort(OldXpos[PlanetNumber],
OldYpos[PlanetNumber],
OldXpos[PlanetNumber] + 7,
OldYpos[PlanetNumber] + 7,true);
ClearViewPort;
SetViewPort(0, 0, 639, GetMaxY,true);
END;
IF ((GetMaxX - Xpos) > 7) AND ((GetMaxY - Ypos) > 7) THEN
GetImage(Xpos, Ypos, Xpos + 7, Ypos + 7, SymbolBuffer[PlanetNumber]);
OldXpos[PlanetNumber] := Xpos;
OldYpos[PlanetNumber] := Ypos;
IF (Xpos < GetMaxX - 8) AND (Ypos < GetMaxY - 8) AND
(Xpos > 0) AND (Ypos > 0)
THEN
BEGIN
IF ColorMonitor THEN
SetColor(Yellow);
Str(PlanetNumber,S1);
IF PlanetNumber < 10 THEN
OutTextXY(Xpos,Ypos,S1);
IF PlanetNumber = 10 THEN
OutTextXY(Xpos,Ypos,'S');
IF PlanetNumber = 11 THEN
OutTextXY(Xpos,Ypos,'M');
IF PlanetNumber > 11 THEN
OutTextXY(Xpos,Ypos,'*');
SetColor(White);
END;
END;

PROCEDURE Locate_Position_of_Planet_in_Its_Own_Orbital_Plane(n : Integer);
BEGIN
WITH Parray[n] DO
BEGIN
IF Epoch = 0
THEN
BEGIN
planet_mean_anomaly := 360 * (year + day_of_year / 365.2422
- Perihelion_Epoch) / period; {E02}
Make_Degrees_in_Range(planet_mean_anomaly);
END
ELSE
BEGIN
planet_long_of_ascend_node := (360 / 365.2422) *
(Julianday(month, day, year)
- 365.2422 * Frac(Epoch)
- Julianday(1, 0, Trunc(Epoch))) / period;
Make_Degrees_in_Range(planet_long_of_ascend_node);
planet_mean_anomaly := planet_long_of_ascend_node +
long_at_epoch
- long_of_per;
Make_Degrees_in_Range(planet_mean_anomaly);
END;
planet_true_anomaly := DEGREE(ANOMALY(RADIAN(
planet_mean_anomaly), Ecc));
Make_Degrees_in_Range(planet_true_anomaly);
planet_heliocentric_long := planet_true_anomaly + long_of_per;
Make_Degrees_in_Range(planet_heliocentric_long);
planet_radius_vector := axis * (1 - Ecc * Ecc) / (1 + Ecc * COSD(
planet_true_anomaly));
planet_helio_ecliptic_lat := ARCSIND(SIND(
planet_heliocentric_long -
long_of_ascend_node) * SIND(Inc));
END;

END;

PROCEDURE Locate_Position_of_Earth;
BEGIN
WITH Parray[3] DO
BEGIN
earth_long_of_ascend_node := (360 / 365.2422) * (Julianday(month
, day, year)
- Julianday(1, 0, Trunc(Epoch))) / period;
Make_Degrees_in_Range(earth_long_of_ascend_node);
earth_mean_anomaly := earth_long_of_ascend_node + long_at_epoch
- long_of_per;
earth_true_anomaly := DEGREE(ANOMALY(RADIAN(
earth_mean_anomaly), Ecc));

earth_heliocentric_long := earth_true_anomaly + long_of_per;
Make_Degrees_in_Range(earth_heliocentric_long);
earth_radius_vector := axis * (1 - Ecc * Ecc) / (1 + Ecc * COSD(
earth_true_anomaly));
END;
END;

PROCEDURE Project_Position_of_Planet_onto_Plane_of_ecliptic;
BEGIN
WITH Parray[num] DO
BEGIN
y := SIND(planet_heliocentric_long - long_of_ascend_node) * COSD(
Inc);
x := COSD(planet_heliocentric_long - long_of_ascend_node);
z := ArcTanYX(y, x);
projected_heliocentric_long := Z + long_of_ascend_node;
Make_Degrees_in_Range(projected_heliocentric_long);
Projected_Radius_vector := planet_radius_vector *
COSD(planet_helio_ecliptic_lat);
END;
END;

PROCEDURE Calculate_Ecliptical_Coordinates;
BEGIN
IF (Planet_Radius_Vector < Earth_Radius_Vector)
THEN
Geocentric_Ecliptic_Long := Earth_Heliocentric_long + 180 +
ArcTanD(Projected_Radius_Vector * SIND(Earth_Heliocentric_long -
Projected_heliocentric_long) / (Earth_Radius_Vector -
Projected_Radius_Vector * COSD(Earth_Heliocentric_long -
Projected_heliocentric_long)))
ELSE
Geocentric_Ecliptic_Long := Projected_Heliocentric_Long +
ArcTanD(Earth_Radius_Vector * SIND(Projected_heliocentric_long -
Earth_Heliocentric_Long) / (Projected_Radius_Vector -
Earth_Radius_Vector * COSD(Projected_heliocentric_long -
Earth_Heliocentric_Long)));
Make_Degrees_in_Range(Geocentric_Ecliptic_Long);
Geocentric_latitude := ArcTanD(Projected_Radius_Vector *
TAND(planet_helio_ecliptic_lat) *
SIND(Geocentric_Ecliptic_Long -
Projected_Heliocentric_Long) / (Earth_Radius_Vector *
SIND(Projected_Heliocentric_Long -
Earth_Heliocentric_Long)));
END;

PROCEDURE Draw_Sky_Window;
VAR
X, Y : Integer;
BEGIN
IF NOT TravelMode THEN
BEGIN
GoToHiRes;
Locate_Position_of_Earth;
Line(50, 11 * GetMaxY DIV 12, 590, 11 * GetMaxY DIV 12);
Line(590, 11 * GetMaxY DIV 12, 590, 2 * GetMaxY DIV 12);
Line(590, 2 * GetMaxY DIV 12, 50, 2 * GetMaxY DIV 12);
Line(50, 2 * GetMaxY DIV 12, 50, 11 * GetMaxY DIV 12);
SetLineStyle(DottedLn,0,NormWidth);
FOR X := 2 TO 10 DO
Line(50,X * GetMaxY DIV 12, 590,X * GetMaxY DIV 12);
FOR X := 1 TO 3 DO
Line(50 + X * 135,2 * GetMaxY DIV 12,50 + X * 135,11 * GetMaxY DIV 12);
SetLineStyle(SolidLn,0,NormWidth);
outTextXY(180,GetMaxY - 12,'E');
outTextXY(315,GetMaxY - 12,'S');
outTextXY(450,GetMaxY - 12,'W');
outTextXY(32,2 * GetMaxY DIV 12 - 4,'90');
outTextXY(32,5 * GetMaxY DIV 12 - 4,'60');
outTextXY(32,8 * GetMaxY DIV 12 - 4,'30');
outTextXY(32,11 * GetMaxY DIV 12 - 4,' 0');
END;
END;

PROCEDURE Compute_and_Plot_Planet_in_Sky_Window;
VAR
X, Y : Integer;
BEGIN
Locate_Position_of_Planet_in_its_Own_Orbital_Plane(num);
Project_Position_of_Planet_onto_Plane_of_ecliptic;
Calculate_Ecliptical_Coordinates;
RA := ECL_TO_RA(Geocentric_Ecliptic_Long, Geocentric_Latitude);
DEC := ECL_TO_DEC(Geocentric_Ecliptic_Long, Geocentric_Latitude);
Hour_Angle := Lst - RA / 15;
IF Hour_Angle < 0 THEN Hour_Angle := Hour_Angle + 24;
Altitude := ArcSinD(SIND(Dec) * SIND(Latitude) +
COSD(Dec) * COSD(Latitude) * COSD(Hour_Angle * 15));
Azimuth := ArcCosD((SIND(Dec) - SIND(Latitude) * SIND(Altitude)) /
(COSD(Latitude) * COSD(Altitude)));
IF SIND(Hour_Angle * 15) > 0 THEN
Azimuth := 360 - Azimuth;
IF Altitude > 0
THEN
BEGIN
X := Round(Azimuth * 1.5 + 50);
Y := Round(11 * GetMaxY / 12 - Altitude * GetMaxY / 120);
Make_Planet_Symbol(X, Y, Num,true);
GoToXY((X DIV 8) + 4, (Y DIV 8) + 1);
IF Display_Names_on_Plots AND NOT TravelMode
THEN
outTextXY(X + 8,Y,Parray[num].name);
END
ELSE
BEGIN
IF (OldXpos[num] > 0) AND (OldYpos[num] > 0) AND
((LastCommand = 'V') OR (LastCommand = 'B')
OR (LastCommand = 'Z')) AND
(OldXpos[num] < 640) AND (OldYpos[num] < GetMaxY-5)
THEN
BEGIN
Str(num,numstring);
If ColorMonitor THEN
SetColor(Yellow);
OutTextXY(OldXpos[num],OldYpos[num],numstring);
SetColor(White);
END;
END;
END;



PROCEDURE plot_planet(nop, scale : Integer);
VAR
Xold, Xnew, Yold, Ynew, A : Integer;
FUNCTION compute_radius_vector(n, angle : Integer) : Real;
BEGIN
compute_radius_vector := Parray[n].axis *
(1 - Parray[n].ecc * Parray[n].ecc)
/ (1 + Parray[n].ecc * COSD(angle
- Parray[n].long_of_per));
END;
PROCEDURE Draw_orbit(deg : Integer);
BEGIN
Xold := Xnew;
Yold := Ynew;
IF Parray[nop].Inc > 90
THEN
BEGIN
Xnew := Round(compute_radius_vector(nop, A * deg) * scale *
COSD(A * deg)) + CenterX;
Ynew := Round(compute_radius_vector(nop, A * deg) * scale *
Screen_Aspect * SIND(A * deg)) + CenterY;
END
ELSE
BEGIN
Xnew := Round(compute_radius_vector(nop, A * deg) * scale *
SIND(A * deg)) + CenterX;
Ynew := Round(compute_radius_vector(nop, A * deg) * scale *
Screen_Aspect * COSD(A * deg)) + CenterY;
END;
IF A > 0 THEN
Line(Xold, Yold, Xnew, Ynew);
END;
BEGIN
IF ColorMonitor THEN
case nop OF
1 : SetColor(Cyan);
2 : SetColor(Green);
3 : SetColor(Blue);
4 : SetColor(Red);
5 : SetColor(Magenta);
6 : SetColor(LightBlue);
7 : SetColor(LightCyan);
8 : SetColor(LightGreen);
9 : SetColor(Brown);
end; {Case}
IF NOT TravelMode THEN
BEGIN
IF Parray[nop].ecc > 0.3
THEN
FOR A := 0 TO 120 DO
draw_orbit(3)
ELSE
FOR A := 0 TO 30 DO
draw_orbit(12);
END;
Locate_Position_of_Planet_in_Its_Own_Orbital_Plane(nop);
IF Parray[nop].Inc > 90
THEN
BEGIN
Ynew := Round(scale * planet_radius_vector * Screen_Aspect *
SIND(planet_heliocentric_long)) + CenterY;
Xnew := Round(scale * planet_radius_vector *
COSD(planet_heliocentric_long)) + CenterX;
END
ELSE
BEGIN
Ynew := Round(scale * planet_radius_vector * Screen_Aspect *
COSD(planet_heliocentric_long)) + CenterY;
Xnew := Round(scale * planet_radius_vector *
SIND(planet_heliocentric_long)) + CenterX;
END;
overwriting := false;
FOR i := 1 TO Num_Of_Planets DO
IF (ABS(OldXpos[i] - Xnew) < 9) AND (ABS(OldYpos[i] - Ynew) < 9)
AND (nop <> i)
THEN overwriting := true;
Make_Planet_Symbol(Xnew, Ynew, nop,overwriting);
IF ColorMonitor THEN
case nop OF
1 : SetColor(Cyan);
2 : SetColor(Green);
3 : SetColor(Blue);
4 : SetColor(Red);
5 : SetColor(Magenta);
6 : SetColor(LightBlue);
7 : SetColor(LightCyan);
8 : SetColor(LightGreen);
9 : SetColor(Brown);
end; {Case}
outTextXY(10,20 + 12 * nop,Parray[nop].name);
IF (Xnew < 640) AND (Xnew > 0) AND (Ynew < GetMaxY) AND (Ynew > 0) AND
(Display_Names_on_Plots) AND (NOT TravelMode) THEN
outTextXY(Xnew + 9,Ynew,Parray[nop].name);
SetColor(White);

END;



  3 Responses to “Category : Science and Education
Archive   : PLANETS.ZIP
Filename : PLANETS1.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/