English
Source / code snippets

Dreiecks-perimeter show

 

p.specht


Windowtitle "Umkreis to charge and zeigen"
' (CL) Copyleft 2012-08 P. woodpecker
' {z.B. to preparation for Flip-operation the Delauney-Triangulation }
Declare x!,y!,x0!,y0!,x1!,y1!,x2!,y2!,xu!,yu!,error%,nenn!,r!
Declare y01!,yy2!,yy0!,xx0!,yy1!,xx1!,xx2!,x10!,x02!,x21!
Declare xu0!,yu0!,xxu0!,yyu0!
Font 2 : Randomize : var xm!=%maxx/2:var ym!=%maxy/2
Window 0,0 - %maxx,%maxy
Cls rgb(246,246,246)
AppendMenuBar 10,"Bitte with mouse Dreieckspunkte clicking..."
again:
WaitMouse
x0!=%mousex
y0!=%mousey
usepen 0,2,0
point x0!,y0!
WaitMouse
x1!=%mousex
y1!=%mousey
usepen 0,2,0
point x1!,y1!
usepen 0,1,0
line x0!,y0! - x1!,y1!
WaitMouse
x2!=%mousex
y2!=%mousey
usepen 0,2,0
point x2!,y2!
usepen 0,1,0
line x0!,y0! - x2!,y2!
line x1!,y1! - x2!,y2!
y01!=y0!-y1!
yy2!=y2!*y2!
yy0!=y0!*y0!
xx0!=x0!*x0!
yy1!=y1!*y1!
xx1!=x1!*x1!
xx2!=x2!*x2!
x10!=x1!-x0!
x02!=x0!-x2!
x21!=x2!-x1!
nenn!=(2*(x10!*y2!+x02!*y1!+(x21!)*y0!))

ifnot (nenn!=0) or (y01!=0)

    xu!=(y01!*yy2!-(yy0!-yy1!+xx0!-xx1!)*y2!-y0!*yy1!+\
    (xx0!+yy0!-xx2!)*y1!+(xx2!-xx1!)*y0!) / nenn!
    'xu!=((y0!-y1!)*y2!*y2!-(y0!*y0!+x0!*x0!-y1!*y1!-x1!*x1!)*y2!-y0!*y1!*y1!+\
    '(x0!*x0!+y0!*y0!-x2!*x2!)*y1!+(x2!*x2!-x1!*x1!)*y0!) / \
    '(2*((x1!-x0!)*y2!+(x0!-x2!)*y1!+(x2!-x1!)*y0!))
    yu!=x10!/y01!*(xu!-(x0!+x1!)/2)+(y0!+y1!)/2
    usepen 0,5,255
    point xu!,yu!
    xu0!=xu!-x0!
    xxu0!=xu0!*xu0!
    yu0!=yu!-y0!
    yyu0!=yu0!*yu0!
    r!=sqrt(xxu0!+yyu0!)

    if r!<10000

        usepen 0,1,255
        circle xu!,yu!,r!

    endif

endif

goto "nochmal"

proc point

    parameters x!,y!
    rectangle x!+2,(y!+2) - (x!-2),y!-2

endproc

proc circle : parameters cx%,cy%,radius%

    declare x%,y%,error%
    error% = -1*radius%
    x% = radius%
    y% = 0

    while (x% >= y%)

        plot8points(cx%,cy%,x%,y%)
        inc error%,y%
        inc y%
        inc error%,y%

        if (error% >= 0)

            dec error%,x%
            dec x%
            dec error%,x%

        endif

    endwhile

endproc

proc plot8points : parameters cx%,cy%,x%,y%

    plot4points(cx%,cy%,x%,y%)
    case x%-y%: plot4points(cx%,cy%,y%,x%)

endproc

proc plot4points : parameters cx%,cy%,x%,y%

    setPixl cx%+x%, cy%+y%
    case x%: setPixl cx% - x%, cy% + y%
    case y%: setPixl cx% + x%, cy% - y%
    case x%*y%: setPixl cx%-x%,cy%-y%

endproc

proc setpixl

    parameters x%,y%
    setpixel x%,y%,255

endproc

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/01/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

606 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie