コード例 #1
0
 def computeMotion(self):
     """Find the motion of a planet with its distance and its mass."""
     angle = random.uniform(0, 2 * math.pi)
     norm = self.distance
     position = Vector.createFromPolarCoordonnates(norm, angle)
     angle = (angle + math.pi / 2) % (2 * math.pi)
     norm = self.speed  # in m/s-1
     velocity = Vector.createFromPolarCoordonnates(norm, angle)
     acceleration = Vector.null()
     return Motion(position, velocity, acceleration)
コード例 #2
0
 def showRadius(self,window,color=None,width=None):
     """Show the radius of the circle."""
     if not color: color=self.radius_color
     if not width: width=self.radius_width
     vector=Vector.createFromPolarCoordonnates(self.radius,0,color=color)
     vector.show(window,self.center,width=width)
     vector.showText(surface,self.center,"radius",size=20)