Detecting Cocircular Subsets of a Spherical Set of Points

Given a spherical set of points, we consider the detection of cocircular subsets of the data. We distinguish great circles from small circles, and develop algorithms for detecting cocircularities of both types. The suggested approach is an extension of the Hough transform. We address the unique parameter-space quantization issues arising due to the spherical geometry, present quantization schemes, and evaluate the quantization-induced errors. We demonstrate the proposed algorithms by detecting cocircular cities and airports on Earth’s spherical surface. These results facilitate the detection of great and small circles in spherical images.


Introduction
Given a spherical set of points, consider the problem of detecting the largest subset of cocircular points, i.e., the largest subset of points lying on the same circle on the sphere. One brute-force solution, related to RANSAC [1], is to examine all possible triplets of points in the point set. Note that each triplet (if not colinear) defines a plane, the intersection of the plane with the sphere defines a circle, and each point in the triplet clearly lies on the circle. The point set can then be searched for additional points lying on that circle. This O(N 4 ) procedure, where N is the cardinality of the point set, is prohibitive for sizable point sets.
A cocircular subset of a spherical set of points is obviously coplanar. In special cases, the plane passes through the center of the sphere. In such cases, the intersection of the plane and the sphere is referred to as a great circle; see the green circle in Figure 1 (right). In the general case, when the plane does not pass through the center of the sphere, the intersection of the plane and the sphere is referred to as a small circle; see the blue and red circles in Figure 1 (right).
In the classical Hough transform [2], the problem of finding colinear points in the plane is replaced by the dual problem of finding concurrent lines or curves in a parameter space, often referred to as the Hough space. In practice, the parameter space is quantized and represented by an accumulator array, a voting process takes place, and finding the intersection of lines or curves in the parameter space is implemented as a search for the maximum. The Hough transform is fundamentally robust with respect to outliers, and has been formally associated with the M-estimation methodology for robust regression [3]. The Hough transform has also been related to conformal geometric algebra [4]. The timecomplexity of the classical Hough transform is linear in the cardinality N of the dataset. Thus, when looking for the largest co-linear subset in a planar set of points, the Hough transform reduces the computational load from O(N 3 ) (the cost of checking each possible pair of points in the data; determining the line that connects the pair; and, for each other data-point, testing whether it lies on that line) to O(N).
The suggested approach to finding the largest subset of cocircular points in a spherical set of points is inspired by the Hough transform. Specifically, we characterize the circles (on the sphere) passing through a given point in the spherical set. The characterization is in the form of an equation constraining the parameters of the circles. We then search for the largest intersection of such equations, i.e., for the parameters specifying the circle passing through the largest possible number of points in the set. The intersection of the sphere with a plane associated with the primary point P is a circle. The intersection of the sphere with each of the associated parallel planes is a different circle with a different radius. For example, the red plane of which the normal direction is determined by point P intersects the sphere at the red circle. The parallel plane that passes through the origin of the sphere is a great circle (green).
As in the classical Hough transform, once the best-supported circle, i.e., the circle passing through the largest possible number of points, has been determined, finding the second-best-supported circle is straightforward. This can be reliably accomplished by identifying the data-points supporting the best circle, removing them from the dataset, and eliminating their contribution to the accumulator array ("unvoting") [5][6][7]. Circle detection and unvoting can be iterated until all circles are found.
The precise function of the Hough transform is the detection of a geometric primitive, such as a straight line or circle, common to the largest possible subset of points in the dataset. Identifying the relevant points themselves can then be easily accomplished [5], but is not always necessary. Note that it is commonly said that the Hough transform detects geometric primitives in a digital image, but accomplishing this task in an actual image requires edge detection as a preprocessing step.
Images acquired using omnidirectional cameras can be represented as spherical images. Straight line segments in the scene are then transformed to great circle arcs in the spherical image. This has led to some interest in the detection of great circles in spherical images. With this motivation, Vasseur and Mouaddib [8] and Torii and Imiya [9] outlined a Hough algorithm and a randomized Hough algorithm, respectively, for great-circle detection on a sphere. These ideas have modern applications, such as road-line detection in driverassistance systems [10].
In the detection of vanishing points, the search for convergence points in the image plane can be usefully replaced by the intersection of great circles on the Gaussian sphere [11]. This important task has been addressed using specialized Hough algorithms, leading to developments in spherical tessellation and discretization schemes [12,13] that are also useful in great-circle detection [14,15].
In geophysics, interest in great and small circle fitting arises in the context of volcano distribution analysis [16,17]. In these studies, specialized map projections transform great circles into an exact (gonomonic projection [17]) or approximate (UTM [16]) straight lines, allowing the use of the straight-line Hough transform [2] for great-circle detection. In the context of plate tectonics, Wessel [18] outlined the principles of a Hough transform for great-circle detection in the true spherical domain and sketched its generalization to small-circle detection. Wessel's insightful concepts [18] have so far received surprisingly little attention.
In this paper, we present comprehensive solutions for the detection of cocircular subsets of a spherical set of points. We describe a geometric framework that supports both great-and small-circle detection and provide algorithms for both cases. We address the unique parameter-space quantization issues arising due to the spherical geometry, present quantization schemes, and evaluate the quantization-induced errors. We demonstrate the proposed algorithms by detecting cocircular cities and airports on Earth's spherical surface.

