• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1534
  • Last Modified:

opposite of Atan2? in c# or in regular math

I have:

Pa.Lat_origin=Pa.Lat-Pb.Lat;
Pa.Lng_origin=(Pa.Lng-Pb.Lng)*Math.Cos(Pb.Lat*Math.PI/180);
(Math.Atan2(Pa.Lat_origin,Pa.Lng_origin))*180/Math.PI = angle

I want to isolate angle....

Math.Atan2((Pa.Lat-Pb.Lat),((Pa.Lng-Pb.Lng)*Math.Cos(Pb.Lat*Math.PI/180))) = angle*Math.PI/180

How do i do the opposite of Atan2?

Basically this method is the one i use to find an angle....

Now i want to find a point based on an angle.

Thanks

Richard
0
verintsupport
Asked:
verintsupport
  • 4
  • 3
1 Solution
 
ozoCommented:
angle = atan2(y,x)
y = sin(angle)*distance
x = cos(angle)*distance
0
 
verintsupportAuthor Commented:
angle in rad or in degree?

y = sin(angle)*distance
x = cos(angle)*distance
is good in a cartesian plan but in lat longs, i need to modify my long according to the lat

this is what i did when finding the angle.... how do i reverse that?
Pa.Lng_origin=(Pa.Lng-Pb.Lng)*Math.Cos(Pb.Lat*Math.PI/180);


Maybe i'm complicating things to much....
0
 
verintsupportAuthor Commented:
i think i need to isolate Pa.Lat_origin and Pa.Lng_origin to find my answer
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
verintsupportAuthor Commented:
so basically:

if Angle = (Math.Atan2(Pa.Lat_origin,Pa.Lng_origin))*180/Math.PI


Pa.Lat_origin = ?

Pa.Lng_origin = ?
0
 
ozoCommented:
if Angle = (Math.Atan2(Pa.Lat_origin,Pa.Lng_origin))*180/Math.PI
Pa.Lat_origin = distance*sin(Angle*Math.PI/180)
Pa.Lng_origin = distance*cos(Angle*Math.PI/180)
0
 
ozoCommented:
In lat longs, Angle = (Math.Atan2(Pa.Lat_origin,Pa.Lng_origin))*180/Math.PI may not be an appropriate equation, but if that's what Angle is, then
Pa.Lat_origin = distance*sin(Angle*Math.PI/180)
Pa.Lng_origin = distance*cos(Angle*Math.PI/180)
also holds, where
distance = sqrt(Pa.Lat_origin*Pa.Lat_origin+Pa.Lng_origin*Pa.Lng_origin)
0
 
verintsupportAuthor Commented:
ok so i get:

So if the point i'm looking for is Pa then:


(distance*sin(Angle*Math.PI/180))+Pb.Lat = Pa.Lat
(distance*cos(Angle*Math.PI/180))/Math.Cos(Pb.Lat*Math.PI/180)+Pb.Lng = Pa.Lng


right?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now