# Dome Calculation

This article discusses the maths involved in the proper calculation of the dome slit position for a side-by-side set-up as in use at InFINNity Deck. At the bottom of this page there is an interactive form to support programmers in testing their own implementation of the algorithms. The code itself can be found here. This article is also available as a pdf-file.

# Dome control for a side-by-side set-up Figure 1: The side-by-side set-up at InFINNity-Deck. The imaging scope is a 150mm apochromat (the one on top).
Although perhaps still not common, the use of side-by-side mounted telescopes within a domed observatory has its application in astrophotography. When imaging throughout the night, the dome has to be controlled in a way that light from heavenly objects is allowed to pass through the dome's slit onto the telescopes. When using a fork-mounted telescope, and assuming that its centre of rotation is set-up in the geometrical centre of the dome, the direction into which the dome's slit has to point equals the azimuth of the telescope. When using a German equatorial mount (GEM), this gets more complicated as the scope sits at the end of the declination (DEC) axis, which moves around the intersection of the right ascension (RA) and DEC axis, at a distance known as the GEM-offset. When a side-by-side set-up is used, the weight difference between the telescopes may cause the set-up to be laterally off-centred, while during automated operation perhaps only one of the scopes is required to look through the slit. Adding a lateral offset (LAT-offset) in the calculations allows for more accurate positioning of the slit for side-by-side installations and by that allow longer periods without dome-slews, therefore reducing settling times and thus increasing imaging time. This article deals with the mathematics required to accurately control a dome when used with a LAT-offset in a side-by-side set-up.

As an amateur astronomer I have the luxury to have my own private observatory on top of our home, InFINNity Deck (see figure 1). It is used for visual observations and for astrophotography. The most commonly used applications for imaging automation do allow for the GEM-offset (distance A-B in figure 1) in their dome control algorithms, but it is assumed that the set-up consists of a single telescope mounted at the centre of the DEC-axis. When using a side-by-side set-up, like at InFINNity Deck, the telescope no longer occupies this central position, but is displaced sideways. This displacement can be corrected by adding the lateral offset (LAT-offset, distance B-C in figure 1) to the calculations.
As mentioned above in the currently available applications it is assumed that, viewed in the lateral direction, the scope is mounted in the centre of the RA-axis. In such a set-up the telescope moves along an oblique circular plane with a radius equal to this GEM-offset (see figure 2, point A is the intersection between the RA and DEC axis).

The mathematics required to control a dome for this situation have been explained in an article by R. Kent Honeycutt and James E. Kephart in 1982.1 Their method, however, did not include the LAT-offset, while their mathematics did not directly provided a solution to a programmer. Honeycutt and Kephart based their calculations on a horizontal Cartesian coordinate system that had its positive axis facing west and south. Coming from a surveying background I am used to have the positive axis point in the directions east and north, while the first application in which my algorithm has been tested, Mount Wizzard 4 (MW4), has the positive directions north and west. MW4 is an application used for model-building, a method to determine the polar-alignment of a mount, based on a number of sky-targets that are defined in horizontal angular coordinates. Honeycutt & Kephart and MW4 have the zenith axis positive going upwards, which follows the surveying convention. For ease of testing I have decided to follow the conventions of MW4 and also followed the naming conventions for the axis:
• X-axis: runs north-south, north is positive;
• Y-axis: runs east-west, west is positive;
• Z-axis: runs vertical, upwards is positive;
• Lateral offset: + when OTA is east of centre at park position with the scopes pointing towards Polaris and the counterweight in the direction with an azimuth of 0 degrees;
• GEM offset: always positive.
When I created the algorithm, its purpose was to steer the dome in directions that were based on targets that were known in altitude and azimuth (horizontal angular coordinates) as that is the way MW4 works. The targets are imaged and plate-solved, the resulting celestial coordinates are then compared to those provided by the mount and the polar alignment can be calculated including some statistical data to indicate its accuracy.

# STEP 1: Conversion to local hour angle

