Можно взяться за дурацкий диалект BBC Basic и перенести код на более привычный:
xres=1280
yres=1024
If OpenWindow(0, 0, 0, xres, yres, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, xres, yres)
If StartDrawing(CanvasOutput(0))
Box(0,0,xres, yres,0)
; https://bbcmic.ro/?t=8TQ7j
; MODE0:VDU29,640;-32;19,1,2;0;5
; R=120:D=2*R:S=R*SQR3
R=120
D=2*R
S.f =R*Sqr(3)
; K=1024^2
K=1024*1024
;K=1280*1280
; FORV=0TO18
For V=-0 To 18
; FORH=-19TO19
For H=-19 To 19
L.f=-#PI
; FORL=-PI TOPI STEPPI/3
While L<=#PI
; A=R+(1ANDV)*R+H*D+SINL*R
A=R+(v&1)*R+H*D+R*Sin(L)
; B=1023+V*S+COSL*R
B=1023+V*S+R*Cos(l)
; C=K/(A*A+B*B)
c.f=K/(A*A+B*B)
; PLOT5+(L=-PI),A*C,B*C ;5 Draw a line, in the current graphics foreground colour, to the absolute coordinates specified by X and Y.
If L=-#PI
X0=A*C
Y0=B*C
Else
LineXY(X0+640,Y0-32,A*C+640,B*C-32,$FF00)
X0=A*C
Y0=B*C
EndIf
l=l+#PI/3
Wend
; Next,,
Next H
Next V
; VDU1
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
yres=1024
If OpenWindow(0, 0, 0, xres, yres, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, xres, yres)
If StartDrawing(CanvasOutput(0))
Box(0,0,xres, yres,0)
; https://bbcmic.ro/?t=8TQ7j
; MODE0:VDU29,640;-32;19,1,2;0;5
; R=120:D=2*R:S=R*SQR3
R=120
D=2*R
S.f =R*Sqr(3)
; K=1024^2
K=1024*1024
;K=1280*1280
; FORV=0TO18
For V=-0 To 18
; FORH=-19TO19
For H=-19 To 19
L.f=-#PI
; FORL=-PI TOPI STEPPI/3
While L<=#PI
; A=R+(1ANDV)*R+H*D+SINL*R
A=R+(v&1)*R+H*D+R*Sin(L)
; B=1023+V*S+COSL*R
B=1023+V*S+R*Cos(l)
; C=K/(A*A+B*B)
c.f=K/(A*A+B*B)
; PLOT5+(L=-PI),A*C,B*C ;5 Draw a line, in the current graphics foreground colour, to the absolute coordinates specified by X and Y.
If L=-#PI
X0=A*C
Y0=B*C
Else
LineXY(X0+640,Y0-32,A*C+640,B*C-32,$FF00)
X0=A*C
Y0=B*C
EndIf
l=l+#PI/3
Wend
; Next,,
Next H
Next V
; VDU1
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Мало? Тогда можно усложнить задачу
MODE1:PRINT"Anti-hexafoil"
VDU29,639;511;5,19,1,4;0;
DIMX(16),Y(16):S=PI/3
FORL=0TO16
X(L)=SIN(L*S)*212:Y(L)=COS(L*S)*212
NEXT
C=3
FORM=1TO5
IFM=3M=4
GCOL1,C
C=C EOR2
FORL=0TO5
MOVEX(L)+X(L+M),Y(L)+Y(L+M); mCentre, start point,end point
MOVEX(L),Y(L)
PLOT&A5,X(L+M),Y(L+M)
NEXT,
MOVE0,0:PLOT&91,0,212
Так я и не добился результата(
Комментарии
Отправить комментарий