# NavList:

## A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

**Re: Position from crossing two circles : was [NAV-L] Reality check**

**From:**Andrés Ruiz

**Date:**2006 Jun 8, 08:48 +0200

Geoge, the method is not impossible for n
observations or running fix.

Mike, here you have the math for a fix from two circles
of position (**COP**)

Enjoy.

**1. Position
from two circles of equal altitude**

The equation of the plane containing a COP in
rectangular coordinates is: ax+by+cz-p = 0

For the two bodies you have two equations, two planes
intersect in a line.

The two possible solutions for the observer’s
position, P and P’, are the intersections of that line with the unit
sphere x2+y2+z2 = 1

the math, (in C++):

/*

File:
fix2circulosAltura.cpp

This file
contains proprietary information of Andrés Ruiz Gonzalez

Open source

Andrés Ruiz.

Copyright (c)
2006

*/

#include
"stdafx.h"

#include <math.h>

#include
"..\LSfix\mathlib.hpp"

double raiz1 = 0;

double raiz2 = 0;

void Ecuacion2grado(
double a, double b, double c )

{

double f = b*b-4.0*a*c;

raiz1 =
(-b+sqrt(f))/2.0/a;

raiz2 =
(-b-sqrt(f))/2.0/a;

}

// Inputs

double GHA1, dec1, HO1;

double GHA2, dec2, HO2;

// Outputs

double B1, L1;

double B2, L2;

void
PosicionPorInterseccion2circulosAltura()

{

double a1 = COS(360.0-GHA1) *
COS(dec1);

double
b1 = SIN(360.0-GHA1) * COS(dec1);

double c1 = SIN(dec1);

double p1 =
COS(90.0-HO1);

double a2 =
COS(360.0-GHA2) * COS(dec2);

double
b2 = SIN(360.0-GHA2) * COS(dec2);

double c2 = SIN(dec2);

double p2 =
COS(90.0-HO2);

double A = a1*b2 -
a2*b1;

double B = b2*c1 -
b1*c2;

double C = b2*p1 -
b1*p2;

double D = a1*c2 -
a2*c1;

double E = b1*c2 -
b2*c1;

double F = c2*p1 -
c1*p2;

double K = F/E;

double J = D/E;

double G = C/B;

double H = A/B;

double alpha =
1.0+J*J+H*H;

double beta =
-2.0*K*J-2.0*G*H;

double gamma =
K*K+G*G-1.0;

Ecuacion2grado(
alpha, beta, gamma );

double x1 = raiz1;

double y1 = K-J*x1;

double
z1 = G-H*x1;

double x2 = raiz2;

double y2 = K-J*x2;

double z2 = G-H*x2;

B1 = ATAN(
z1/sqrt(x1*x1+y1*y1) );

L1 = ATAN( y1/x1 );

B2 = ATAN( z2/sqrt(x2*x2+y2*y2) );

L2 = ATAN( y2/x2 );

}

void
CAstroLSDlg::OnCalcular()

{

UpdateData();

/*

GHA1 = 347.78;

dec1
= -16.72;

HO1 = 19.55;

GHA2 = 334.23;

dec2 = 5.22;

HO2 = 28.5;

*/

GHA1 = 20.06;

dec1 = 16.52;

HO1 = 90-26.87;

GHA2 = 332.71;

dec2 = 28.02;

HO2 = 90-48.02;

PosicionPorInterseccion2circulosAltura();

CString tmp = "";

tmp.Format( "1(%.4lf º, %.4lf
º) 2(%.4lf º, %.4lf º)", B1, L1, B2, L2 );

m_output
= tmp;

UpdateData( FALSE );

}

**2. Position
from n circles of equal altitude**

Here the problem is there are a lot of crossings
between the circles. Metcalf & Metcalf, (On the overdetermined celestial
fix - Refer to the Bibliography section at the link below), developed a method
based on Lagrange Least-Squares minimization of the equation:

S ( Sin Ho – [ sin Dec sin Lat +
cos Dec cos Lat cos(GHA+Lon) ]^{2} )

The result is the MPP(Lat, Lon) for n circles of
position. No initial position is needed. Also support a running fix.

MIKE:

What is the C++ application you refer for calculate and
plot the COP?, where can I found it?

Thanks.

http://www.geocities.com/CapeCanaveral/Runway/3568/index.html

**Andrés**

-----Mensaje original-----

De:

Enviado el: miércoles, 07 de junio de 2006 13:39

Para: NAVIGATION-L{at}LISTSERV.WEBKAHUNA.COM

Asunto: Re: [NAV-L] Position from crossing two circles
: was [NAV-L] Reality check

At 06:10 AM 6/7/2006, George Huxtable wrote:

>I have written a program in bastard-Basic which
runs on my 1980s Casio

>programmable calculator (FX 730P or FX 795P), and
if anyone is

>interested would be happy to send it or post it
up. It would be simple

>to adapt it to another machine. It takes the 6
quantities, dec, GHA,

>and altitude for each of two bodies, and returns
two possible

>positions in terms of lat and long, for the user to
choose the

>appropriate one. It does not require a DR or AP,
and provides an exact

>result without going through an iteration process.

>

>It's not original, in that versions of the method
have been described

>previously beforehand. For example, in an article
by George Bennett in

>the journal "Navigation" (which is, I
think, the American one) Issue

>no. 4, vol 26, winter 1979/80, titled "
General conventions and

>solutions- their use in celestial
navigation", and to the book

>"Practical navigation with your
calculator", by Gerry Keys, (Stanford

>maritime, 1984), section 11.12. The method has
also been described in

>"The K-Z position solution for the double
sight", in European Journal

>of Navigation, vol.1 no, 3, December 2003, pages
43-49, but that

>article was bedevilled by printing errors that
render it more-or-less

>unintelligible, which were corrected in a later
issue. Not to mention

>several serious errors and misunderstandings by
the author, which have

>never been acknowldged or corrected in that
journal.

George:

Do any of these sources spell out the math in detail?
I've searched in

vain for a complete algorithm so a long time ago, I
sat down and worked out

the math. One of the tricky things is determining
what quadrant angles lie

in when doing a inverse trig function. I have a c++
windows application

which will find all the equal altitude circle
intersections for a set of

observations. It also can plot the equal altitude
circles on a world map.

Mike