/linearc 0 def
%% syntaxe~: [x1 y1 ... xn yn] polygone
/polygone_simple {
gsave
newpath
aload length 2 idiv
3 copy pop
smoveto
{
slineto
} repeat
closepath
starfill
currentlinewidth 0 eq {} {stroke} ifelse
grestore
} def
/polygone_coude {
2 dict begin
/les_points exch def
/n les_points length 2 idiv 1 sub def
[
les_points 0 getp
les_points n getp
milieu
les_points aload pop
les_points 0 getp
les_points n getp
milieu
]
ligne
end
} def
%% syntaxe~: [x1 y1 ... xn yn] polygone_
/polygone_ {
aload length 2 idiv
2 dict begin
3 copy pop
/y@n exch def
/x@n exch def
x@n y@n
smoveto
{
slineto
} repeat
x@n y@n slineto
end
} def
%% syntaxe~: [x1 y1 ... xn yn] polygone
/polygone* {
1 dict begin
/startest {true} def
polygone
end
} def
/polygone {
linearc 0 eq
{polygone_simple}
{polygone_coude}
ifelse
} def
|