Вот, с вращением:
PHP код:
Global x_pos.l, y_pos.l
Procedure EllipseWithRotation(xCenter.f, yCenter.f, xRadius.f, yRadius.f, zRotation.f, StartAngle.f, put)
Protected angle.f
Protected AngleStep.f
Protected x.f
Protected y.f
Protected DisplayX.f
Protected DisplayY.f
Protected GreatestRadius.f
If xRadius > yRadius
GreatestRadius.f = xRadius
Else
GreatestRadius = yRadius
EndIf
AngleStep.f = #PI / GreatestRadius
angle = StartAngle
f = 1
For a=0 To GreatestRadius * 2
x.f = Cos(angle) * xRadius
y.f = -Sin(angle) * yRadius
DisplayX.f = x * Cos(zRotation) - y * Sin(zRotation) + xCenter
DisplayY.f = x * Sin(zRotation) + y * Cos(zRotation) + yCenter
Box(DisplayX, DisplayY, 1, 1, #Red)
angle + AngleStep
Next a
EndProcedure
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 640, 480, "Ellipse", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0, 640, 480, 0,0,0 )
xr.f = 128
yr.f = 64
zr.f = 0
fr.f = -#PI
Repeat
WindowEvent()
ClearScreen(0)
StartDrawing(ScreenOutput() )
EllipseWithRotation(320, 240, xr, yr, zr, fr, 1)
StopDrawing()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_PageUp): zr + 0.04: EndIf
If KeyboardPushed(#PB_Key_PageDown): zr - 0.04: EndIf
If KeyboardPushed(#PB_Key_Up): yr - 1: EndIf
If KeyboardPushed(#PB_Key_Down) : yr + 1: EndIf
If KeyboardPushed(#PB_Key_Left): xr - 1: EndIf
If KeyboardPushed(#PB_Key_Right): xr + 1: EndIf
If KeyboardPushed(#PB_Key_Q): fr + 0.1: EndIf
If KeyboardPushed(#PB_Key_A): fr - 0.1: EndIf
Until KeyboardPushed(#PB_Key_Escape)
(требует небольшой доводки, так как рисует с промежутками)