def main (): global texture global allstars global hHeight, hWidth glutInit ( sys.argv ) glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ) glutInitWindowSize ( hWidth, hHeight ) glutInitWindowPosition ( 0, 0 ) glutCreateWindow ( "Starview" ) glutDisplayFunc ( display ) glutIdleFunc ( animate ) glutReshapeFunc ( reshape ) glutKeyboardFunc ( keyPressed ) init () # texture = loadTexture ( "stars.jpg" ) allstars = stars.loadStars() glutMainLoop()
#!/usr/bin/python print "importing" import stars import sys import math if len(sys.argv)!= 4: print "usage:" print " lookup.py Ra De Angle" exit() stardb = stars.loadStars() ra = sys.argv[1] de = sys.argv[2] angle = float(sys.argv[3]) direction = {} direction['x'] = math.cos(stars.ra2rad_(ra))*math.cos(stars.de2rad_(de)) direction['y'] = math.sin(stars.ra2rad_(ra))*math.cos(stars.de2rad_(de)) direction['z'] = math.sin(stars.de2rad_(de)) print "direction:", direction threshold = math.cos(angle/360*2*math.pi) print "threshold:", threshold result = filter (lambda x: stars.dot(x, direction)>=threshold, stardb) print "stars in angle", angle, " close to ", ra, de for star in result: print star['n'], "ra", star['ra'], "de", star['de'], "mg", star['mg']