On Wed, 3 Nov 2004 14:04:05 -0500, Chris Metzler <[EMAIL PROTECTED]> wrote:

> A simple adaptation doesn't really work.  Using the variables as you've
> defined them, and taking theta to be positive for pitched up, write
> Hc = atan2(a, b)
> with
> a = cos(phi)sin(Hm)cos(mu) - sin(phi)cos(theta)sin(mu)
>     - sin(phi)sin(theta)cos(mu)cos(Hm)
> b = cos(theta)cos(Hm)cos(mu) - sin(theta)sin(mu)

Thanks for all the work on that.  I just tried it out, though, and it
gives strange behaviour with negative (left) roll angles, even when
pitch is close to 0.  It's possible that I caused some confusion by
using theta for pitch, when the original equation used it for roll --
here's the original equation from the Web page, translated into our
normal phi/theta/psi variables, mu for magnetic dip, and preserving Hc
for the indicated compass heading:

  Hc = atan2(sin(psi)cos(phi) - tan(mu)sin(phi), cos(psi))

In other words

  a = sin(psi)cos(phi) - tan(mu)sin(phi)
  b = cos(psi)

Your suggested equation, using the same variable names, is

  a = cos(phi)sin(psi)cos(mu) - sin(phi)cos(theta)sin(mu)
        - sin(phi)sin(theta)cos(mu)cos(psi)

  b = cos(theta)cos(psi)cos(mu) - sin(theta)sin(mu)

I'm really bad at this kind of thing, but when I set theta to 0, I end up with

  a = cos(phi)sin(psi)cos(mu) - sin(phi)sin(mu)
  b = cos(psi)cos(mu) 

Does that actually work out to the same thing by messing around with the trig?

Thanks, and all the best,



Flightgear-devel mailing list

Reply via email to