If we want to calculate the azimuth to which the dome's slit has to move, we need to know the position of the telescope (xt, yt, zt, point C in figure 2) in relation to the geometrical centre of the dome (xd, yd, zd), which is presumed to be (0,0,0), and the vector towards the celestial object (ac, bc, cc). In order to be able to use these horizontal angular coordinates to calculate the vector (ag, bg, cg) along the GEM-offset, we first need to convert the azimuth (A, taken clockwise from north) and altitude (a) to equatorial ones using the observatory's latitude (φ).2 The declination (δ) follows from:
 sin(δ) = sin(a) sin(φ) + cos(a) cos(φ) cos(A) [1.1]

Using the declination from [1.1] the local hour angle (LHA) can be calculated:

 sin(LHA') = - sin(A) cos(a) / cos(δ) [1.2]

The resulting LHA' is calculated within the two meridian quadrants ranging from -90° to +90°, in order to find LHA the complement with 180° is taken when the azimuth is within the two anti-meridian quadrants:

 LHA = LHA' (A >= 90° && A <= 270°) + (180 - LHA') (A < 90° && A > 0°) || (A > 270° && A < 360°) [1.3]

# STEP 2: Calculating the vector to the celestial object

The horizontal angular coordinates are used to calculate the vector (ac, bc, cc) to the celestial object. I based this on the equations given by Honeycutt and Kephart, but swapped ac and bc and inverted the sign of ac and to match my coordinate system:
 ac = cos(a) cos(A) [2.1] bc = -cos(a) sin(A) [2.2] cc = sin(a) [2.3]

STEP 3: The vector towards the GEM-offset
In order to go from the intersection of the RA and DEC axis on the mount to the centre of the telescope two vectors need to be calculated: the vector (ag, bg, cg) from the intersection of the RA and DEC axis towards the GEM-offset (points A and B in figure 2), and the vector (al, bl, cl) from the GEM-offset to the LAT-offset (points B and C in figure 2). The former is taken from Honeycutt and Kephart, but again modified to match my coordinate system and leaving out the height above the dome base as it is more logical to add that later on. The sign of each part of the vector depends on the side of the pier the telescope is at (the length of the GEM-offset is indicated as G):3

 ag = - G sin(LHA) sin(LAT) (1(pierside = east) - 1(pierside = west)) [3.1] bg = - G cos(LHA) (1(pierside = east) - 1(pierside = west)) [3.2] cg = G sin(LHA) cos(LAT) (1(pierside = east) - 1(pierside = west)) [3.3]

# STEP 4: The vector towards the lateral-offset

The LAT-offset vector (al, bl, cl) is always perpendicular to the vector (ac, bc, cc) towards the celestial object and to vector (ag, bg, cg) towards the GEM-offset. It can be calculated by taking their cross product:

 (i, j, k) = (ac, bc, cc) x (ag, bg, cg) [4.0]

Or in each coordinate as:

 i = ( bc cg − bg cc ) [4.1] j = - ( ac cg − ag cc ) [4.2] k = ( bg ac − bc ag ) [4.3]

Where (i, j, k) is the vector in the correct direction, but still of the length of the GEM-offset. To get the LAT-offset vector (al, bl, cl) the vector (i, j, k) is divided by the length of the GEM-offset (G) and multiplied with the LAT-offset (L):

 (al, bl, cl) = L (i, j, k) / G [4.4]

The resulting vector (al, bl, cl) can be tested by taking the absolute value of this vector, which should equal the LAT-offset (L).

# STEP 5: The coordinates of the telescope Figure 3: The latitude-axis and intersection of the RA- and DEC-axis of a mount.
For calculating the centre of the telescope in relation to the centre of the dome we need to know the offset from the dome centre (0,0,0) to the base of the mount (xm, ym, zm), the offset from the mount's base to the latitude axis (see xla and zla in figure 3)4, and the offset from the latitude axis to the intersection of the RA and DEC axis (xrd, yrd, zrd)5. Dimension (xm, ym, zm) needs to be measured in the observatory (assuming the geometrical centre of the dome is (0,0,0)), dimension (xla,yla, zla) is defined by the make and model of the mount, while dimension (xrd, yrd, zrd) depends on the dimension D between the latitude axis and the intersection of the RA and DEC axis of the mount (see figure 3)6 and the latitude (φ) of the location at which the mount stands. In each coordinate the latter can be calculated as:
 xrd = D cos(φ) [5.1] yrd = 0 [5.2] zrd = D sin(φ) [5.3]