Fundamentals
In this article, given a set of N >> 1 co-spherical points, we present a way to detect the circle that passes through the largest possible number of points in the set. It is easy to show that the circle itself necessarily lies on the sphere.
A point in 3D space can be defined by its spherical coordinates, consisting of the radial distance R from the origin, the polar angle θ, and the azimuthal angle ϕ; see Figure 1 (left). Assuming co-spherical points, point i is determined by the angular coordinates θ i and ϕ i alone.
Given an anchor point in 3D space and a normal direction, one can determine a plane that passes through the anchor point and fits the normal direction. By itself, a normal direction defines a set of parallel planes.
Viewing the angular coordinates of a (primary) point on the sphere as a normal direction therefore associates a set of parallel planes with that point. The intersection of each such plane with the sphere is a (primary) circle, as shown in Figure 1 (right).
Any (secondary) point on a primary circle of radius r (point S 1 in Figure 2), viewed as a normal direction, defines a secondary circle of radius r passing through the primary point (point P in Figure 2). Thus, given a primary point and a radius r, each secondary point is the center of a circle of radius r passing through the primary point. Since this property holds for any secondary point on a primary circle, a set of primary circles for primary points located on the same circle will intersect at a specific secondary point, which is the center of the circle passing through all the primary points. This is illustrated in Figure 3, where the red, blue, and green points are primary points on the same (black) circle of radius r. The corresponding primary circles of radius r intersect at the black secondary dot S, which defines the secondary circle (black) passing through all the primary points. The red, green, and blue points (P 1 , P 2 , P 3 ) are primary points located on the same circle (black). Each primary point defines a primary circle. All the primary circles intersect at a secondary point (black point S). That point defines a secondary circle (black) passing through the primary points. Now, given a set of unit co-spherical points, i.e., a set of points S = {(θ i , ϕ i )} located on the unit sphere, we look for the normal direction (θ, ϕ) that determines the circle of (pre-defined) radius r passing through the largest possible subset of points in S. The problem amounts to finding the largest co-circular (with given radius r) subset of S. We approach it by viewing each point (θ i , ϕ i ) as a primary point corresponding to a primary circle of radius r. We view (θ, ϕ) as a secondary point corresponding to a secondary circle on which a point (θ i , ϕ i ) lies. We select (θ, ϕ), compatible with the largest possible number of primary points (θ i , ϕ i ). In other words, we select (θ, ϕ), which is the largest intersection of primary circles.
As just presented, the problem and its solution strategy can be regarded as a generalization of the classical Hough transform for circles of known radius in the plane. In principle, one might indeed solve the problem by allocating a memory array on a spherical surface and incrementing memory cells on the primary circles corresponding to the data-set S = {(θ i , ϕ i )} (voting). The memory cell with the largest accumulation will then correspond to (θ, ϕ), which is the largest intersection of primary circles, i.e., the normal direction defining the circle of radius r passing through the largest possible subset of points in S.
In practice, working with spherical memory arrays is highly inconvenient. We therefore carry out the computation using a planar memory array, where the orthogonal planar axes are θ and ϕ. Note, however, that the mapping of the conceptual spherical memory array to a planar array is non-trivial in both theory and practice, as is the drafting of planar maps of planet Earth [19]. As will be seen, this difficulty reveals itself in the context of the parameter-space quantization.
We can summarize these concepts as follows: Given a (unit) sphere and a radius r, Property 1. A primary point (θ i , ϕ i ) on the sphere corresponds to a curve in the (θ, ϕ) parameter plane. The curve can be viewed as the mapping of the primary circle associated with the primary point from the sphere to the (θ, ϕ) plane.

Property 2.
A point in the (θ, ϕ) parameter plane corresponds to a secondary circle of radius r on the sphere.

Property 3.
Primary points lying on the same circle of radius r on the sphere correspond to curves through a common point in the (θ, ϕ) parameter plane.
In the next section, we determine θ as a function of ϕ (or ϕ as a function of θ ). This is the voting pattern associated with a data point (θ i , ϕ i ) ∈ S.

Derivation of the Voting Pattern
Consider a primary point (X i , Y i , Z i ) on a unit sphere. We proceed to express the equation of the corresponding family of primary circles lying on parallel planes, as illustrated in Figure 1 (right). Generally, the equation of a plane in 3D space is of the form Note that (a, b, c) is the normal to the plane, and if it is normalized such that a 2 + b 2 + c 2 = 1, then d is the distance of the plane from the origin.
Using Pythagoras' theorem, for a unit sphere, the relation between d and the radius r of the circle is (see Figure 4): In Equation (1), (a, b, c) is the normal to the plane. Here the normal is defined by the primary point. In terms of its angular coordinates (θ i , ϕ i ), Thus, the equation of the plane containing the primary circle is: The primary circle itself is the intersection of this plane with the unit sphere. In spherical coordinates, a point (x, y, z) on the unit sphere is Substituting in the plane Equation (4) we obtain Rearranging this, we obtain a relation between the angular coordinates θ, ϕ of secondary points on the primary circle.
cos θ cos θ i + sin θ cos ϕ sin θ i cos ϕ i + sin θ sin ϕ sin θ i sin ϕ i = d For a given primary point (θ i , ϕ i ) and a plane distance d, Equation (8) determines the azimuthal angle ϕ of a secondary point in terms of the polar angle θ. The two solutions reflect the fact that a circle of latitude (defined by θ) that intersects a primary circle (excluding the two circles of latitude that osculate the primary circle) intersects the primary circle at two points; see Figures 2 and 3. The dependence on n is due to the periodicity of ϕ. Figure 5 shows the locus of {θ,ϕ} pairs for selected values of θ i , ϕ i , and d.
As shown in Figure 5 (top), for the case of a great circle (d = 0), we can express θ as a single-valued function of ϕ. Substituting d = 0 in Equation (7), Solving for θ, (c) (d)

