Seite 3 von 3

Verfasst: 19.03.2008 19:38
von Kaeru Gaman
noch waren wir am rumerzählen.... :mrgreen:
also, wenn du so ne proc schreiben magst, kannste gerne machen,
und ich freu mich, wenn sie ne struct zur rückgabe benutzt,
und dann darfst du sie auch gleich nochmal stolz im CT&T posten... :mrgreen:

Verfasst: 19.03.2008 19:46
von scholly
STARGÅTE hat geschrieben:sry das ich jetzt dazwischen frage :

Wo genau seit ihr jetzt ^^ ?
Ich 'abe fertig! :lol: :lol: :lol:
Schon mit tobes erstem Code bin ich zum Ziel gekommen - ich bin zufrieden, wegen meinereiner braucht sich keiner mehr zusätzlich 'reinzuknien, aber danke der Nachfrage.
Kaeru Gaman hat geschrieben:und dann darfst du sie auch gleich nochmal stolz im CT&T posten...
...aber nur, wenn er ein Strontium-Atom damit darstellt =)

Verfasst: 19.03.2008 19:50
von bobobo
ich hätt ja von Anfang an das Orbitalmodell genommen. :roll:

Verfasst: 19.03.2008 19:50
von Kaeru Gaman
dann schreib mir dafür mal die Berechnung.
du Ei mit Pimmel dran... rofl...

Verfasst: 19.03.2008 20:03
von scholly
@bo³:
Mit dem Bild in meinem Eingangsposting???
Thema verfehlt, Danke, setzen, sechs! :lol: :lol: :lol: :lol: :lol:

Verfasst: 19.03.2008 20:14
von STARGÅTE
so hier beide Proceduren, die neue Ellipse und die Punktrückgabe:

Code: Alles auswählen


Procedure EllipseAngle(x, y, RadiusX, RadiusY, Angle.f=0, Farbe=-1)
Protected x1.l, y1.l, x2.l, y2.l, dx.f, dy,f, j.f
 Angle = Angle * #PI/180
 x1 = x + Cos(Angle)*RadiusX - Sin(Angle)*RadiusY
 y1 = y + Sin(Angle)*RadiusX + Cos(Angle)*RadiusY
 For n = 5 To 360 Step 5
  j = n * #PI/180
  dx = Cos(j)*RadiusX - Sin(j)*RadiusX
  dy = Sin(j)*RadiusY + Cos(j)*RadiusY
  x2 = x + Cos(Angle)*dx - Sin(Angle)*dy
  y2 = y + Sin(Angle)*dx + Cos(Angle)*dy
  If Farbe = -1
   LineXY(x1, y1, x2, y2)
  Else
   LineXY(x1, y1, x2, y2, Farbe)
  EndIf
  x1 = x2
  y1 = y2
 Next n
EndProcedure

Structure Punkt2D
 x.d
 y.d
EndStructure
Procedure EllipseAnglePoint(RadiusX.d, RadiusY.d, EllipseAngle.d, PositionAngle.d, *Point.Punkt2D)
Protected x.d, y.d, dx.d, dy.d
 EllipseAngle = EllipseAngle * #PI/180
 PositionAngle = PositionAngle * #PI/180
 dx = Cos(PositionAngle)*RadiusX - Sin(PositionAngle)*RadiusX
 dy = Sin(PositionAngle)*RadiusY + Cos(PositionAngle)*RadiusY
 *Point\x = Cos(EllipseAngle)*dx - Sin(EllipseAngle)*dy
 *Point\y = Sin(EllipseAngle)*dx + Cos(EllipseAngle)*dy
EndProcedure

OpenWindow(0, 0, 0, 800, 600, "E", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  
 
Repeat

 If WindowEvent() = #PB_Event_CloseWindow : End : EndIf
 Delay(10)
 Angle+1
 
 StartDrawing(WindowOutput(0))
  DrawingMode(1)
  Box(0,0,800,600,$000000)
  EllipseAngle(400, 300, 200, 100, 40, $0000FF) 
  EllipseAnglePoint(200, 100, 40, Angle, Point.Punkt2D)
  Circle(400+Point\x,300+Point\y,10, $FF0000)
 StopDrawing()

ForEver

Verfasst: 19.03.2008 20:32
von tobe
@STARGÅTE
super Proceduren ! :allright:

Verfasst: 20.03.2008 14:53
von #NULL
hiermit kann man generell mit 2,3 zeilen auch ellipsen(-ausschnitte) zeichnen.

<edit>..ich hatte vor kurzem auch so'n atom-screensaver gepostet:
http://www.purebasic.fr/german/viewtopi ... 600#190600