%% syntaxe : A B coef trait
/trait {
3 dict begin
/coef exch def
/pt1 defpoint
/pt2 defpoint
coef 0 ge
{[pt1 pt2 coef hompoint pt2 pt1 coef hompoint] ligne}
{pt1 pt2 coef neg hompoint pt2 pt1 coef neg hompoint xdroite}
ifelse
end
} def
%% A B xdroite : trace la droite (AB) privee du segment [AB]
/xdroite {
6 dict begin
ordonnepoints
/pt2 defpoint
/pt1 defpoint
pt1 pt2 verticale?
{
/pt2' {pt2 pop ymax} def
/pt1' {pt2 pop ymin} def
}
{
/pt2' {ymax pt1 pt2 ydpoint} def
/pt1' {ymin pt1 pt2 ydpoint} def
}
ifelse
[pt2 pt2'] ligne
[pt1 pt1'] ligne
end
} def
|