Skip to content

Commit

Permalink
#39 Changed the landing graphic to a sphere
Browse files Browse the repository at this point in the history
This is so we can better pretend it's the field-of-view of a 'radar
scanner' or something
  • Loading branch information
pmelanson committed Feb 1, 2019
1 parent 2bfefbe commit 5c5678f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions orbitx/flight_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
DEFAULT_CENTRE = 'Habitat'
DEFAULT_REFERENCE = 'Earth'
DEFAULT_TARGET = 'Moon'

G = 6.674e-11

PLANET_SHININIESS = 0.3


class FlightGui:

Expand Down Expand Up @@ -487,7 +490,7 @@ def _draw_sphere(self, planet):
radius=planet.r,
make_trail=False,
retain=100,
shininess=0.1
shininess=PLANET_SHININIESS
)

obj.name = planet.name # For convenient accessing later
Expand Down Expand Up @@ -525,14 +528,12 @@ def _draw_landing_graphic(self, planet):
"""Draw something that simulates a flat surface at near zoom levels."""
size = planet.r * 0.01
texture = self._texture_path / (planet.name + '.jpg')
return self._vpython.box(
return self._vpython.cylinder(
up=self._vpython.vector(0, 0, 1),
axis=self._vpython.vector(1, 0, 0),
height=size,
length=size,
width=size,
pos=self._posn(planet) + self._vpython.vector(
planet.r + size / 2, 0, 0),
axis=self._vpython.vector(-size, 0, 0),
radius=size,
pos=self._posn(planet), # This will be filled in by the _update
shininess=PLANET_SHININIESS,
texture=str(texture) if texture.is_file() else None
)

Expand All @@ -558,12 +559,12 @@ def _update_landing_graphic(self, planet):
self._habitat.x - planet.x,
self._habitat.y - planet.y,
0
)
).norm()
landing_graphic = self._landing_graphic[planet.name]

landing_graphic.axis = axis.norm()
landing_graphic.axis = -axis * landing_graphic.length
landing_graphic.pos = (
self._posn(planet) + axis.norm() * planet.r
self._posn(planet) + axis * planet.r
)

def _recentre_dropdown_hook(self, selection):
Expand Down

0 comments on commit 5c5678f

Please sign in to comment.