Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

trigonometrische Funktionen

Uploader:Redakteurnemored
Datum/Zeit:07.10.2007 12:41:12

' trigonometrische Funktionen in Polarkoordinaten-Darstellung

declare function r(p as single, m as ubyte) as single
dim phi as single, radius as single, modus as ubyte, umlauf as ubyte
const PI = atn(1)*4
screen 18

for modus=1 to 10
  cls
  locate 1, 35
  print "Funktion "; str(modus)
  read umlauf
  for phi=0 to 2*PI*umlauf step .01
    radius = r(phi, modus)*20
    pset (300 + int(cos(phi)*radius), 240 + int(sin(phi)*radius))
    if inkey = chr(27) then exit for
    sleep 1
  next
  locate 2, 30
  print "Bitte Taste druecken"
  sleep
next
data 1, 2, 3, 3, 3, 4, 5, 6, 7, 7

function r(p as single, m as ubyte) as single
  select case m
    case 1:    return cos(p)^2*10
    case 2:    return sin(3/2*p)*5
    case 3:    return sin(p)*2+cos(3*p)+p/2
    case 4:    return sin(p)*5+cos(p^2-p)*2
    case 5:    return abs(sin(p/3))*5'3
    case 6:    return sin(p/4)*5'4
    case 7:    return abs(sin(p/5))*5'5
    case 8:    return abs(sin(p/5))*5-cos(p*2)*3'6
    case 9:    return sin(5/2*p)*2+p/10 '7
    case 10:   return sin(5/2*p)*2+cos(p)+p/10 '7
    case else: return p
  end select
end function