def motion(self,event): click_x = (event.x/(SQUARE_SIZE*1.0))+self.longitude_start click_y = (event.y/(SQUARE_SIZE*1.0))-self.latitude_start delta_x = abs(click_x - self.myLongitude) delta_y = abs(click_y + self.myLatitude) distance = mytools.calculate_pythagore(mytools.convert_horaires_to_km(delta_x),mytools.convert_horaires_to_km(delta_y)) #self.update_text_distance_label("Distance: "+str((mytools.convert_horaires_to_km(delta_x)**2+mytools.convert_horaires_to_km(delta_y)**2)**0.5)+" km") self.update_text_distance_label("Distance: "+str(distance)+" km") calculate_new_angle = mytools.calculate_angle_degree_between_points( (self.myLongitude-self.longitude_start), (self.myLatitude-self.latitude_start), (click_x-self.longitude_start), ((click_y+self.latitude_start)*-1.0)) calculate_new_angle=int(calculate_new_angle) self.update_text_angle_label("Boat angle:"+str(calculate_new_angle)+"°") the_square = self.sea.get_squares_at(self.myLongitude,self.myLatitude) wind_angle=mytools.calculate_angle_au_vent(calculate_new_angle,the_square.get_angles()[0]-90) self.update_text_wind_angle_label("Wind Angle:"+str(wind_angle)+"°") calculate_speed=mytools.find_closest_calc(the_square.get_forces()[0],wind_angle,self.myCalcCSV) self.update_text_debug_label("Calculate speed:"+str(round(calculate_speed[0],1))+"Km/h")
def showArrivalFromStartPointWithTimeAndAngle(self,x,y,time,twelve_hours,angle): the_square = self.sea.get_squares_at(x,y) wind_angle=mytools.calculate_angle_au_vent(angle,the_square.get_angles()[twelve_hours/12]-90) speed_calculate = mytools.find_closest_calc(the_square.get_forces()[twelve_hours/12],wind_angle,self.myCalcCSV) arrival = mytools.calculate_arrival(x,y,speed_calculate[0],angle,time) return arrival