%% syntaxe : (A) (B) str proc1 proc2 calc_ncp --> A' et B' les points
%% de connexion des nodes A et B
/calc_ncp {
16 dict begin
/connuB' false def
/connuA' false def
/calcangleB exch def
/calcangleA exch def
/option exch def
dup isname {
/nodeB_pointname exch def
/connuB' true def
} if
/nodeB_name exch def
/nodeB_name nodeB_name (node_dict) append store
/n@deBdict nodeB_name cvx def
dup isname {
/nodeA_pointname exch def
/connuA' true def
} if
/nodeA_name exch def
/nodeA_name nodeA_name (node_dict) append store
/n@deAdict nodeA_name cvx def
n@deAdict /cc get /A exch def
n@deBdict /cc get /B exch def
%% point de connection au node A
connuA' not {
n@deAdict /noderayon known {
%% on a un noeud cercle
calcangleA A
n@deAdict /noderayon get
cpoint /A' defpoint
} {
n@deAdict /nodetype known {
%% on a un noeud ovale
calcangleA [
n@deAdict /udia get exec
n@deAdict /rdia get exec
n@deAdict /ddia get exec
n@deAdict /ldia get exec
] pol2ell Epoint /A' defpoint
} {
%% on a un noeud diamond
n@deAdict /ddia known {
n@deAdict /udia get exec
n@deAdict /rdia get exec
n@deAdict /ddia get exec
n@deAdict /ldia get exec
calcangleA
quadrilatereanglepoint /A' defpoint
} {
%% on a un noeud rectangle
n@deAdict /dl get exec
n@deAdict /dr get exec
n@deAdict /ur get exec
n@deAdict /ul get exec
calcangleA
quadrilatereanglepoint /A' defpoint
} ifelse
} ifelse
} ifelse
} {
n@deAdict nodeA_pointname get exec /A' defpoint
} ifelse
%% point de connection au node B
connuB' not {
n@deBdict /noderayon known {
%% on a un noeud cercle
calcangleB B
n@deBdict /noderayon get
cpoint /B' defpoint
} {
n@deBdict /nodetype known {
%% on a un noeud ovale
calcangleB [
n@deBdict /udia get exec
n@deBdict /rdia get exec
n@deBdict /ddia get exec
n@deBdict /ldia get exec
] pol2ell Epoint /B' defpoint
} {
n@deBdict /ddia known {
%% on a un noeud diamond
n@deBdict /udia get exec
n@deBdict /rdia get exec
n@deBdict /ddia get exec
n@deBdict /ldia get exec
calcangleB
quadrilatereanglepoint /B' defpoint
} {
%% on a un noeud rectangle
n@deBdict /dl get exec
n@deBdict /dr get exec
n@deBdict /ur get exec
n@deBdict /ul get exec
calcangleB
quadrilatereanglepoint /B' defpoint
} ifelse
} ifelse
} ifelse
} {
n@deBdict nodeB_pointname get exec /B' defpoint
} ifelse
A' B' option
end
} def
%% syntaxe : (A) (B) str ncline --> relie les nodes A et B
/ncline {
{A B angle} {A B angle 180 add} calc_ncp
pcline
} def
%% syntaxe : (A) (B) str ncbar --> relie les nodes A et B
/ncarc {
{arcangleA A B angle add} {A B angle 180 add arcangleB sub} calc_ncp
pcarc
} def
%% syntaxe : (A) (B) str ncbar --> relie les nodes A et B
/ncbar {
{angleA} {angleA} calc_ncp
pcbar
} def
%% syntaxe : (A) (B) str nccurve --> relie les nodes A et B
/nccurve {
{angleA} {angleB} calc_ncp
pccurve
} def
%% syntaxe : (A) (B) str ncdiag --> relie les nodes A et B
/ncdiag {
{angleA} {angleB} calc_ncp
pcdiag
} def
%% syntaxe : (A) (B) str ncangle --> relie les nodes A et B
/ncangle {
{angleA} {angleB} calc_ncp
pcangle
} def
%% syntaxe : (A) (B) str ncangles --> relie les nodes A et B
/ncangles {
{angleA} {angleB} calc_ncp
pcangles
} def
%% syntaxe : (A) str ncline --> relie les nodes A et B
/ncircle {
2 copy pop exch
{angleA} {angleB} calc_ncp
/option exch def
/A1 defpoint
/A2 defpoint
% bleu A1 times2 A2 times2 noir
A1 A2
A1 A2 milieu
A1 A2 vecteur orthovecteur normalize -.15 mulv
A1 A2 distance mulv
addv
% dupp orange times2 noir
ABcercle /C defcercle
0 C cpoint C pop A2 tripointangle /alpha exch def
0 C cpoint C pop A1 tripointangle /beta exch def
% rouge alpha C cpoint point noir
alpha beta 360 add C option Cercle
} def
|