Solved

# opposite of Atan2? in c# or in regular math

Posted on 2006-05-12
Medium Priority
1,466 Views
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
Question by:verintsupport
• 4
• 3

LVL 85

Expert Comment

ID: 16672633
angle = atan2(y,x)
y = sin(angle)*distance
x = cos(angle)*distance
0

Author Comment

ID: 16672665
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

Author Comment

ID: 16672668
i think i need to isolate Pa.Lat_origin and Pa.Lng_origin to find my answer
0

Author Comment

ID: 16672674
so basically:

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

Pa.Lat_origin = ?

Pa.Lng_origin = ?
0

LVL 85

Expert Comment

ID: 16672679
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

LVL 85

Accepted Solution

ozo earned 2000 total points
ID: 16672692
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

Author Comment

ID: 16672699
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
This is a research brief on the potential colonization of humans on Mars.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
###### Suggested Courses
Course of the Month14 days, 10 hours left to enroll