Domain and Range of the Voting Pattern
We have so far seen that for a given primary point (θ i , ϕ i ), the ϕ coordinate of a secondary point (θ, ϕ) is obtained by substituting the θ coordinate in Equation (8). In this subsection, we proceed to show the dependence of the domain and the range of ϕ as a function of θ, as represented by Equation (8), on the primary point coordinates (θ i , ϕ i ) and the distance d.
In the case of great circles, d = 0, the points (θ, ϕ) and (π − θ, π + ϕ) (red points in Figure 6) define the same plane. In other words, each great circle (red) is represented by two spherical points, one at each hemisphere. Consider the subset of spherical points in the range θ ∈ [0, π) and ϕ ∈ [0, π). There is a bijective transformation from this subset to the set of great circles on the unit sphere. To conclude, each spherical point with θ ∈ [0, π) and ϕ ∈ [0, π) uniquely defines a great circle. Returning to the general case, for a given primary point (θ i , ϕ i ), the spherical points (θ, ϕ) that satisfy Equation (8) represent the secondary circles on which the primary point lies. We are interested in secondary points with ϕ ∈ [0, 2π), so n is selected such that Given a primary point and d, the domain of Equation (8) consists of θ coordinates of the secondary points. The θ value of the secondary points are such that the argument of the inverse cosine function satisfies Denote by θ I,I I lim the limiting values of θ, i.e., the values corresponding to the two circles of latitude osculating the primary circle: We choose n such that θ I,I I lim ∈ [0, π). Therefore, given a primary point and a distance d, the θ coordinate of any point on the secondary circle lies between θ I lim ∈ [0, π) and θ I I lim ∈ [0, π). Note that the largest difference between θ i (of the primary point) and θ of a secondary point is obtained for any of the limiting values θ = θ I,I I lim . The difference is the angle between the radius vectors pointing to the primary point and to either of the two points of osculation, and this angle is equal to cos −1 d.

Sphere of Radius R
The result expressed by Equations (8) and (10) can be easily generalized from the unit sphere to a sphere of radius R. The vector representing a point on the sphere (Equation (5)) is multiplied by R. Substituting in Equation (4), we obtain where, generalizing Equation (2), d is now related to the radius of the circle by d = So, technically, an algorithm to search for circles of radius r on a unit sphere can be readily applied to spheres of radius R by normalizing the circle radius r by R.

Algorithm for Great-Circle Detection
In this section, we present an algorithm for finding great circles on a sphere. More accurately, given a set S = {(θ i , ϕ i )} of N co-spherical points, we find the great circle that passes through the largest subset of S. Specifically, the (secondary) great circle passing through the largest possible subset of (primary) points is defined by the (secondary) point (ϕ max , θ max ). The algorithm belongs to the Hough transform family, since it is based on voting in a quantized parameter space.
The parameter plane is (ϕ, θ) is limited to the rectangle ϕ ∈ [0, π) θ ∈ [0, π) and tessellated by rectangular cells. Note that, in the case of great circles, Equation (10) specifies θ as a function of ϕ, hence the parameterization is expressed as (ϕ, θ). In the general case, where Equation (8) determines ϕ as a function of θ, the parametrization will be written as (θ, ϕ). Each cell represents a subset of (secondary) spherical points, and is of the form is the center of the cell. In common Hough algorithms, the cells are of uniform shape and size, their centers form a set of rectangular grid points, and each cell is represented by an accumulator M(i, j) in a memory array, referred to as the accumulator array.
For each (primary) point in the data-set, we compute θ as a function of ϕ (Equation (10)) and increment the accumulators M(i, j) corresponding to cells along the θ(ϕ) curve. The accumulation stage of the algorithm can be visualized as drawing the discretized curves θ(ϕ) in the (ϕ, θ) parameter plane for all primary points. Eventually, the indices (i max , j max ) of the accumulator with the maximal reading represent the parameters (ϕ max , θ max ) of the great circle. Rather than determining all the cells that the curve θ(ϕ) passes through, the common Hough transform practice is to approximate the process by sampling the argument (ϕ) and quantizing the function (θ). This leads in our case to Algorithm 1: Initialize the matrix (accumulator array) M with zeros. For each primary point 1 to N For each ϕ ∈ [0, π) step ∆ϕ Calculate θ(ϕ) by Equation (10). Round each θ(ϕ) to the nearest integer multiple of ∆θ. Increment the accumulator of M corresponding to (ϕ, θ). Find ϕ max and θ max corresponding to the entry with the largest accumulation in M.
The computational complexity of the algorithm is linear in the number of primary points N. With rectangular tessellation of the parameter plane, the computational load also depends on the number of discrete ϕ values, N ϕ = π/∆ϕ, and on the number of discrete θ values, N θ = π/∆θ. Specifically, the computational complexity of the voting stage is O(N · N ϕ ) and that of the search stage is O(N ϕ · N θ ).
Note that the approximation, sampling θ and quantizing ϕ rather than determining the cells that the curve θ(ϕ) passes through, leads to a pitfall. Since the magnitude of the slope of θ(ϕ) can be large, the discretized θ(ϕ) curves may not be digitally connected [20]. Thus, they may not intersect in the digital domain even though they do intersect in the continuous domain. This hazard may not be apparent in cases where N is large and intersections are dense, but may manifest itself in cases where N is small. This may then lead to peak-spreading in the parameter plane, and consequently to misdetection and poor localization of peaks. In contrast, if the approximation is discarded and the cells intersected by the curve are incremented, the discretization of the curve amounts to the classical square quantization scheme [21], and the discretized curve is digitally connected.

