Попалась одна програмка:
CLS : a% = 0 FOR theta = 0 TO 2 * pi STEP .015 rad = -(.5 * SIN(5 * theta)) * (.5 * COS(4 * theta)) * 1000 angle = theta + SIN(rad / 100) xp = 320 + rad * COS(angle) yp = 240 + rad * SIN(angle) IF a% THEN LINE -(xp, yp) ELSE a% = 1: PSET (xp, yp) END IF IF INKEY$ <> "" THEN GOTO fl2 NEXT theta GOSUB wkey fl2:
Решил переписать код на PB:
Enumeration
#ca
EndEnumeration
Procedure drawpath(num)
StartDrawing(ImageOutput(0))
Box(0,0,640,480,0)
theta.f=0
df=0
x0.l
y0.l
xp.l
yp.l
While theta<2*#PI
rad.f = -(0.5 * Sin(5 * theta)) * (0.5 * Cos(4 * theta)) * 1000
angle.f = theta + Sin(rad / 100)
xp = Int(320 + rad * Cos(angle))
yp = Int(240 + rad * Sin(angle))
If df
LineXY(x0,y0,xp,yp,$FFFFFF)
x0=xp
y0=yp
Else
x0=xp
y0=yp
df=1
EndIf
theta=theta+0.15
Wend
StopDrawing()
StartDrawing(CanvasOutput(#ca))
DrawImage(ImageID(0),0,0)
StopDrawing()
EndProcedure
If OpenWindow(0, 0, 0, 640, 480, "sinpaths", #PB_Window_SystemMenu | #PB_Window_ScreenCentered|#PB_Window_BorderLess)
CanvasGadget(#ca, 0, 0, 640, 480)
CreateImage(0,640,480)
drawpath(2)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Понятно, узор получается другой. Где я ошибся?
