Jim Wilson wrote:
 > Is there a simgear or plib function that I can use to get the angle
 > between two locations?

I doubt there's explicit API support anywhere, but it's pretty easy to
do by hand.  Just exploit the fact that the dot product of two unit
vectors is the cosine of the angle between them:

   // Needless to say, from memory and untested!
   sgNormalizeVec3(v1);
   sgNormalizeVec3(v2);
   float angle = arccos(sgScalarProductVec3(v1, v2));

The eager optimizer (Norman :) might note that you could shave a few
cycles here by doing the dot product first, and then doing the scaling
together to eliminate a division an a sqrt.

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
  - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to