project_sphere
ΒΆ
Sample to project the sphere on a plane
""" Sample to project the sphere on a plane
"""
import numpy as np
import matplotlib.pyplot as plt
from irfpy.util import intersection
def main():
planet_pos = (500, -500, 1000)
planet_radius = 300
theta, phi = intersection.sphere_limb_plane_projection(planet_pos, planet_radius)
plt.plot(np.degrees(phi), np.degrees(theta), '.')
plt.xlim(-180, 180)
plt.ylim(180, 0)
plt.xlabel('phi')
plt.ylabel('theta')
# Check the position of the center
distance = np.linalg.norm(planet_pos)
theta = np.degrees(np.arccos(planet_pos[2] / distance))
phi = np.degrees(np.arctan2(planet_pos[1], planet_pos[0]))
plt.plot([phi], [theta], 'x')
plt.show()
if __name__ == "__main__":
main()