Code for Great Circle: Get Phi1 Theta1 to Phi2 Theta2 on Sphere

  • Thread starter Thread starter makc
  • Start date Start date
  • Tags Tags
    Circle Code
Click For Summary
SUMMARY

The discussion centers on obtaining code for calculating the great circle path between two points on a sphere, specifically transitioning from coordinates (phi1, theta1) to (phi2, theta2). The user references equation (5) from Wolfram's Great Circle page, noting that it can be implemented in various programming languages, particularly C, where the inverse cosine function is represented as "acos". The primary goal is to derive the deltas of phi and theta as a function of a parameter t ranging from 0 to 1, while avoiding previously encountered bugs in existing implementations.

PREREQUISITES
  • Understanding of spherical coordinates (phi and theta)
  • Familiarity with trigonometric functions, specifically inverse cosine (acos)
  • Basic programming skills in languages resembling C
  • Knowledge of the Basemap toolkit in Matplotlib for Python
NEXT STEPS
  • Implement equation (5) from the Great Circle page in C or a similar language
  • Explore the Basemap toolkit for Python, specifically the greatcircle.py module
  • Research how to calculate deltas of spherical coordinates
  • Learn about numerical methods for interpolating between two points on a sphere
USEFUL FOR

Developers and mathematicians interested in computational geometry, particularly those working with spherical coordinates and great circle calculations in programming environments.

makc
Messages
65
Reaction score
0
wonder if anyone have stumbled across ready code for http://mathworld.wolfram.com/GreatCircle.html" - i.e., the code to get from phi1 theta1 to phi2 theta2 on sphere.
 
Last edited by a moderator:
Technology news on Phys.org
"Code"? In what language?

All you should really need to do is just copy equation (5) from that page, it should work almost verbatim as code in almost any programming language, just remember that [tex]cos^{-1}[/tex] becomes for example "acos" in C.
 
for starters, eq. 5 gives nothing but distance. what I need is deltas of phi and theta (ideally as a function of t = 0...1). the language could be anything that remotely looks like c (i.e. not lisp). the reason to ask for code is to avoid making bugs that were already made and fixed.

so far, closest to what I am looking for is http://www.google.com.ua/codesearch?q=basemap-0.9.4%2Flib%2Fmatplotlib%2Ftoolkits%2Fbasemap%2Fgreatcircle.py&hl=ru&btnG=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA+%D0%BA%D0%BE%D0%B4%D0%B0 , but I'm open for other options :)
 
Last edited by a moderator:

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
6K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K