The centre of the telescope (xt, yt, zt) now follows from:

 (xt, yt, zt) = (xm, ym, zm) + (xla, yla, zla) + (xrd, yrd, zrd) + (ag, bg, cg) + (al, bl, cl) [5.4]

# STEP 6: The intersection with the dome

In order to find the azimuth of the dome we need to find the intersection from the line towards the celestial object originating from this point (xt, yt, zt) in the direction of vector (ac, bc, cc).7 The line is defined as points P(u):

 P(u) = (xt, yt, zt) + u (ac, bc, cc) [6.0]

Or in each coordinate as:
 x = xt + u ac [6.1] y = yt + u bc [6.2] z = zt + u cc [6.3]

A sphere S centred at (0,0,0) with radius r is described by its surface points (xs, ys, zs) as:

 xs2 + ys2 + zs2 = r2 [6.4]

Substituting the equation of the line into the sphere gives a quadratic equation of the form

 m u2 + n u + o = 0 [6.5]

with:

 m = ac 2 + bc2 + cc2 [6.6] n = 2 [ ac xt + bc yt + cc zt ] [6.7] o = xt2 + yt2 + zt2 - r2 [6.8]

# STEP 7: Check if a solution is found

The solutions to this quadratic function are described by: [7.0]
Whether or not the vector (ac, bc, cc) intersects the dome can be checked (and should be checked when implementing this in dome-control software to avoid exceptions when user input is incorrect) by the discriminant (the part of the formula underneath the square root):

 discriminant = n2 - 4 m o [7.1]

If it is less than 0, the vector runs outside the sphere and there is no intersection;
If it equals 0, then the vector is a tangent to the sphere, intersecting it at one point only (at u = -n/2m);
If it is greater than 0, the vector does intersect the sphere at two points.

STEP 8: Choosing the right solution
For a dome-control application the user input is thus only valid when u is greater than zero. Formula [7.0] contains two solutions (indicated by the plus/minus sign (±)). When using the subtractive form, the intersection at the camera-side of the telescope is found, when using the additive form the intersection with the dome at the objective side (xi, yi, zi) is found. As the latter is the required intersection, u is found by: [8.0]

# STEP 9: Calculating the intersection with the dome

The intersection (xi, yi, zi) with the dome at the objective side follows from:

 (xi, yi, zi) = (xt, yt, zt) + u (bc, ac, cc) [9.0]

Or in each coordinate as:
 xi = xt + u ac [9.1] yi = yt + u bc [9.2] zi = zt + u cc [9.3]

STEP 10: Calculating the dome's azimuth
The azimuth of the dome can now be found from the difference in X and Y between the dome's centre ( 0, 0 ) and the point of intersection ( xi, yi ) on its surface. For this we first calculate the angle (α):

 tan(α) = ( yi / -xi ) [10.1]

Depending on the quadrant the vector points at we need to add 180° or 360°:

 Azimuth dome = α + 180 ( xi < 0 ) + 360 (( yi > 0 ) && ( xi > 0 )) [10.2]

In addition we can calculate the horizontal distance at which the intersection takes place:

 Distance dome intersection = √( xi2 + yi2 ) [10.3]

# Some considerations

