java - Android Navigation - Finding line perpendicular to a line drawn through two locations -


i have 2 location specified in latitude , longitude (a , b). between these location line (green). @ third location (me). how determine how far away line , in direction closest point (the gray line)?

i'm looking heading in degrees , distance in meters. if can find location @ gray line meets green line can use android location built in functions calculate distance , heading.

does know given lat/long locations of a, b , me how solve above problem?

bear in mind 'me' not know whether he's in first or second situation , navigation problem.

also appreciate if bear in mind i'm crap @ maths , answer talking 15 year old.

also, i've worked out example hand using google earth. given:

double alat = 51.44376; double alng = -2.86525;  double blat = 51.43574; double blng = -2.87026;  double melat = 51.4391; double melng = -2.86437;  answer should be: distance closest point on line (aprox): 235 meters heading closest point on line (aprox): 109 degrees 

as always, help,

adam

enter image description here


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -