Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-19-2009, 02:01 AM   #12 (permalink)
Launch
New Member
 
Join Date: Jun 2009
Posts: 5
Default

I may be wrong but you should be able to use the law of cosines. I drew up a crappy diagram in MS paint...
Yfrog - anglebetween.jpg

Use the north pole, find the distance between the north pole and point A, the north pole and point B, and between A and B. You are trying to find the angle marked by the X, or angle A. I'll call the sides opposite of A, a, and B, b, and the north pole is point C, so the side opposite that is c.

a^2 = b^2 + c^2 - 2bc Cos(A)

so A (the angle X in the diagram) is = arccos ((a^2-b^2-c^2)(-2bc))

And A will give you the bearing from the North, and keep in mind arccos doesn't give you negative angles (only 0 degrees to 180) so you will have to determine (easily) if the person is going west or east. So if you get 90 degrees from this, or pi/2 radians, see if point B is to the east of A or west of A, and if its east of A then the person is going directly east, and vice versa.

Last edited by Launch; 06-19-2009 at 02:04 AM.
Launch is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,745
Threads: 89,201
Posts: 380,567
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Ashleyk27
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:57 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.