# Calculator for Celestial Sight Reduction

The form below takes as input (described in detail below the form) the numbers related to sextant measurements of the heights above the horizon of two celestial objects.

## The Form - Enter your results here, click "Calc!" when done

## Using the Form

For each celestial object, three parameters are entered:
- two numbers for the Geographical Position ("GP", the point on Earth's surface directly below the object; time-dependent) of the object at the time it is observed:
- a Latitude (equal to the Almanac's reported Declination, with South negative)
- a Longitude (obtained from the Almanac's reported GHA: Lon = -GHA if GHA < 180
^{o}, Lon = 360^{o} - GHA if GHA > 180^{o}, so West longitude is negative)

- the height measured by the sextant, from the horizon to the object, after correction for known instrument index error, height of eye, refraction of the atmosphere, and horizontal parallax

Enter values as whole degrees in the ^{o} box, and minutes with optional decimal parts in the ' box. Use a minus sign for S and W (apply only to degrees, not minutes), e.g for 40^{o} 48' 12" W, enter -40 in the ^{o} box for Longitude, and 48.2 in the following ' box.

After entering the numbers, click "Calc!" and see a verification of input; then click "OK" and see one solution (the location from which object GP1 is seen to the right of GP2), click "OK" again and see the solution with GP1 to the left of GP2.

### Important note: the display of the results looks like decimal degrees, but the decimal point should be interpreted as separating degrees from minutes, with digits of minutes beyond the first two being decimal parts of minutes

e.g. in the result message box, 40.480042144 represents 40^{o} 48.0042144' and also note South Latitude and West Longitude are negative values.

Also note that an accurate result depends on the two observations being "nearly simultaneous" i.e. the vessel's speed multiplied by the time difference in observation times gives a distance travelled between observations, which should be considerably smaller than the acceptable error in position.

### Javascript Code for the Calculations

The calculations on the input entered above are performed by Javascript, as can be seen using "View Source" for this Webpage. If you save a copy of this page to your local computer, the Javascript will be included, and it should run offline, without connection to the Internet.

Much of the Javascript is just to guard against improper input values; the core of the calculations are in validateAndCalculate(theform) and various subroutines for basic vector algebra (addition, subtraction, scaling, dot product, cross product).

### Geometry on which the Code is based

Each sextant observation creates a circle of position (COP) on the surface of the earth (assumed here to be a perfect sphere). The center of that circle is on the line from the center of the Earth to the GP of the object at the time of its observation, and the angular radius of that circle is 90^{o} minus the height above the ideal horizon (as entered in the form above as "GP* Height:").