Algorithm for General (Radius r) Circle Detection on a Sphere
We now consider the more general problem-detecting circles of any given radius r on the sphere. Here, the given circle radius may not coincide with the radius of the sphere; hence, the circles to be detected are not necessarily great circles. Formally, given a set S = {(θ i , ϕ i )} of co-spherical points and a circle radius r, we find the circle of radius r passing through the largest subset of S. In this case, the parameter plane is limited to a larger rectangle θ ∈ [0, π) ϕ ∈ [0, 2π). We compute ϕ I and ϕ I I as a function of θ for each primary point using Equation (8), and increment the accumulators corresponding to cells intersected by the ϕ I,I I (θ) curves. Approximating the process by sampling the argument θ and quantizing the functions ϕ I,I I leads to Algorithm 2: Algorithm 2: General (any given radius r) circle detection on a sphere Initialize the matrix (accumulator array) M with zeros. Normalize the radius r by the sphere radius R. Calculate d by Equation (2). For each primary point 1 to N For each θ ∈ [0, π) step ∆θ If θ satisfies Equation (11) then Calculate ϕ I (θ) and ϕ I I (θ) by Equation 8. Round ϕ I,I I (θ) ∈ [0, 2π) to the nearest integer multiples of ∆ϕ. Increment the accumulators of M corresponding to (θ, ϕ I,I I ). Find θ max and ϕ max corresponding to the entry with the largest accumulation in M.
Here the computational complexity of the voting stage is O(N · N θ ) and that of the search stage is again O(N θ · N ϕ ), where in this case N θ = 2π/∆θ. The accumulation stage of Algorithm 2 can be visualized as drawing the discretized ϕ I,I I (θ) curves in the (θ, ϕ) parameter plane for all primary points. As discussed in Section 4, care should again be taken when considering the use of the voting approximation (sampling the argument θ and quantizing the functions ϕ I,I I rather than determining the cells that the curves pass through).

Preliminaries and Motivation
In Hough transform algorithms [2], a data (image) point is mapped into a space of parameters for a class of geometric primitives (such as straight lines). The parameter space is quantized into cells and represented by an array of accumulators. The mapping is carried out by incrementation of the relevant accumulators (voting). Once all data points have voted, a search for the maximum in the accumulator array reveals the parameters of the geometric primitive instance that are best supported by the data.
Parameter space quantization is an essential element of the Hough transform. On the one hand, it determines the resolution of the output parameters. On the other hand, it reflects the tolerance of the algorithm to location errors in the data. Thus, coarse quantization leads to poor output resolution, but quantization that is too fine may lead, in the presence of data location errors, to peak-spreading in the accumulator array and consequent detection errors.
In the Hough transform for straight lines using the normal parameterization, uniform quantization of the (ρ, θ) parameter space into cells of equal size implies an equal (translation-and rotation-invariant) measure of the infinite set of straight lines represented by each cell [2,22,23]. In the proposed algorithms for great-and small-circle detection on a sphere, the parameter space is (in principle) an isomorphic spherical parameter space. This is analogous to the isomorphism between the image space and the parameter space in the Hough transform for circles of known radius [2]. Note that the area of a cell in the spherical parameter space is, due to rotational symmetry, a rotation-invariant measure of the infinite set of the spherical circles represented by the cell. We therefore wish to quantizate the spherical parameter space into cells of similar area.

Towards Uniform Spherical Quantization
Working with spherical memory arrays is currently impractical. We therefore carry out the computation using a planar memory array, where the orthogonal planar axes are θ and ϕ. Nevertheless, mapping the conceptual spherical array to a planar array is problematic [19]. Specifically, in the context of parameter-space quantization, uniform (rectangular) quantization in the plane, via uniform quantization of the individual angular coordinates θ and ϕ, corresponds to cells of non-uniform area on the sphere. Assuming small quantiza-tion steps ∆θ and ∆ϕ in the plane, the spherical surface area of the corresponding cell at θ and ϕ is approximately ∆S ≈ ∆θ∆ϕ sin θ (13) where ∆S is largest at the equator, where θ = π/2, and equal to ∆θ∆ϕ. For non unit spheres, ∆S is scaled by R 2 where R is the radius. Cells of non-uniform area imply biased voting. One way to handle bias is by normalizing each accumulator count by the area of the corresponding cell. Note, however, that the normalization is associated with singularity at the poles. Lutton et al. [13] suggested using almost-equal-sized cell quantization, letting ∆ϕ depend on θ; see Figure 7. In our case, almost-equal-sized cell quantization is obtained by letting where the layer number n is obtained by rounding θ/∆θ to the nearest integer, θ n = n∆θ, and ∆S is the almost uniform cell size (spherical surface area). When voting into the (non-uniform) planar array corresponding to almost-equal-sized cells on the sphere, we again need to decide whether to increment all cells through which the continuous voting curve passes, or to employ the approximation-sampling θ and quantizing ϕ in the context of general circles. The two options are illustrated in Figure 8. Incrementing all cells through which the continuous voting curve passes means voting for both the blue and green cells. In contrast, sampling θ and quantizing ϕ generates (the centers of) the green cells alone.
In our analysis and experiments, the first option is followed, i.e., the approximation is not employed and all cells through which the continuous voting curve passes are incremented. Technically, referring to Figure 9, at layer θ n we increment the accumulator(s) between A and B inclusively.

The Distance of Primary Points from the Common Secondary Circle
Consider the cell centered at (θ max , ϕ max ) that received the largest number of votes from primary points. In other words, the cell centered at (θ max , ϕ max ) is the one intersected by the largest number of primary circles centered at primary points. Due to primary points' location errors, and due to the finite (i.e., not infinitesimal) cell size, the primary circles intersecting the cell do not usually intersect at a single point within the cell themselves. Thus, typically, the primary points that have voted for the cell are only roughly co-circular. The common secondary circle passing near these primary points is defined by the approximate secondary point (θ max , ϕ max ), i.e., by the center of the cell.
What is the maximum distance of the primary points contributing to the cell from the secondary circle defined by (θ max , ϕ max )? Furthermore, how does this depend on the finite cell size? This distance determines, on the one hand, the resolution of the algorithm and, on the other hand, its tolerance to noise (errors) in the location of the data (primary) points.
To answer these questions, we calculate the distance between the common secondary circle (the black circle in Figure 10) and the circles defined by the four corners of the cell. The coordinates of the four corners are where ∆ϕ k is the layer-dependent quantization step (Equation (14)) at θ k = θ max , and the corresponding circles are shown blue in Figure 10. Given one of the (corner) circles defined by a corner point (the blue circle in Figure 11), the largest distance from the common secondary circle is achieved by two critical points (red points in Figure 11) on the corner circle. One critical point is closer than the common secondary circle to the cell center, whereas the other critical point is more distant than the common secondary circle from the cell center. Figure 11. A secondary circle (black) and a corner circle (blue). The maximum distance of a point on the corner circle to the secondary circle is achieved by the two critical points (red).
Consider any of the two critical points and its respective closest point on the secondary circle. Viewing the critical point and its closest point as (spherical) radius vectors, let γ denote the angle between them. Let a denote the radius vector corresponding to the secondary point (θ max , ϕ max ), and let b denote the radius vector associated with the corner point. Referring to Figure 12 (left), we observe that, since a is normal to the secondary circle and b is normal to the corner circle, γ is also the angle between a and b. Assuming a unit sphere, The angle γ can be viewed as an angular distance measure between the cell center (θ max , ϕ max ) and one of its corners. With almost-equal-sized cell quantization, γ is similar between cells and between corner points of a particular cell. Cells have four corner points. Each corner point is associated with two critical points, one closer to and one more distant from the cell center. The eight critical points can be divided into two subsets, each with four critical points. One subset contains the four critical points, shown red in Figure 13 (left), closer to the cell center, whereas the other subset contains the four critical points more distant from the cell center, shown in red in Figure 13 (right). The angular distance γ between any of the eight critical points and its closest point on the common secondary circle is similar. This means that the four critical points in each of the two subsets are nearly co-circular. The two circles, shown in red in Figure 13, each defined by the four critical points in each of the two subsets, are referred to as lower and higher critical circles. They are on planes parallel to each other and also to the secondary circle plane, where the lower critical circle is closer to the origin and the higher is more distant from the origin. Specifically, their distances from the origin are The spherical radius vector defined by the angular coordinates (θ max , ϕ max ) of the secondary point passes through the centers of the secondary circle and the two critical circles, and is perpendicular to (the planes containing) them; see Figure 12 (right). Referring to Figure 14, let P be a primary point of which the primary circle (blue point and blue circle) votes for a cell centered at (θ max , ϕ max ). In other words, the primary circle defined by the primary point P intersects the cell (θ max , ϕ max ). This implies that the coordinates of any point on the primary circle within the cell, i.e., any secondary point S in the cell (green point), are bounded between θ = (θ max − ∆θ/2, θ max + ∆θ/2] and ϕ = (ϕ max − ∆ϕ k /2, ϕ max + ∆ϕ k /2]. Consider the common secondary circle defined by the cell center (black circle) and the nearby secondary circle associated with any other secondary point within the cell (green circle). The nearby secondary circle passes through the primary point P, whereas the common secondary circle generally passes just near P.
The angle between the radius-vector pointing at the cell center and the radius vector pointing at the nearby secondary point is less than or equal to γ, and equality to γ is achieved when the nearby secondary point coincides with one of the corner points of the cell. The radius vectors are normals of the planes containing these circles. So, the angle between the plane containing the common secondary circle and the plane containing the nearby secondary circle is less than γ. The critical circles are defined such that the angle between the radius vector pointing to a point on the critical circle and the radius vector pointing to its closest point on the common secondary circle is γ. So, the nearby secondary circle lies on a spherical segment (see Figure 15) containing the common secondary circle and delimited by the two critical circles (red circles in Figures 14 and 15). In other words, the angle between the radius vector pointing to the primary point P and the radius vector pointing to its closest point on the common secondary circle is less than γ. Hence, the orthodromic distance (great circle distance) of the primary point P to each point on the common secondary circle is upper-bounded by R · γ, where R is the radius of the sphere.
As shown in Appendix A, γ can be readily expressed in terms of the almost-equal-sized cellquantization parameters, ∆S and ∆θ. For a unit sphere In this case γ is approximately half of the diagonal of the almost-equal-sized cell. For a sphere of radius R, ∆S in Equation (17) should be scaled down by R 2 .
To conclude, the primary point of which the primary circle votes for a cell centered at (θ max , ϕ max ) is located on the spherical segment defined by the cell center. The orthodromic distance between the primary point and the common secondary circle (defined by the cell center) is upper-bounded by R · γ, where R is the sphere radius and γ is the central angle between the radius vector (θ max , ϕ max ) and one of the radius vectors (θ max ± ∆θ/2 , ϕ max ± ∆ϕ k /2) pointing at the cell corners, expressible in terms of the almost-equal-sized cell area.

