Linie aus Punkten
Verfasst: 03.09.2005 23:59
Hi leutz,
kommen wir gleich zum Thema...
ich hab da n Problem mit der Procedure hier:
Die funzt nicht richitg...sollte eigendlich ne Linie erzeugen
.. aber irgendwie geht das nicht richtig ..?
Kann das vll. jemand fixxen?
Bye
Slap
kommen wir gleich zum Thema...

ich hab da n Problem mit der Procedure hier:
Code: Alles auswählen
Procedure PlotLine(x1.l,y1.l,x2.l,y2.l)
If x1 = 0 Or y1 = 0 Or x2 = 0 Or y2 = 0
ProcedureReturn 0
Else
dx.f = x2-x1
If dx<0
SignX = -1
dx = Abs(dx)
Else
SignX = 1
EndIf
dy.f = y2-y1
If dy<0
SignY = -1
dy = Abs(dy)
Else
SignY = 1
EndIf
Result = 1
If dy < dx
Stp.f = dy/dx
For n=0 To Int(dx)
If x => 0 And y => 0
Plot(x,y)
EndIf
Next
Else
Stp.f = dx/dy
For n=0 To Int(dy)
x = x1+(n*Stp*SignX)
y = y1+(n*SignY)
If x => 0 And y => 0
Plot(x,y)
EndIf
Next
EndIf
ProcedureReturn Result
EndIf
EndProcedure

Kann das vll. jemand fixxen?

Bye
Slap