When the telescope's aperture and the width and length of the slit of the dome are known, the horizontal distance between the intersection point (xi, yi) and the dome's centre (xd, yd) can indicate whether or not a dome-slew actually is required.
As shown in this article the dome azimuth is calculated from the centre of the dome towards the intersection point of the telescope's optical axis with the dome. These intersections are calculated in 3D, while the required azimuth is calculated from the horizontal coordinates. When taking a steep sight (i.e. close to the zenith), it can well be that the intersection occurs just opposite of the dome's centre. As a result the dome is steered in the opposite direction. How often this happens depends on how high the mount sits within the dome, its horizontal offset to the dome's centre, and the size of the mount itself, including the GEM- and LAT-offsets.
On itself these large dome slews can be avoided if the length and width of the slit and aperture of the telescope are taken into account. As long as the distance from the dome's centre remains smaller than the length and width of the slit (corrected for half the aperture on all three sides) the dome needs not to slew. For lower altitudes, the same is true when the azimuth of the target is within the width of the slit (again minus half the aperture on both sides).
When implementing this, consideration should be taken with the accuracy with which the dome is steered. At InFINNity Deck the dome is controlled with an accuracy of about 2 degrees, which equals to about 5cm at a radius of 1.5 metres (about one-third the aperture of my deep-sky imaging scope). So for determining whether or not the dome should slew, this amount should be taken into in account when comparing the current dome's azimuth to the newly calculated azimuth. So if the newly calculated azimuth is away from the dome's slit-edge by at least the sum of half the aperture and the dome slew accuracy then no slew is required. The slit of my dome is 80cm wide and runs 40cm overhead, making this margin 7.5 + 5 = 12.5cm, leaving a useable space within the slit of 55cm (roughly 20 degrees for my dome).
The downtime due to dome-slews can further be reduced if the slit is positioned as close as possible to the lower hour angle side of the telescope. Only for those targets that are within a circle with radius (90° - φ)/2 and its centre at azimuth 0° and altitude (90°-radius), the slit should be positioned against the higher hour angle side of the telescope to maximise dome-slew intervals.
A final note regarding accuracy: Approaching the celestial pole may cause ambiguity in the calculations and, depending on the quality of the polar alignment of the mount, may cause the calculations to seemingly fail as the errors in the mount's azimuth and altitude are not an integral part of the algorithms presented here.

# Notes

: R.K. Honeycutt, J.E. Kephart, Some Applications Of Microcomputers In Observatory Automation, in: Publications of the Astronomical Society of the Pacific, vol. 94 (1982), pp.605-609.
: J. Meeus, Astronomical Algorithms, (Richmond (VA), 2005), pp.91-100. F. Vincent, Positional Astronomy: Conversion between horizontal and equatorial systems, 2003, see http://star-www.st-and.ac.uk/~fv/webnotes/chapter7.htm, last accessed 6 June 2020.
: In general pier-side is "west" for azimuths between 0° and 180° and "east" for azimuths between approximately 188° and 360°. In the region 180° to 188° the pier-side depends on the amount of time the mount can, or is allowed, to track through the meridian.
: The latitude axis is the axis along which the upper part of the mount rotates when adjusting it for its latitude. Dimension yla usually is zero.
: Dimension yrd usually is zero.
: This dimension again depends on the make and model of the mount.
: P. Bourke, Intersection of a Line and a Sphere (or circle) (1992), see: http://paulbourke.net/geometry/circlesphere/, last accessed 6 June 2020.

# The dome calculator Figure 4: The latitude-axis and intersection of the RA- and DEC-axis of a mount.
Conventions:
- X-axis: runs north-south, north is positive;
- Y-axis: runs east-west, west is positive;
- Z-axis: runs vertical, upwards is positive.
- Lateral offset: + when OTA is east of centre at park position with the scopes pointing towards Polaris and the counterweight in the direction with an azimuth of 0 degrees.
- GEM offset: always positive.

All linear measurements can be given in any unit of length as long as the same unit is used for all of them.
All linear answers are in the same unit of length as provided.
Changing any of below parameters will automatically recalculate the outcome. The pier-side is changed automatically for azimuths between 0° and 180° (pier-side = west) and between 188° and 360° (pier-side = east), but can be changed at will.

 Latitude [degrees] Offset from dome centre to base mount Xm Ym Zm Offset from base mount to latitude axis (see figure 4) Xla Yla Zla Distance D from latitude axis to RA/DEC axis intersection (see figure 4) GEM-offset Lateral-offset

 Dome radius (not diameter!) Target altitude [degrees] Target azimuth [degrees] Allowed tracking time past meridian [minutes] (max = 140 minutes) Pier-side EastWest DOME AZIMUTH DEGREES Dome azimuth calculations

If you have any questions and/or remarks please let me know.