Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import requests
- import csv
- import numpy as np
- import vectormath as vmath
- import math
- #-368.03125 / -321.6875 / -1047.625
- v1 = vmath.Vector3(-368.03125, -321.6875, -1047.625)
- v2 = vmath.Vector3(142.65625 , 56.46875 , 40.34375)
- v3 = (v1-v2)
- v3.normalize()
- print(v3)
- total=[]
- for vinc in range(0, 180,1):
- print('iterating '+str(vinc+1)+ ' out of 180')
- vC=v1+(v3*float(vinc))
- #vC.x=math.floor(vC.x)
- #vC.y=math.floor(vC.y)
- #vC.z=math.floor(vC.z)
- print(vC)
- PARAMS={'x':vC.x, 'y':vC.y, 'z': vC.z, 'radius':50,
- 'showCoordinates':1, 'showId':1, 'showInformation':1,
- 'showPrimaryStar':1}
- v = requests.get('https://www.edsm.net/api-v1/cube-systems', params=PARAMS)
- cdat=v.json()
- #fakelambda
- #if not any(d['name'] == cell['name'] for d in total):
- for cell in cdat:
- hasDupe=0
- for tc in total:
- if tc['name']==cell['name']:
- hasDupe=1
- break
- if hasDupe==0:
- total.append(cell)
- csvw = open('extraTeresticles_Hesperus_WalkingSearch.csv', mode='w')
- writer = csv.writer(csvw, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator = '\n')
- writer.writerow(['system','Center Distance', 'x', 'y', 'z', 'id'])
- for cell in v.json():
- #if cell['primaryStar']['type']=="K (Yellow-Orange) Star" and cell['bodyCount']>1:
- writer.writerow([cell['name'], cell['distance'], cell['coords']['x'], cell['coords']['y'], cell['coords']['z'], cell['id']])
- csvw.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement