13

Convert angle in degrees to a point

How could I convert an angle (in degrees/radians) to a point (X,Y) a fixed distance away from a center-point.

Like a point rotating around a center-point.

Exactly the opposite of atan2 which computes the angle of the point y/x (in radians).


Note: I kept the original title because that's what people who do not understand will be searching by!

Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
  • hi, i have polar cordinates for north pole. how to convert it to Lat-long? – Pragnesh Patel Jan 04 '10 at 09:11
  • @PragneshPatel [Altitude = `r`, Latitude = `180°-θ`, Longitude = `φ`](https://en.wikipedia.org/wiki/Spherical_coordinate_system). You may want to multiply the lat and long by `180/π` to convert them to degrees. – JamesTheAwesomeDude May 03 '21 at 08:36

4 Answers4

22

Let the fixed distance be D, then X = D * cos(A) and Y = D * sin(A), where A is the angle.

PolyThinker
  • 5,152
  • 21
  • 22
4

If center-point (Xcp, Ycp) isn't the origin you also need to add it's coordinates to (X,Y) i.e. X = Xcp + D * cos(A) and Y = Ycp + D * sin(A)

jeffD
  • 1,230
  • 3
  • 13
  • 18
2

What PolyThinker said.

Also, if you need the distance from the origin, it's sqrt(x^2 + y^2).

Sophie Alpert
  • 139,698
  • 36
  • 220
  • 238
1
t = angle
r = radius (fixed distance)

x = rcost
y = rsint
Restore the Data Dumps
  • 38,967
  • 12
  • 96
  • 122