English
Source / code snippets

periodic function produce

 

HofK
it'll one point with x between 0 and Pi/2 and y between 0 and 1 - here (0.5, 0.75) - indicated. from it go two Geradenabschnitte certainly. now becomes through suitable Zuordnung from this Teilstück The periodic function gebastelt.

XProfan 11
// periodic function produce
Var px! = 0.5
Var py! = 0.75
//-------------
Window 0,0 - 1800,1000
Var x! = 0
Var y! = 0
Var m! = 0
Var pi2! = Pi() / 2
USEP 0, 2, RGB(200,0,0)
x! = -1.57
MoveTo 400 + x! * 200 , 500 + 200

WhileLoop 0, 784

    x! = x! + 0.01
    y! = sinlike(x!)
    LineTo 400 + x! * 200 , 500 - y! * 200

EndWhile

USEP 0, 2, RGB(0,200,0)
x! = -1.57
MoveTo 400 + x! * 200 , 500

WhileLoop 0, 784

    x! = x! + 0.01
    y! = coslike(x!)
    LineTo 400 + x! * 200 , 500 - y! * 200

EndWhile

USEP 0, 1, RGB(0,0,0)
x! = -1.57
MoveTo 400 + x! * 200 , 500 + 200

WhileLoop 0, 784

    x! = x! + 0.01
    y! = sin(x!)
    LineTo 400 + x! * 200 , 500 - y! * 200

EndWhile

USEP 0, 1, RGB(0,200,200)
x! = -1.57
MoveTo 400 + x! * 200 , 500

WhileLoop 0, 784

    x! = x! + 0.01
    y! = cos(x!)
    LineTo 400 + x! * 200 , 500 - y! * 200

EndWhile

USEP 0, 1, RGB(0,0,200)
Line 100, 500, 1700, 500
Line 400,  50,  400, 900
waitinput

Proc k1

    Parameters x!
    m! = ( 1 - py! ) / ( pi2! - px! )

    if x! <= px!

        return  py! / px! * x!;

    endif

    if x! > px!

        return   m! * x! + 1 - pi2! * m!

    endif

ENDPROC

Proc sinlike

    Parameters x!

    if ( x! < 0 )

        return -k1( -x! )

    endif

    if ( x! >= 0 ) AND ( x! <= pi2!)

        return k1( x! );

    endif

    if ( x! > pi2! ) AND ( x! <= Pi() )

        return k1( Pi()  - x! );

    endif

    if ( x! > Pi() ) AND ( x! <= 3 * pi2! )

        return -k1( x! - Pi() );

    endif

    if ( x! > 3 * pi2! ) AND ( x! <= 2 * Pi() )

        return -k1( 2 * Pi() - x! );

    endif

    if ( x! > 2 * Pi() ) AND ( x! <= 5 * pi2!)

        return  k1( x! - 2 * Pi()  );

    endif

ENDPROC

Proc coslike

    Parameters x!
    return sinlike( x! + pi2! );

ENDPROC




application see  [...] 
 
02/07/18  
 



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

3.548 Views

Untitledvor 0 min.
RudiB.04/14/22
Stringray01/05/22
Langer01/01/22
p.specht11/21/21
More...

Themeninformationen

this Topic has 1 subscriber:

HofK (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