Add surface distance measurement to mouse click handler
[?]
Jul 7, 2021, 7:30 PM
PG7KSKJLFLANZCTTVYVCHO6IHYL5QA22OGFM7M2DAF2CKMFVMT7QCDependencies
- [2]
IGYI5RVVFigure out how to draw on the sdl2 window - [3]
J6HV4MNJModel trainer: mouse click handler (prints normalized vector from planet's center) - [4]
ROQCAPZJBegin function for showing the map (for now just opens SDL window)
Change contents
- edit in trainmodel/src/drawmap.py at line 16
last_clicked = None - replacement in trainmodel/src/drawmap.py at line 35
print(list(inputs[event.button.y * 1024 + event.button.x].numpy()))point = list(inputs[event.button.y * 1024 + event.button.x].numpy())if last_clicked != None:dug = math.sqrt(sum(map((lambda p: (p[0]-p[1])**2), zip(last_clicked, point))))arc = math.acos(1 - dug**2 / 2) # cosine rule, a == b == 1print('%s Km | %s miles' % (arc * 6372.0, arc * 3959.377))print(point)last_clicked = point