0
$\begingroup$

The Qibla Compass can give the direction towards "some points on earth" other than north pole, eg : Mecca.

Wikipedia first paragraph, last two lines :

To determine the proper direction, one has to know with some precision both the longitude and latitude of "one's own location" and "those of Mecca, or the city toward which one must face". Once that is determined, the values are applied to a spherical triangle, and the angle from the local meridian to the required direction of Mecca can be determined.


After knowing the :

• longitude and latitude of "one's own location",

• longitude and latitude of "the city toward which one is seeking direction"

Next :

the values are applied to a spherical triangle, and the angle from the local meridian to the required direction of "the city toward which one is seeking direction" can be determined.

The above paragraph doesn't make sense to me, probably because I am a beginner on doing calculation on the surface of sphere.

How shall I get a direction at a point on the surface of earth other than north pole, using a magnetic compass.

The answerer may show me some in between steps. I will try to figure out the rest by myself.

$\endgroup$
12
  • $\begingroup$ May I know the reason for downvote? Is this question not appropriate over here.... Seriously I couldn't find any online articles. Neither could CHAT GPT or BARD help me.... $\endgroup$
    – lorilori
    Commented Oct 12, 2023 at 17:05
  • $\begingroup$ It makes little sense to me. Any pair of points on the sphere (surface of the earth) — unless they are antipodal points — determines a unique great circle (“line”) joining them. You need the compass heading of that great circle. $\endgroup$ Commented Oct 12, 2023 at 17:08
  • $\begingroup$ Regarding downvotes, requests for elaborate explanations with little indication of your own attempts at solving the problem do attract downvotes on this site. $\endgroup$
    – Lee Mosher
    Commented Oct 12, 2023 at 17:17
  • $\begingroup$ APOLOGIES...... I am a totally new beginner on doing calculation on the surface of sphere..... Wikipedia says what is written in my second last paragraph...... It makes no sense to me, either.... probably because I am beginner on this issue, i.e. doing calculation on the surface of sphere..... $\endgroup$
    – lorilori
    Commented Oct 12, 2023 at 17:18
  • $\begingroup$ What am I supposed to do ? To get a direction at a point on the surface of earth other than north pole....... using a magnetic compass..... $\endgroup$
    – lorilori
    Commented Oct 12, 2023 at 17:20

2 Answers 2

1
$\begingroup$

Let the radius of Earth (assumed perfectly spherical) be $r_E$. Attach a coordinate frame to Earth, with its center at the center of Earth, and its $z$ axis passing through the two poles of Earth. And let the $x$ axis pass through the equator at Greenwich longitude. In this coordinate frame the coordinates of points on the surface of Earth are given by

$ P = r_E ( \cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta ) $

where $\theta$ is the Latitude angle (positive in the northern hemisphere, and negative in the southern hemisphere), and $\phi$ is the Longitude (positive east of Greenwich and negative west of it).

Now suppose we have two points $A$ and $B$ on the surface of Earth whose Latitudes and Longitudes are known, then we can compute their Cartesian coordinates from the above formula. The normal vector to the great circle connecting $A$ with $B$ is along the unit vector

$ U = \dfrac{A \times B}{\| A \times B \|} $

Orthogonalizing the vectors $A$ and $B$, by taking $A$ as a reference, then the orthogonal vector to $A$ lying on this great circle is given by

$ C = U \times A $

Now we can express the parametric equation of the great circle as

$ P(t) = A \cos t + C \sin t $

Note that $P(0) = A $

The tangent vector to the great circle $P(t)$ at $A$ is given by $P'(0)$

$P'(t) = - A \sin t + C \cos t $

Therefore

$P'(0) = C $

To find our directions at point $A$ to point in the direction of $C$, we have to build a local coordinate system as follows

The local North unit vector is given by

$ N = \dfrac{ \partial (\cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta )}{\partial \theta } = ( -\sin \theta \cos \phi , -\sin \theta \sin \phi, \cos \theta ) $

The local East unit vector is given by

$ E = (- \sin \phi , \cos \phi , 0 ) $

And the radial unit vector is

$ V = E \times N = ( \cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta) $

Define the rotation matrix corresponding to this local frame as R

$ R = [E , N , V ] $

Then the local unit direction in the basis $R$ is

$ C' = \dfrac{1}{r_E} R^T C $

The $z$ component of $C'$ is zero. And the first and second coordinates of $C'$ determine the components of this unit vector along the East and North directions respectively. The angle $\psi$ from the North (the bearing) is

$ \psi = ATAN2( C'_y , C'_x) $

Example: Let $A$ represent Ottawa, Canada. The latitude is $45.424721^\circ$, and the longitude is $-75.695^\circ $

