Source PostScript (courbeparam.pps)

Retour Texte non formaté
/setresolution { /resolution exch def } def /resolution 200 def /courbe_dic 2 dict def courbe_dic /X {} put courbe_dic /Y {} put %% syntaxe : tmin tmax C@urbeparam_ /C@urbeparam_ { 6 dict begin /tmax@ exch def /tmin@ exch def /t tmin@ def /dt tmax@ tmin@ sub resolution 1 sub div def %% tmin@ courbe_dic /X get exec %% % pstrickactionR %% tmin@ courbe_dic /Y get exec %% % pstrickactionR %% smoveto resolution 1 sub { t courbe_dic /X get exec % pstrickactionR t courbe_dic /Y get exec % pstrickactionR slineto /t t dt add store %% on incremente } repeat tmax@ courbe_dic /X get exec % pstrickactionR tmax@ courbe_dic /Y get exec % pstrickactionR slineto end } def %% syntaxe : tmin tmax {X} {Y} Courbeparam_ /Courbeparam_ { courbe_dic exch /Y exch put courbe_dic exch /X exch put C@urbeparam_ } def %% syntaxe : {X} {Y} courbeparam_ /courbeparam_ { tmin tmax 4 -1 roll 4 -1 roll Courbeparam_ } def %% syntaxe : tmin tmax {X} {Y} Courbeparam /Courbeparam { gsave 6 dict begin dup isstring { /option exch def } if courbe_dic exch /Y exch put courbe_dic exch /X exch put /tmax exch def /tmin exch def newpath tmin courbe_dic /X get exec tmin courbe_dic /Y get exec smoveto %% on commence le chemin tmin tmax C@urbeparam_ starfill stockcurrentcpath newarrowpath currentdict /option known { /dt tmax tmin sub resolution 1 sub div def tmin dt add courbe_dic /X get exec tmin dt add courbe_dic /Y get exec tmin courbe_dic /X get exec tmin courbe_dic /Y get exec arrowpath0 tmax dt sub courbe_dic /X get exec tmax dt sub courbe_dic /Y get exec tmax courbe_dic /X get exec tmax courbe_dic /Y get exec currentdict /dt undef arrowpath1 option gere_arrowhead } if currentlinewidth 0 eq {} {stroke} ifelse end grestore } def %% syntaxe : {X} {Y} courbeparam /courbeparam { dup isstring { tmin tmax 5 -1 roll 5 -1 roll 5 -1 roll } { tmin tmax 4 -1 roll 4 -1 roll } ifelse Courbeparam } def %% syntaxe : tmin tmax {X} {Y} Courbeparam* /Courbeparam* { 1 dict begin /startest {true} def Courbeparam end } def %% syntaxe : {X} {Y} courbeparam* /courbeparam* { 1 dict begin /startest {true} def courbeparam end } def %% /C@urbeparam_ { %% 6 dict begin %% /tmax@ exch def %% /tmin@ exch def %% /t tmin@ def %% /dt tmax@ tmin@ sub resolution 1 sub div def %% resolution 1 sub %% { %% t courbe_dic /X get exec %% % xmin 1 sub max xmax 1 add min %% on borne %% t courbe_dic /Y get exec %% % ymin 1 sub max ymax 1 add min %% on borne %% slineto %% /t t dt add store %% on incremente %% } %% repeat %% tmax@ courbe_dic /X get exec %% % xmin 1 sub max xmax 1 add min %% on borne %% tmax@ courbe_dic /Y get exec %% % ymin 1 sub max ymax 1 add min %% on borne %% slineto %% end %% } def