Fehler beseitigt
This commit is contained in:
parent
3d16287c44
commit
e415522916
1 changed files with 3 additions and 4 deletions
|
@ -6,7 +6,7 @@ import os, sys, termios, tty, time, random
|
||||||
from math import sin, cos, tan, sqrt
|
from math import sin, cos, tan, sqrt
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
######################################################
|
########################################################################################
|
||||||
def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
||||||
x = 0
|
x = 0
|
||||||
y = x**2
|
y = x**2
|
||||||
|
@ -35,12 +35,11 @@ def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigk
|
||||||
# cowlength is 2, if cow is an UTF8-Icon, otherwise 1
|
# cowlength is 2, if cow is an UTF8-Icon, otherwise 1
|
||||||
for x in range(xmin, xsteps - 1, cowlength):
|
for x in range(xmin, xsteps - 1, cowlength):
|
||||||
# the formula, which generates the y position for the corresponding x, shamelessly ripped from some schoolbook and modified.
|
# the formula, which generates the y position for the corresponding x, shamelessly ripped from some schoolbook and modified.
|
||||||
yold = y
|
|
||||||
y = (-(gravitation / (2 * startgeschwindigkeit**2 * cos(startwinkel) ** 2)) * x**2) + (tan(startwinkel) * x + starthoehe)
|
y = (-(gravitation / (2 * startgeschwindigkeit**2 * cos(startwinkel) ** 2)) * x**2) + (tan(startwinkel) * x + starthoehe)
|
||||||
|
|
||||||
# Ensure, that nothing has to be drawn outside the viewport
|
# Ensure, that nothing has to be drawn outside the viewport
|
||||||
if y <= ymax and y >= ymin:
|
if y <= ymax and y >= ymin:
|
||||||
# Stash awa the coordinates into scala, which will be returned
|
# Stash away the coordinates into scala, which will be returned
|
||||||
scala += [x, int((y * 100 + 50) / 100)]
|
scala += [x, int((y * 100 + 50) / 100)]
|
||||||
else:
|
else:
|
||||||
scala += [0, 0]
|
scala += [0, 0]
|
||||||
|
@ -50,7 +49,7 @@ def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigk
|
||||||
return scala
|
return scala
|
||||||
|
|
||||||
|
|
||||||
######################################################
|
#############################################################################################
|
||||||
# berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
# berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
||||||
|
|
||||||
# set position of cursor
|
# set position of cursor
|
||||||
|
|
Loading…
Reference in a new issue