| |
|
|
p.specht
|
'In XProfan 11.2a free written for learning
Windowstyle 31
Windowtitle "Bresenham-Circles"
Window %maxx*.81,%maxy*.81
Cls @Rgb(231,231,221)
' Kreise in stood off ex%
var r%= sqrt((@width(%hWnd)/2)^2 + (@height(%hWnd)/2)^2 )
var ex%=14
while r%>0
brCircle( @width(%hWnd)/2, @height(%hWnd)/2 , r% , \
@rgb(rnd(100)+155,rnd(155)+100,r% and 255) )
r% = r% - ex%
case %MousePressed : break
endwhile
WaitInput
End
proc brCircle
' Bresenham-Algorithmus for a (Achtel-)circle
parameters xmittel%,ymittel%,r%,c%
var x% = r%
var y% = 0
var Error% = r%
declare dy%,dx%
Gosub "DrawPixels"' JAWOLL, ONE GOSUB! DA STAUNSTE, WAS?
WHILE y% < x%
dy% = y%*2+1 : REM with Assembler-Implementierung *2 by Invoice values
inc y%
Error% = Error% - dy%
IF Error%<0
dx% = 1 - x%*2
x% = x% - 1
Error% = Error% - dx%
ENDIF
' there it around the screen and not ums Plotten goes,
' can The others Oktanten here with unroof:
Gosub "DrawPixels"
ENDWHILE
RETURN
DrawPixels:
SETPIXEL xmittel%+x%, ymittel%+y%,c%
SETPIXEL xmittel%-x%, ymittel%+y%,c%
SETPIXEL xmittel%-x%, ymittel%-y%,c%
SETPIXEL xmittel%+x%, ymittel%-y%,c%
SETPIXEL xmittel%+y%, ymittel%+x%,c%
SETPIXEL xmittel%-y%, ymittel%+x%,c%
SETPIXEL xmittel%-y%, ymittel%-x%,c%
SETPIXEL xmittel%+y%, ymittel%-x%,c%
Return
ENDPROC
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 04/05/21 ▲ |
|
|
|