fb:porticula NoPaste
Herbst- und Winterblumen (Funktionen in Polarkoordinaten)
Uploader: | nemored |
Datum/Zeit: | 01.11.2007 22:49:50 |
type TypFunktion
as ubyte form, param1, param2
as uinteger dauer
as single schritt
end type
dim as ubyte x, y, f, farbe
dim as single r
dim as string taste
dim as TypFunktion funktion(7)
declare function berechne(form as ubyte, p1 as ubyte, p2 as ubyte, phi as single) as single
for i as ubyte = 0 to 7
with funktion(i)
read .form, .param1, .param2, .dauer, .schritt
end with
next
data 1, 16, 20, 3200, .01
data 1, 16, 11, 3200, .02
data 2, 17, 20, 4200, .03
data 4, 8, 1, 1300, .005
data 5, 16, 5, 3200, .01
data 6, 16, 2, 1300, .005
data 7, 4, 2, 1280, .005
data 7, 12, 3, 2100, .003
screen 19
randomize timer
do
x = int(rnd*14)
y = int(rnd*10)
f = int(rnd*8)
color 0, 0
'line (x*50, y*50)-step(200, 200),,BF
color int(rnd*15)+1
with funktion(f)
for i as single = 0 to .dauer*.schritt step .schritt
taste = inkey
if taste <> "" then exit for
r = berechne(.form, .param1, .param2, i)
pset (x*50+100+r*cos(i)*80, y*50+100+r*sin(i)*80)
sleep 1
next
end with
loop until taste<>""
function berechne(form as ubyte, p1 as ubyte, p2 as ubyte, phi as single) as single
select case form
case 1 : return cos(p1*phi)/p2 + abs(sin(p1*phi/p2))
case 2 : return cos(p1*phi/p2)
case 3 : return cos(p1*phi)^3 - sin(p1*(250-phi))
case 4 : return phi/20 - cos(p1*phi)^3 + sin(p1*(250-phi))*1.2
case 5 : return cos(p1*phi/p2) + abs(sin(p1*phi)/p2)
case 6 : return (cos(p1*phi) - sgn(sin(p1*phi/p2)))/p2
case 7 : return -abs(cos(p1*phi)*p2)*.4 + abs(sin(p1*phi/p2))*.4
end select
return phi/20000 + cos(p1*phi)^3 - sin(p1*(250-phi))
end function