Improved Algorithm for General (Radius r) Circle Detection on a Sphere
Consider the problem of general (any given radius r) circle detection on a sphere, as presented in Section 5. We now apply the almost-equal-sized cell quantization scheme, and vote for all cells intersected by the voting curve. For each primary point in the dataset, the algorithm first calculates the limiting values of θ, and loops over all multiples of ∆θ between the limiting values θ I,I I lim . For each θ, it computes the ϕ ∈ [0, 2π) coordinates of the points A and B by substituting θ ± ∆θ/2 in Equation (8). It then increments all the accumulators which correspond to the discrete points with θ and ϕ ∈ [ϕ A , ϕ B ]. Finally, the accumulator (θ max , ϕ max ) with the maximal reading indicates the spherical circle of radius r passing through the largest subset of (primary) points in the data-set. This leads to Algorithm 3:

Algorithm 3: Improved general circle detection on a sphere
Initialize the accumulator array M with zeros. Normalize the radius r by the sphere radius R. Calculate d by Equation (2). For each primary point 1 to N Calculate θ I,I I lim ∈ [0, π) by Equation (12). For each θ = i · ∆θ (i ∈ Z) from min{θ I,I I lim } until max{θ I,I I lim }: For both ϕ I and ϕ I I in Equation (8): 1. Calculate ∆ϕ i by Equation (14). 2. Calculate ϕ I A and ϕ I I B by substituting θ ± ∆θ 2 in Equation (8) . 3. Choose n such that ϕ A = ϕ I,I I A ∈ [0, 2π) and ϕ B = ϕ I,I I B ∈ [0, 2π) 4. Round ϕ A and ϕ B to the nearest integer multiples of ∆ϕ i . 5. Increment the accumulators from to (ϕ A , θ) to (ϕ B , θ) Find θ max and ϕ max corresponding to the entry with the largest accumulation in M.
Note that the accumulator array M in this algorithm is no longer a rectangular matrix. The azimuthal step between adjacent accumulators in the θ i layer is θ-dependent and equals ∆ϕ i . Therefore, the number of accumulators in each θ i is different. Figure 16 (left) shows the accumulator array in the θ − ϕ plane. In Figure 16 (right), the accumulators are represented by identical rectangles, where the i axis represents the nearest integer multiple of ∆θ and the j axis represents the nearest integer multiple of ∆ϕ i .

Great Circle Examples
What is the great circle on planet Earth that passes through the largest number of airports? Furthermore, what is the great circle that passes through the largest number of cities? We answer these questions using the proposed algorithms, relying on city [24] and airport [25] databases.