And let $B$ represent Mecca, Saudi Arabia. The latitude is $21.426388^\circ$ and the longitude is $39.82555^\circ$

With these values the bearing is calculated as

$ \psi = 57.1667^\circ $ (Clock wise from local North).

The following program summarizes these calculations outlined above.

Public Sub mecca()

' rE is kept untouched
Dim a(3), b(3), u(3), c(3), cp(3) As Double
Dim n(3), e(3), v(3) As Double
Dim r(3, 3), rt(3, 3) As Double

p = WorksheetFunction.Pi()

th1 = 45.424721 * p / 180
phi1 = -75.695 * p / 180

th2 = 21.426388 * p / 180
phi2 = 39.82555 * p / 180

' calculate A and B

a(1) = Cos(th1) * Cos(phi1)
a(2) = Cos(th1) * Sin(phi1)
a(3) = Sin(th1)

b(1) = Cos(th2) * Cos(phi2)
b(2) = Cos(th2) * Sin(phi2)
b(3) = Sin(th2)

Call cross(a, b, u)

Call normalize1(u)

Call cross(u, a, c)

For i = 1 To 3
    v(i) = a(i)
Next i

e(1) = -Sin(phi1)
e(2) = Cos(phi1)
e(3) = 0

n(1) = -Sin(th1) * Cos(phi1)
n(2) = -Sin(th1) * Sin(phi1)
n(3) = Cos(th1)

For i = 1 To 3
r(i, 1) = e(i)
r(i, 2) = n(i)
r(i, 3) = v(i)
Next i

Call transpose(3, 3, r, rt)

Call multiplyv(3, 3, rt, c, cp)

psi = WorksheetFunction.Atan2(cp(2), cp(1))

MsgBox (psi * 180 / p)

End Sub
$\endgroup$
1
$\begingroup$

To understand the paragraph you quote from Wikipedia you need to know what various terms, such as "local meridian" and "spherical triangle", are referring to. The local meridian of any given point on the Earth is the line of all points on the Earth having the same longitude as the given point. It's a semicircle whose ends are the true north and south poles, whose centre is the centre of the Earth, and which passes through the given point.

In the figure below, $N$ and $S$ are the true north and south poles of the Earth, and $C$ is its centre, so the line $NCS$ is its axis of rotation. The semicircle $NPAS$ with centre $C$ is the local meridian of the points $P$ and $A$, and the semicircle $NKBS$ with centre $C$ is likewise the local meridian of the points $K$ and $B$. The points $A$ and $B$ are points on the equator and on the same meridians, and hence at the same longitudes, as $P$ and $K$ respectively. The angle $\ \varphi\ $ at $N$ between the meridian arcs $AN$ and $BN$, which is the same as the angle $ACB$ between the lines $AC$ and $BC$, is the difference between the longitude of $K$ and the longitude of $P$. The angle $ \lambda_P\ $ between the lines $AC$ and $PC$ is the latitude of $P$, and the angle $ \lambda_K\ $ between the lines $BC$ and $KC$ is the latitude of $K$.

If the point $P$ were "one's own location" and the point $K$ were the location of "the city toward which one is seeking direction", then the spherical triangle referred to in the Wikipedia article would be the one with vertices $N$, $P$ and $K$, whose "sides" are the circular arcs $PN$, $KN$ and $PK$. This last arc is an arc of the great circle on the Earth's surface whose centre is $C$ and which passes through $P$ and $K$. The direction of the north pole from $P$ is along the meridian arc $PN$, and the direction of $K$ from $P$ is along the great circle arc $PK$. Thus, if $\ \delta\ $ is the angle between the arcs $PN$ and $PK$, then the direction of $K$ from $P$ is east of north by the angle $\ \delta\ $. In the spherical triangle $PNK$ the "lengths" of the arcs $PN$ and $KN$ (i.e. the angles they subtend at the centre of the Earth) are known—they are $\ \frac{\pi}{2}{-}\lambda_P\ $ and $\ \frac{\pi}{2}{-}\lambda_K\ $ (in radians) respectively—, and the angle $\ \varphi\ $ between the arcs $PN$ and $KN$ is known. With the lengths of two sides and the size of the included angle between them known, the length of the third side $PK$ and the sizes of the other two angles $\ NPK=\delta\ $ and $NKP$ can be found from standard formulas, as detailed in Hosam H's answer. enter image description here

If you want to use a magnetic compass to find the direction of $K$, you'll need to take account of the fact that the direction of magnetic north is usually different from that of true north. The difference between them is called magnetic variation (or magnetic declination) and varies from place to place on the surface or the Earth. If the magnetic variation at $P$ were $\ \delta_m\ $, then the direction of $K$ from $P$ would be east of magnetic north by the angle $\ \delta-\delta_m\ .$

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .