Еще одна программа, найденная на форуме. Поменял раскраску другим способом
Procedure ellips(cx.f, cy.f, a.f,b.f, theta.f)
;Debug theta
t.f=0
If a>b
stp.f=a
Else
stp=b
EndIf
While t<2*#PI;For t = 0 To 2*pi Step 1/max(a,b)
x.f=a*Cos(theta)*Cos(t)-b*Sin(theta)*Sin(t)
y.f=a*Sin(theta)*Cos(t)+b*Cos(theta)*Sin(t)
;Box(x+cx,y+cy,1,1,255)
Box(x+cx,y+cy,1,1,Int($FFFF*Sin(theta)))
t=t+1/stp
Wend;Next
EndProcedure
If OpenWindow(0, 0, 0, 320, 320, "Rotated Ellipse", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 320, 320)
If StartDrawing(CanvasOutput(0))
Box(0,0,320,320,0)
cx.f=160
cy.f=160
a.f=0.95*cx
b.f=a*12/15
t=0
While t<360*2.5 ;For t = 0 To 360*2.5 Step 10
angle.f=0-t*#PI/180
;Debug angle
ellips(cx, cy, a,b, angle)
a=a*0.96
b=b*0.96
t=t+10
Wend;Next
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
;Debug theta
t.f=0
If a>b
stp.f=a
Else
stp=b
EndIf
While t<2*#PI;For t = 0 To 2*pi Step 1/max(a,b)
x.f=a*Cos(theta)*Cos(t)-b*Sin(theta)*Sin(t)
y.f=a*Sin(theta)*Cos(t)+b*Cos(theta)*Sin(t)
;Box(x+cx,y+cy,1,1,255)
Box(x+cx,y+cy,1,1,Int($FFFF*Sin(theta)))
t=t+1/stp
Wend;Next
EndProcedure
If OpenWindow(0, 0, 0, 320, 320, "Rotated Ellipse", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 320, 320)
If StartDrawing(CanvasOutput(0))
Box(0,0,320,320,0)
cx.f=160
cy.f=160
a.f=0.95*cx
b.f=a*12/15
t=0
While t<360*2.5 ;For t = 0 To 360*2.5 Step 10
angle.f=0-t*#PI/180
;Debug angle
ellips(cx, cy, a,b, angle)
a=a*0.96
b=b*0.96
t=t+10
Wend;Next
StopDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf


Комментарии
Отправить комментарий