Uniform Quantization in the Plane (Algorithm 1) Examples
(1) We execute Algorithm 1, taking the world's major airports (red dots in Figure 17) as input primary points (a total of 617 points). The parameter space is discretized with ∆ϕ = ∆θ = 0.5 • . The great circle that passes through the maximum number of airports (blue circle in Figure 17) is on the great circle plane with normal θ max = 55.25 • , ϕ max = 151.25 • and visits 29 airports, listed in Appendix B. Note that here and in the following, the number of digits after the decimal point in θ max and ϕ max relates to the location of the cell center. Obviously, the accuracy of the detected circle parameters follows from the cell size, i.e., from ∆θ and ∆ϕ.In order to find the circle passing through the largest number of remaining airports (excluding the 29 airports associated with the first maximum), we identify all primary points of which the voting contributed to the first maximum and remove their votes (unvote [5][6][7]).
The new maximum represents the great circle passing through the largest subset of remaining (primary) points in the data-set. It lies on the great circle plane with normal θ max 2 = 54.75 • , ϕ max 2 = 157.75 • and visits 28 different airports. (2) We again execute Algorithm 1, this time taking 12960 world cities (red dots in Figure 18) as input primary points. The parameter space is discretized with ∆ϕ = ∆θ = 0.25 • . The great circle (blue circle in Figure 18) that passes through the maximum number of cities is on the great circle plane with normal θ max = 53.625 • , ϕ max = 156.375 • and visits 397 different cities. The great circle that passes through the maximum number of remaining cities (i.e., the maximum after unvoting) is on the great circle plane with normal θ max 2 = 72.875 • , ϕ max 2 = 18.375 • and visits 321 cities.
We execute the algorithm in order to find the great circle that passes through a specific airport and the maximum number of other airports. Instead of searching for the maximum value in all the accumulators, we search only in accumulators along the θ(ϕ) curve corresponding to the specific airport. This reduces the computation time, since we search in N ϕ instead of N ϕ · N θ accumulators.
Taking Cape Town International Airport as the specific airport, the great circle that passes through Cape Town International Airport and through the maximum number of other airports is defined by the normal direction θ max = 84.25 • , ϕ max = 104.75 • (blue circle in Figure 19) and visits 16 different airports, listed in Appendix C. In this case, the discretization of the parameter space is ∆ϕ = ∆θ = 0.5 • . The great circle that passes through Cape Town International Airport and through the maximum number of remaining airports (the maximum after unvoting, i.e., excluding the airports associated with the first maximum) is on the great circle plane with normal θ max 2 = 37.75 • , ϕ max 2 = 48.75 • and visits 13 different airports.

Almost-Equal-Sized Cell Quantization Examples
We now address the same great-circle detection tasks using almost-equal-sized cell quantization. To achieve this, we apply Algorithm 3 (general circle detection) with r = R hence d = 0. (1) We execute Algorithm 3 with d = 0, taking the world's major airports as primary input points. We set ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129,600 [Rad 2 ], which yields accuracy similar to the worst-case accuracy (at θ = π/2) in the above uniform quantization example. The great circle (the blue circle in Figure 20) that passes through the maximum number of airports is on the great circle plane with normal θ max = 53.75 • , ϕ max = 156.4544 • . It visits 30 different airports, listed in Appendix D. The great circle that passes through the largest number of remaining airports (the maximum after unvoting) is on the great circle plane with θ max 2 = 124.25 • , ϕ max 2 = 331.8655 • and visits 27 airports. (2) We execute Algorithm 3 with d = 0, taking 12,960 world cities (red dots in Figure 18) as input primary points. We set ∆θ = 0.25 • and ∆S = π 720 · π 720 = π 2 518,400 [Rad 2 ]. The great circle (the blue circle in Figure 21) that passes through the maximum number of cities is on the great circle plane with normal θ max = 53.625 • , ϕ max = 156.3934 • and visits 425 cities. The great circle that passes through the maximum number of remaining cities (the maximum after unvoting) is on the great circle plane with normal θ max 2 = 72.375 • , ϕ max 2 = 18.7609 • and visits 335 cities. (3) We execute Algorithm 3 with d = 0 in order to find the great circle that passes through a specific airport and through the maximum number of other airports. Instead of searching for the maximum value in all the accumulators, we search only in accumulators along the θ(ϕ) curve corresponding to the specific airport. We again take Cape Town International Airport as the specific airport, now with ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129,600 [Rad 2 ]. The great circle (the blue circle in Figure 22) that passes through Cape Town International Airport and through the maximum number of other airports is defined by the normal direction θ max = 37.75 • , ϕ max = 49.3878 • , and visits 15 different airports listed in Appendix E. The great circle that passes through the Cape Town International Airport and through the maximum number of remaining airports (the maximum after unvoting, i.e., excluding the airports associated with the first maximum) is on the great circle plane with normal θ max 2 = 84.25 • , ϕ max 2 = 104.8324 • and visits 14 different airports.   The number of data points (airports or cities) associated with the great circle detected depends on the size of the parameter-space quantization cells, i.e., on the quantization level.
For the examples in this subsection (almost-equal-sized cell quantization), the dependence is presented in Appendix F.
The differences between the results obtained with uniform quantization in the plane and the those achieved using almost-equal-sized cell quantization are due to the non-equal cell sizes on the sphere yielded by uniform quantization in the plane. Referring to Figure 23, with uniform quantization in the plane (Figure 23 (left)), cells that are close to the equator are larger than cells close to the poles. In contrast, with almost-equal-sized cell quantization (Figure 23 (right)), all cells have approximately the same size. In the above experiments, we chose ∆S such that the smallest ∆ϕ k in the almost-equal-sized quantization scheme was equal to ∆ϕ used in uniform quantization in the plane. Thus, with almost-equal-sized quantization, the size of the cell on the sphere is larger or equal to that obtained using uniform quantization in the plane. In other words, given cell coordinates θ max and ϕ max on the sphere, the cell at these coordinates using almost-equal-sized cell quantization is larger or equal in area to the cell at the same coordinates using uniform quantization in the plane. Thus, although the great circle on planet Earth that passes through the largest number of cities is about θ max = 53.625 • , ϕ max = 156.125 • using both quantization schemes, with uniform quantization in the plane it is associated with 397 cities, whereas with almost-equal-sized cell quantization the number of cities is 425.

General (Small) Circle Examples
In the previous section we found great circles on planet Earth passing through the largest possible number of airports or cities. In this section, we detect small circles of a given radius r that visit as many airports or cities as possible. We use algorithm 3 (almostequal-sized cell quantization). We normalize the radius of the sphere (planet earth) to R = 1; hence, 0 < r < 1. (1) We execute algorithm 3 with r = 0.25 (d ≈ 0.968), taking the world's largest airports as input primary points. We set ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129600 [Rad 2 ]. The circle of radius r = 0.25 that passes through the maximum number of airports (the blue circle in Figure 24) is on the circle plane with normal θ max = 47.75 • , ϕ max = 256.998 • and visits 20 large airports. The circle of radius r = 0.25 that passes through the largest number of remaining airports (red circle in Figure 24, corresponding to the maximum after unvoting) is on the circle plane with normal θ max 2 = 40.75 • , ϕ max 2 = 269.2340 • and visits 19 different airports. (2) We now execute algorithm 3 with r = 0.5 (d ≈ 0.866), again taking the world's largest airports as input primary points. We set ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129,600 [Rad 2 ]. The circle of radius r = 0.5 that passes through the maximum number of airports (the blue circle in Figure 25) is on the circle plane with normal θ max = 27.25 • , ϕ max = 313.6364 • and visits 20 large airports. The circle of radius r = 0.5 that passes through the largest number of remaining airports (red circle in Figure 25, corresponding to the maximum after unvoting) is on the circle plane with normal θ max 2 = 45.25 • , ϕ max 2 = 313.8552 • and visits 19 different airports. (3) We execute algorithm 3 with r = 0.125 (d ≈ 0.992), this time taking the input primary points from the city database. We set ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129,600 [Rad 2 ]. The circle of radius r = 0.125 that passes through the maximum number of cities (the blue circle in Figure 26) is on the circle plane with normal θ max = 43.7500 • , ϕ max = 280.1205 • and visits 616 cities. The circle of radius r = 0.125 that passes through the largest number of remaining cities (the black circle in Figure 26, corresponding to the maximum after unvoting) is on the circle plane with normal θ max 2 = 52.7500 • , ϕ max 2 = 270.4712 • and visits 386 cities.
We execute algorithm 3, now with r = 0.5 (d ≈ 0.866), taking the input primary points from the city database. We set ∆θ = 0.5 • and ∆S = π 360 · π 360 = π 2 129,600 [Rad 2 ]. The circle of radius r = 0.5 that passes through the maximum number of cities (the blue circle in Figure 27) is on the circle plane with normal θ max = 26.7500 • , ϕ max = 251.6667 • and visits 568 cities. The circle of radius r = 0.5 that passes through the largest number of remaining cities (the black circle in Figure 26, corresponding to the maximum after unvoting) is on the circle plane with normal θ max 2 = 72.2500 • , ϕ max 2 = 251.6327 • and visits 523 cities. The experimental results in Sections 7 and 8 were obtained using Matlab on a low-end personal computer with i5-8265U 1.6GHz CPU and 8.00 GB RAM. The Matlab computing time for the various experiments is summarized in Table 1. As expected, computing time was roughly proportional to the number of data points, and increased as the parameter space quantization was refined.

Conclusions
In this paper we present the first comprehensive solution to the problem of detecting circles, great and small, in a spherical set of points. The suggested approach follows the Hough transform methodology and addresses the fundamental issues associated with Hough algorithms, including parameterization, parameter-space quantization, and analysis of the quantization-induced error. The time-complexity of the proposed algorithms is linear in the number of data-points. The required memory size is simply the number of cells in the accumulator array, which is bounded and two-dimensional in the case of great circles and in the case of small circles of known radius.
Potential applications for this research arise in cases where the data are naturally spherical and where circular features need to be detected. The planetary and geophysical sciences provide numerous examples, including crater and volcano detection. Computer vision applications arise in omnidirectional image analysis, including fisheye image analysis, where spherical image representations are ubiquitous.
The proposed method can be readily extended to the detection of circles of unknown radius in a spherical set of points. The additional unknown can be accommodated either by sequentially applying the known-radius algorithm with different radii, or by adding a dimension representing the unknown radius to the accumulator array.

Appendix A. Expressing the Angle γ in Terms of ∆S and ∆θ
In this appendix we express the angle γ between the radius vector pointing at the cell center (θ max , ϕ max ) and that pointing to any of its corners, such as (θ max + ∆θ/2 , ϕ max + ∆ϕ k /2).
Assuming a unit sphere, the chord length between the two vector tips is Applying the first-order Taylor series approximation to sin (θ + ∆θ 2 ) and cos (ϕ + ∆ϕ k 2 ), The third terms in ∆x and ∆y are negligible (second-order) compared to the other (first-order) terms. Substituting Equation (14)