From ac3c55a3216b5988f0e48ba9414ddb059f19a699 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Jan 2006 22:58:36 +0000 Subject: trunk/Master/texmf-dist/metapost git-svn-id: svn://tug.org/texlive/trunk@104 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/expressg/aam.mp | 921 +++++++++++++++ Master/texmf-dist/metapost/expressg/expeg.mp | 1357 +++++++++++++++++++++++ Master/texmf-dist/metapost/expressg/expressg.mp | 1250 +++++++++++++++++++++ 3 files changed, 3528 insertions(+) create mode 100644 Master/texmf-dist/metapost/expressg/aam.mp create mode 100644 Master/texmf-dist/metapost/expressg/expeg.mp create mode 100644 Master/texmf-dist/metapost/expressg/expressg.mp (limited to 'Master/texmf-dist/metapost/expressg') diff --git a/Master/texmf-dist/metapost/expressg/aam.mp b/Master/texmf-dist/metapost/expressg/aam.mp new file mode 100644 index 00000000000..930c16fb526 --- /dev/null +++ b/Master/texmf-dist/metapost/expressg/aam.mp @@ -0,0 +1,921 @@ +% aam.mp MetaPost for AAM figures +% Copyright 2000, 2004 Peter R Wilson +% All rights reserved +input expressg + +verbatimtex + \def\twolines#1#2{\vbox{\hbox{#1} \hbox{#2}}} + \def\threelines#1#2#3{\vbox{\hbox{#1} \hbox{#2} \hbox{#3}}} + \def\fourlines#1#2#3#4{\vbox{\hbox{#1} \hbox{#2} \hbox{#3} \hbox{#4}}} +etex + + + +beginfig(5) % FILES + +numeric lb[]; numeric hb[]; % box dimens +lb1 := namespace(btex Root etex)(nextra); % leaf nodes +lb4 := namespace(btex Root etex)(nextra); % root +hb1 := onelineh; + +numeric upshift, sideshift; +upshift := 10u; +sideshift := 5u; + +numeric cx[]; +numeric lyc[]; + +cx1 := 0; +cx2 := cx1 + sideshift; +cx3 := cx2 + sideshift; +cx4 := cx2 + sideshift + lb1; +cx5 := cx4 + sideshift; +cx6 := cx4 + sideshift + lb1; +cx7 := cx6 + sideshift + lb1; +cx8 := cx7 + sideshift + lb1; +cx9 := cx8 + sideshift + lb1; + +lb2 := (cx9-cx1); % FILES 1 length + +cx11 := cx9 + sideshift; +cx12 := cx11 + sideshift; +cx13 := cx12 + sideshift + lb1; +cx14 := cx13 + 0.5*(sideshift + lb1); +cx15 := cx13 + sideshift + lb1; +cx16 := cx14 + sideshift + lb1; +cx17 := cx16 + sideshift + lb1; +cx18 := cx13 + sideshift; + +lb3 := (cx17-cx11); % FILES 2 length + +lyc1 := 0; +lyc2 := lyc1 + upshift; +lyc3 := lyc2 + upshift + hb1; +lyc4 := lyc3 + upshift + hb1; + +hb3 := (lyc4 + upshift + hb1 -lyc1); % FILES 2 height + +lyc5 := lyc2 + hb1; +lyc6 := lyc5 + upshift + hb1; +lyc7 := lyc6 + upshift + hb1; +lyc8 := lyc7 + upshift + hb1; +lyc9 := lyc8 + upshift + hb1; + +hb2 := (lyc9 - lyc5); % FILES 1 height + +%% left FILE +z15=(cx1,lyc5); +drawENT(15, lb2, hb2)(" "); +label.top(btex FILE 1 etex, z15bm); + +%% right file +z111=(cx11,lyc1); +drawENT(111, lb3, hb3)(""); +label.top(btex FILE 2 etex, z111bm); + +%% bottom row of left tree +z26=(cx2,lyc6); drawENT(26, lb1, hb1)(btex N3 etex); +z46=(cx4,lyc6); drawENT(46, lb1, hb1)(btex N4 etex); +z66=(cx6,lyc6); drawENT(66, lb1, hb1)(btex N5 etex); +z76=(cx7,lyc6); drawENT(76, lb1, hb1)(btex N6 etex); +z86=(cx8,lyc6); drawENT(86, lb1, hb1)(btex L2 etex); + +%% middle row of left tree +z37=(cx3,lyc7); drawENT(37, lb1, hb1)(btex N1 etex); +z57=(cx5,lyc7); drawENT(57, lb1, hb1)(btex L1 etex); +z77=(cx7,lyc7); drawENT(77, lb1, hb1)(btex N2 etex); + +%% top row of left tree +z68=(cx6,lyc8); drawENT(68, lb4, hb1)(btex Root etex); + +%% bottom row right tree +z142=(cx14,lyc2); drawENT(142, lb1, hb1)(btex F4 etex); +z162=(cx16,lyc2); drawENT(162, lb1, hb1)(btex F5 etex); + +%% middle row of right tree +z123=(cx12,lyc3); drawENT(123, lb1, hb1)(btex F1 etex); +z133=(cx13,lyc3); drawENT(133, lb1, hb1)(btex F2 etex); +z153=(cx15,lyc3); drawENT(153, lb1, hb1)(btex F3 etex); + +%% top row of right tree +z184=(cx18,lyc4); drawENT(184, lb4, hb1)(btex Root etex); + +%%%%%%%%%%%%%%%%%%% lines + +%%% thick lines + +%% Arrow L1 to N5 (57-66) +z66A=1/4[z66tl,z66tr]; +pickup thickpen; +drawnormalCA(57bm,66A); +pickup normalpen; + +%% Arrow L2 to F4 (86-142) +pickup thickpen; +drawnormalCA(86bm,142ml); +pickup normalpen; + +%%% thin lines +pickup thinpen; + +%%% file 1 + +%% N1 to N3 & N4 (37, 26, 46) +x36=x37bm; y36=1/2[y26tm,y37bm]; +VyV(26tm, 36, 46tm); +drawnormalfour(26tm, 26tm.vyv, 46tm.vyv, 46tm); +drawnormal(37bm,36); + +%% N2 to N5, N6 & L2 (77, 66, 76, 86) +x76A=x76tm; y76A=1/2[y76tm,y77bm]; +VyV(66tm, 76A, 86tm); +drawnormalfour(66tm, 66tm.vyv, 86tm.vyv, 86tm); +drawnormal(77bm, 76tm); + +%% Root to N1, L1 and N2 (68, 37, 57, 77) +x68A=x68bm; y68A=1/2[y57tm,y68bm]; +VyV(37tm, 68A, 77tm); +drawnormalfour(37tm, 37tm.vyv, 77tm.vyv, 77tm); +drawnormal(68bm,68A); +z57A=(x57tm,y68A); +drawnormal(57A, 57tm); + +%%% file 2 + +%% F3 to F4 and F5 (153, 142, 162) +x153A=x153bm; y153A=1/2[y142tm,y153bm]; +VyV(142tm, 153A, 162tm); +drawnormalfour(142tm, 142tm.vyv, 162tm.vyv, 162tm); +drawnormal(153bm, 153A); + +%% Root to F1, F2 and F3 (184, 123, 133, 153) +x184A=x184bm; y184A=1/2[y184bm,y133tm]; +VyV(123tm, 184A, 153tm); +drawnormalfour(123tm, 123tm.vyv, 153tm.vyv, 153tm); +drawnormal(184bm,184A); +z133A=(x133tm,y184A); +drawnormal(133tm,133A); + + + +pickup normalpen; + +endfig; + +%%end + + + +beginfig(3) % DATA FLOW + + +smoothrad := 2u; + +numeric lb, hb; % length & height of boxes +lb := namespace(btex Analysis Process A0 etex)(nextra); +hb := 5onelineh; + +numeric hspace[]; +hspace1 := namespace(btex Geometry (ISO 10303-203, or other source) etc etex)(ndextra); + +numeric upshift; % vertical distance between rows +upshift = 5u; % 20u +numeric sideshift; % horizontal distance between boxes +sideshift = 5u; % 10u; + +numeric lb[]; + +%lb5 := namespace(btex to Model and etex)(nextra); +lb5 := namespace(btex Computational etex)(nextra); +lb1 := lb5; +lb2 := lb5; +lb3 := lb5; +lb4 := lb5; +lb6 := lb5; +lb25 := lb5; +lb41 := lb5; +lb65 := lb5; +lb84 := lb1; + +numeric hb[]; + +hb1 := 4onelineh; +hb2 := hb1; +hb3 := hb1; +hb4 := hb1; +hb5 := 4onelineh; +hb6 := hb5; +hb25 := 4onelineh; +hb41 := hb25; +hb65 := hb25; +hb84 := 3/2hb1; + +numeric lyc[]; +lyc1 := 0; +lyc2 := lyc1 + hb41; +lyc3 := lyc2 + upshift + hb6; +lyc5 := lyc3 + hb5; +lyc4 := 1/2[lyc3,lyc5]; +lyc6 := lyc5 + upshift; +lyc7 := lyc5 + 4upshift + hb25; +lyc8 := lyc7 + 1/2hb1; +lyc9 := lyc8 + upshift; + +numeric cx[]; +cx1 := 0; +cx2 := cx1 + sideshift; +cx3 := cx2 + sideshift + lb25; +cx4 := cx3 + sideshift + lb1; +cx5 := cx4 + sideshift + lb41; +cx6 := cx5 + sideshift + lb5; +cx7 := cx6 + sideshift + lb65; +cx8 := cx7 + lb4; +cx9 := cx8 + sideshift; + +%%% Modified geometry +z41=(cx4,lyc1); +drawdrum(41, lb41, hb41)(btex \threelines{Modified}{Geometry}{Data} etex); +%%dotlabel.llft("41", z41); + +%%% Optimize Geometry (A6) +z52=(cx5,lyc2); +drawENT(52, lb6, hb6)(btex \threelines{Optimize}{Geometry}{(A6)} etex); +%%dotlabel.llft("52", z52); + +%%% Adaptive Modification (A5) +z53=(cx5,lyc3); +drawENT(53, lb5, hb5)(btex \fourlines{Adaptive}{Modification}{to Model and}{Process (A5)} etex); +%%dotlabel.llft("53", z53); + +%%% Initial Geometry +z25=(cx2,lyc5); +drawdrum(25, lb25, hb25)(btex \twolines{Geometry}{Data} etex); +%%dotlabel.llft("25", z25); + +%%% Aerodynamic data +z65=(cx6,lyc5); +drawdrum(65, lb65, hb65)(btex \twolines{Aerodynamic}{Data} etex); +%%dotlabel.llft("65", z65); + + +%%% Acquire & Modify Geometery (A1) +z37=(cx3,lyc7); +drawENT(37, lb1, hb1)(btex \fourlines{Acquire and}{Modify}{Geometry}{(A1)} etex); +%%dotlabel.llft("37", z37); + + +%%% Extract Engineering Data (A4) +z77=(cx7,lyc7); +drawENT(77, lb4, hb4)(btex \threelines{Extract}{Engineering}{Data (A4)} etex); +%%dotlabel.llft("77", z77); + +%%% Build Computational Model (A2) +z57=(cx5,lyc7); +drawENT(57, lb2, hb2)(btex \threelines{Build}{Computational}{Model (A2)} etex); +%%dotlabel.llft("57", z57); + +%%% Compute Flowfield (A3) +z67=(cx6,lyc7); +drawENT(67, lb3, hb3)(btex \threelines{Compute}{Flowfield}{(A3)} etex); +%%dotlabel.llft("67", z67); + +%%% End Users +z84=(cx8,lyc4); +drawASDT(84, lb84, hb84)(btex \twolines{END}{USERS} etex); +%%dotlabel.llft("84", z84); + + +%%%%%%%%%%%%%%%%%%%%%%% lines + +%%% Geometry INPUT +z18=(cx1,lyc8); +VH(25tml,18); +drawnormal(18, 25tml.vh); +drawnormalCA(25tml.vh, 25tml); +smooth(18, 25tml.vh, 25tml); +label.top(btex Geometry etex, z18); + +%%% Geom -> A1 (25-37) +VH(25tmr, 37ml); +drawnormal(25tmr, 25tmr.vh); +drawnormalCA(25tmr.vh, 37ml); +smooth(25tmr, 25tmr.vh, 37ml); + +%%% A1 -> Modified Geom (37-41) +VH(41tml, 37mr); +drawnormalthreeCA(37mr, 41tml.vh, 41tml); +smooth(37mr, 41tml.vh, 41tml); + +%%% Modified Geom -> A2 (41-57) +VH(41tm, 57ml); +drawnormalthreeCA(41tm, 41tm.vh, 57ml); +smooth(41tm, 41tm.vh, 57ml); + +%%% Adaptive A5 -> Mod Geom (53-41) & A6 -> Mod Geom (52-41) +VH(41tmr, 53ml); +drawnormalthreeCA(53ml, 41tmr.vh, 41tmr); +z42=(x41tmr, y52ml); +drawnormal(52ml,42); +smooth(53ml, 41tmr.vh, 41tmr); +smooth(52ml, 42, 41tmr); + +%% Aero Data -> Adapt mod (A5) & Opt Geom (A6) (65-53,52) +VH(65bm, 52mr); +drawnormalthreeCA(65bm, 65bm.vh, 52mr); +z63=(x65bm, y53mr); +drawnormalCA(63, 53mr); +smooth(65bm, 65bm.vh, 52mr); +smooth(65bm, 63, 53mr); + +%% Mod Geom -> USERS (41-84) +z84A=1/4[z84bl,z84tl]; +%%HvH(41mr, 84A); +HxH(41mr, 77bm, 84A) +drawnormalfourCA(41mr, 41mr.hxh, 84A.hxh, 84A); +smoothtwo(41mr, 41mr.hxh, 84A.hxh, 84A); + +%% Aero -> Model (65-57) +VhV(65tml, 57bm); +drawnormalthreeCA(65tml.vhv, 57bm.vhv, 57bm); +drawnormalCA(65tml.vhv, 65tml); +smoothtwo(65tml, 65tml.vhv, 57bm.vhv, 57bm); + +%% Aero -> Flowfield (65-67) +drawnormalCA(65tm,67bm); +drawnormalCA(67bm,65tm); + +%% Aero -> Data (65-77) +VhV(65tmr, 77bm); +drawnormalthreeCA(65tmr.vhv, 77bm.vhv, 77bm); +drawnormalCA(65tmr.vhv, 65tmr); +smoothtwo(65tmr, 65tmr.vhv, 77bm.vhv, 77bm); + +%% Aero -> USERS (65-84) +z84B=(x84bl, y65mr); +drawnormalCA(65mr, 84B); + +%% Data -> USERS (77-84) +VH(84tm,77mr); +drawnormalthreeCA(77mr, 84tm.vh, 84tm); +smooth(77mr, 84tm.vh, 84tm); + + +%%%%%%%%% test smoothed dashed/dotted line +VH(25bm,41ml); +%%drawdashthree(25bm, 25bm.vh, 41ml); +%%smoothdash(25bm, 25bm.vh, 41ml); +drawdotsthree(25bm, 25bm.vh, 41ml); +smoothdots(25bm, 25bm.vh, 41ml); + +endfig; % end fig 3 + +%%%%%%%%%%%%%%%%%%%%%%% +%%end +%%%%%%%%%%%%%%%%%%%%%%%%% + +beginfig(1) % IDEF A0 model + +%%%%drawgrid; + +smoothrad := 2u; + +numeric lb, hb; % length & height of boxes +lb := namespace(btex Analysis Process A0 etex)(nextra); +hb := 5onelineh; + +numeric hspace[]; +hspace1 := namespace(btex Geometry (ISO 10303-203, or other source) etc etex)(ndextra); + +numeric upshift; % vertical distance between rows +upshift = 20u; +numeric sideshift; % horizontal distance between boxes +sideshift = 10u; + +numeric lyc[]; +lyc1 := 0; +lyc2 := lyc1;% +upshift; +lyc3 := lyc2+upshift; +lyc4 := lyc3+upshift+hb; +lyc5 := lyc4;% +upshift; + +%%%%%%%%%%%%%%%%%%%% A0 box +z33=(hspace1,lyc3); +drawENT(33, lb, hb)(btex \threelines{Computational}{Fluid Dynamics}{Analysis Process} etex); +label.ulft(btex A0 etex, z33br); + +%%%%%%%%%%%%%%%%%%%%%%%%% Inputs +z33A=1/8[z33bl,z33tl]; +z33B=z33ml; +z33C=7/8[z33bl,z33tl]; +z13=(0,y33A); z14=(0,y33B); z15=(0,y33C); +drawnormalCA(13,33A); +label.urt(btex Analysis Objectives etex, z13); +drawnormalCA(14,33B); +label.urt(btex Definition of Expected Flow Physics etex, z14); +drawnormalCA(15,33C); +label.urt(btex Geometry (ISO 10303-203, or other source) etex, z15); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Outputs +z33D=1/8[z33br,z33tr]; +z33E=z33mr; +z33F=7/8[z33br,z33tr]; + +hspace2 := x33br+namespace(btex Flowfield Data etex)(ndextra); +z63=(hspace2,y33D); z64=(hspace2,y33E); z65=(hspace2,y33F); +drawnormalCA(33D,63); +label.rt(btex Flowfield Data etex, z63); +drawnormalCA(33E,64); +label.rt(btex Optimized Geometry etex, z64); +drawnormalCA(33F,65); +label.rt(btex \twolines{Information to Analysis}{Customer} etex, z65); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Resources +hspace3 := namespace(btex Organizational etex)(ndextra); +z33G=1/5[z33bl,z33br]; +z33H=2/5[z33bl,z33br]; +z33I=3/5[z33bl,z33br]; +z33J=4/5[z33bl,z33br]; +hspace4 :=1/5lb; + +x41=x33bm + 1/2hspace4 + 1/2hspace3; +x51=x41+hspace3+hspace4; +x31=x41-hspace3-hspace4; +x21=x31-hspace3-hspace4; +y21=y31=y41=-y51=lyc1; +label.bot(btex \twolines{Trained}{Staff} etex, z21); +label.bot(btex \twolines{Computing}{Practices} etex, z31); +label.bot(btex \twolines{Organizational}{Best Practices} etex, z41); +label.bot(btex \twolines{Support}{Infrastructure} etex, z51); + +y1=1/3[lyc1,lyc3]; y2=2/3[lyc1,lyc3]; + +VyV(21,2,33G); +drawnormalthree(21, 21vyv, 33G.vyv); +drawnormalCA(33G.vyv, 33G); +smooth(21, 21vyv, 33G.vyv); %smooth(21vyv, 33G.vyv, 33G); +smooth(33G, 33G.vyv, 21vyv); +VyV(31,1,33H); +drawnormalthree(31, 31vyv, 33H.vyv); +drawnormalCA(33H.vyv, 33H); +smoothtwo(31, 31vyv, 33H.vyv, 33H); +VyV(41,1,33I); +drawnormalthree(41, 41vyv, 33I.vyv); +drawnormalCA(33I.vyv, 33I); +smoothtwo(41, 41vyv, 33I.vyv, 33I); +VyV(51,2,33J); +drawnormalthree(51, 51vyv, 33J.vyv); +drawnormalCA(33J.vyv, 33J); +smooth(51, 51vyv, 33J.vyv); smooth(51vyv, 33J.vyv, 33J); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Controls +z33M=1/4[z33tl,z33tr]; +z33N=3/4[z33tl,z33tr]; + +z35=(x31,lyc5); z45=(x41,lyc5); +label.top(btex \threelines{Mathematical}{Model of Fluid}{Dynamics} etex, z35); +label.top(btex \twolines{Computing}{Implementation} etex, z45); +VhV(33M,35); +drawnormalthree(35, 35vhv, 33M.vhv); +drawnormalCA(33M.vhv, 33M); +smoothtwo(35, 35vhv, 33M.vhv, 33M); +VhV(33N,45); +drawnormalthree(45, 45vhv, 33N.vhv); +drawnormalCA(33N.vhv, 33N); +smoothtwo(45, 45vhv, 33N.vhv, 33N); + +endfig; % end fig 1 + + + +beginfig(2) % IDEF A1+ model + +%%%%drawgrid; + +numeric lb[]; +numeric hb; % length & height of boxes +lb1 := namespace(btex Acquire and etex)(nextra); +lb2 := namespace(btex Computational etex)(nextra); +lb3 := namespace(btex Flow Field etex)(nextra); +lb4 := namespace(btex Engineering etex)(nextra); +lb5 := namespace(btex Modification to etex)(nextra); +lb6 := lb5; +hb := 4onelineh; + +numeric hspace[]; +hspace1 := namespace(btex Geometry (ISO 10303-203, or other source) etc etex)(ndextra); + +numeric upshift; % vertical distance between rows +upshift = 12u; +numeric sideshift; % horizontal distance between boxes +sideshift = 10u; + +numeric lyc[]; +lyc1 := 0; +lyc2 := lyc1+1/2upshift; +lyc3 := lyc2+upshift; +lyc4 := lyc3+1/2upshift+hb; +lyc5 := lyc4+1/2upshift+hb; +lyc6 := lyc5+1/2upshift+hb; +lyc7 := lyc6 + 1/2upshift + hb; +lyc8 := lyc7 + 1/2upshift; +lyc9 := lyc8 + 1/2upshift; +lyc10 := lyc9+upshift; +lyc11 := lyc10+upshift; + +numeric cx[]; +cx1 := 0; +cx2 := cx1+sideshift; +cx3 := cx2+sideshift; +%%cx4 := cx3+sideshift; +cx5 := cx3 + 5/4sideshift + lb1; +%%cx6 := cx5+sideshift; +cx7 := cx5+sideshift+lb2; +%%cx8 := cx7+sideshift; +cx9 := cx7 + 3/4sideshift + lb3; +%%cx10 := cx9+sideshift; +cx11 := cx9 + 3/4sideshift + lb4; +cx12 := cx11+sideshift; + +%%%%%%%%%%%%%%%%%%%% A1 box +z36=(cx3,lyc6); +drawENT(36, lb1, hb)(btex \threelines{Acquire and}{Modify}{Geometry} etex); +label.ulft(btex A1 etex, z36br); +%%dotlabel.urt("z36", z36); + +%%%%%%%%%%%%%%%%%%%% A2 box +z55=(cx5,lyc5); +drawENT(55, lb2, hb)(btex \threelines{Build}{Computational}{Model (Grid)} etex); +label.ulft(btex A2 etex, z55br); +%%dotlabel.urt("z55", z55); + +%%%%%%%%%%%%%%%%%%%% A3 box +z74=(cx7,lyc4); +drawENT(74, lb3, hb)(btex \twolines{Compute}{Flowfield} etex); +label.ulft(btex A3 etex, z74br); +%%dotlabel.urt("z74", z74); + +%%%%%%%%%%%%%%%%%%%% A4 box +z93=(cx9,lyc3); +drawENT(93, lb4, hb)(btex \threelines{Extract}{Engineering}{Data} etex); +label.ulft(btex A4 etex, z93br); +%%dotlabel.urt("z93", z93); + +%%%%%%%%%%%%%%%%%%%% A5 box +z116=(cx11,lyc6); +drawENT(116, lb5, hb)(btex \fourlines{Adaptive}{Modification to}{Model and}{Process} etex); +label.ulft(btex A5 etex, z116br); +%%dotlabel.urt("z116", z116); + +%%%%%%%%%%%%%%%%%%%% A6 box +z114=(cx11+1/2sideshift,lyc4); +drawENT(114, lb6, hb)(btex \twolines{Optimize}{Geometry} etex); +label.ulft(btex A6 etex, z114br); +%%dotlabel.urt("z114", z114); + +%%%%%%%%%% Computing Implementation CONTROL + +z36A=z36tm; z55A=z55tm; z74A=1/4[z74tl,z74tr]; z93A=z93tm; z116A=z116tm; +x114A=1/2[x116br,x114br]; y114A=y114tr; + +x38=x36A; x58=x55A; x78=x74A; x98=x93A; x1168=x116A; x1148=x114A; +y38=y58=y78=y98=y1168=y1148=lyc8; + +drawnormal(38,1148); +drawnormalCA(38,36A); +drawnormalCA(58,55A); +drawnormalCA(78,74A); +drawnormalCA(98,93A); +drawnormalCA(1168,116A); +drawnormalCA(1148,114A); +%%dotlabel.lft("z38", z38); +%%dotlabel.rt("z1148", z1148); +smooth(36A, 38, 58); +smooth(55A, 58, 78); +smooth(58, 78, 74A); +smooth(78, 98, 93A); +smooth(98, 1168, 116A); +smooth(1168, 1148, 114A); + +z55B=3/4[z55tl,z55tr]; +z59=(x55B,lyc9); z58B=(x55B,lyc8); +drawnormal(59,58B); +label.top(btex \twolines{Computing}{Implementation} etex, z59); +smooth(59, 58B, 58); +smooth(59, 58B, 78); + +drawnormal(1168,58); + +%%%%%%%%%%%%%%%%% Math Model CONTROL + +z74B=3/4[z74tl,z74tr]; +z79=(x74B,lyc9); + +drawnormalCA(79,74B); +label.top(btex \twolines{Mathematical Model}{of Fluid Dynamics} etex, z79); + + +%%%%%%%%%%%%%%%%%%%% Support Infrastructure RESOURCE + +z93F=4/5[z93bl,z93br]; +z74F=4/5[z74bl,z74br]; +z55F=4/5[z55bl,z55br]; +z36F=4/5[z36bl,z36br]; +x92F=x93F; x72F=x74F; x52F=x55F; x32F=x36F; +y92F=y72F=y52F=y32F=lyc2; + +drawnormal(32F,92F); + +x82F=1/2[x74br,x93bl]; +y82F=y92F; +z81F=(x82F,lyc1); +drawnormal(81F,82F); +label.bot(btex \twolines{Support}{Infrastructure} etex, z81F); + +drawnormalCA(92F,93F); +drawnormalCA(72F,74F); +drawnormalCA(52F,55F); +drawnormalCA(32F,36F); +smooth(93F, 92F, 72F); +smooth(92F, 72F, 74F); +smooth(72F, 52F, 55F); +smooth(52F, 32F, 36F); + +smooth(81F, 82F, 92F); +smooth(81F, 82F, 72F); + +drawnormal(52F,72F); + +%%%%%%%%%%%%%%%%%%%%%%% Practices RESOURCE + +z93E=3/5[z93bl,z93br]; +z74E=3/5[z74bl,z74br]; +z55E=3/5[z55bl,z55br]; +z36E=3/5[z36bl,z36br]; +x92E=x93E; x72E=x74E; x52E=x55E; x32E=x36E; +y92E=y72E=y52E=y32E=1/4[lyc2,lyc3]; + +drawnormal(32E,92E); + +x62E=1/2[x55br,x74bl]; +y62E=y92E; +z61E=(x62E,lyc1); +drawnormal(61E,62E); +label.bot(btex \twolines{Organizational}{Best Practices} etex, z61E); + +drawnormalCA(92E,93E); +drawnormalCA(72E,74E); +drawnormalCA(52E,55E); +drawnormalCA(32E,36E); +smoothtwo(61E, 62E, 92E, 93E); +smoothtwo(61E, 62E, 32E, 36E); +smooth(62E, 72E, 74E); +smooth(62E, 52E, 55E); + +%%%%%%%%%%%%%%%%%%%%%%% Computing Assets RESOURCE + +z93D=2/5[z93bl,z93br]; +z74D=2/5[z74bl,z74br]; +z55D=2/5[z55bl,z55br]; +z36D=2/5[z36bl,z36br]; +x92D=x93D; x72D=x74D; x52D=x55D; x32D=x36D; +y92D=y72D=y52D=y32D=2/4[lyc2,lyc3]; + +drawnormal(32D,92D); + +x42D=1/2[x36br,x55bl]; +y42D=y92D; +z41D=(x42D,lyc1); +drawnormal(41D,42D); +label.bot(btex \twolines{Computing}{Assets} etex, z41D); + +drawnormalCA(92D,93D); +drawnormalCA(72D,74D); +drawnormalCA(52D,55D); +drawnormalCA(32D,36D); + +smoothtwo(41D, 42D, 92D, 93D); +smoothtwo(41D, 42D, 32D, 36D); +smooth(42D, 72D, 74D); +smooth(42D, 52D, 55D); + + +%%%%%%%%%%%%%%%%%%%%%%% Staff RESOURCE + +z93C=1/5[z93bl,z93br]; +z74C=1/5[z74bl,z74br]; +z55C=1/5[z55bl,z55br]; +z36C=1/5[z36bl,z36br]; +x92C=x93C; x72C=x74C; x52C=x55C; x32C=x36C; +y92C=y72C=y52C=y32C=3/4[lyc2,lyc3]; + +drawnormal(32C,92C); + +x42C=1/2[x36br,x55bl]; +y42C=y92C; +z41C=(x62C,lyc1); +z31C=(x36C,lyc1); +drawnormal(31C,32C); +label.bot(btex \twolines{Trained}{Staff} etex, z31C); + +drawnormalCA(92C,93C); +drawnormalCA(72C,74C); +drawnormalCA(52C,55C); +drawnormalCA(32C,36C); + +smooth(93C, 92C, 72C); +smooth(74C, 72C, 52C); +smooth(55C, 52C, 32C); +smooth(31C, 32C, 52C); + +drawnormal(72C,32C); +drawnormal(31C,32C); + +%%%%%%%%%%%%%%%%% Geometry INPUT + +x36G=x36; y36G=2/3[y36bl, y36tl]; +z16G=(cx1, y36G); +drawnormalCA(16G, 36G); +label.ulft(btex Geometry etex, z36G); + +%%%%%%%%%%%%%%%%%% Optimized Geometry OUTPUT + +x114P=x114br; y114P=1/3[y114br,y114tr]; +z124P=(x114P+sideshift, y114P); +drawnormalCA(114P,124P); +label.lrt(btex \twolines{Optimized}{Geometry} etex, z114P); + +%%%%%%%%%%%%%%%%%%%% A6 -> A2 + +x114L=x114br; y114L=2/3[y114br,y114tr]; +z124L=(x114L+sideshift, y114L); +drawnormal(114L,124L); + +x55H=x55bl; y55H=4/6[y55bl,y55tl]; +x45H=2/4[x36br,x55H]; y45H=y55H; +drawnormalCA(45H,55H); + +y97A=2/3[y116tl,lyc8]; +VyV(45H, 97A, 124L); +drawnormalfour(45H, 45H.vyv, 124L.vyv, 124L); +smoothtwo(114L, 124L, 124L.vyv, 45H.vyv); +smoothtwo(124L.vyv, 45H.vyv, 45H, 55H); + +%%%%%%%%%%%%%%%%%%%%%%%% A1 -> A2 + +x36M=x36br; y36M=y36mr; +x55I=x55bl; y55I=3/6[y55bl,y55tl]; +x45I=1/4[x36M,x55I]; +HxH(36M, 45I, 55I); +drawnormalthree(36M, 36M.hxh, 55I.hxh); +drawnormalCA(55I.hxh, 55I); +smoothtwo(36M, 36M.hxh, 55I.hxh, 55I); + +%%%%%%%%%%%%%%%%%%%%%%% A2 -> A3 + +x55M=x55br; y55M=y55mr; +x74H=x74bl; y74H=3/5[y74bl,y74tl]; +x64H=1/3[x55M,x74H]; +HxH(55M, 64H, 74H); +drawnormalthree(55M, 55M.hxh, 74H.hxh); +drawnormalCA(74H.hxh, 74H); +smoothtwo(55M, 55M.hxh, 74H.hxh, 74H); + + +%%%%%%%%%%%%%%%%%%%%%% A3 -> A4 + +x74N=x74br; y74N=1/3[y74br,y74tr]; +x93G=x93bl; y93G=3/4[y93bl,y93tl]; +x83G=1/2[x74N,x93G]; +HxH(74N, 83G, 93G); +drawnormalthree(74N, 74N.hxh, 93G.hxh); +drawnormalCA(93G.hxh,93G); +smoothtwo(74N, 74N.hxh, 93G.hxh, 93G); + +%%%%%%%%%%%%%%%%%%%%%% A4 -> A5 + +x93L=x93br; y93L=4/5[y93br,y93tr]; +x116H=x116bl; y116H=1/3[y116bl,y116tl]; +x106H=1/3[x93L,x116H]; +HxH(93L, 106H, 116H); +drawnormalthree(93L, 93L.hxh, 116H.hxh); +drawnormalCA(116H.hxh, 116H); +smoothtwo(93L, 93L.hxh, 116H.hxh, 116H); + +%%%%%%%%%%%%%%%%%%%%%%% A4 -> A6 + +x93M=x93br; y93M=3/5[y93br,y93tr]; +x114H=x114bl; y114H=1/2[y114bl,y114tl]; +x104H=1/2[x93M,x114H]; +HxH(93M, 104H, 114H); +drawnormalthree(93M, 93M.hxh, 114H.hxh); +drawnormalCA(114H.hxh, 114H); +smoothtwo(93M, 93M.hxh, 114H.hxh, 114H); + +%%%%%%%%%%%%%%%%%%%%%% A3 -> A5 + +x74M=x74br; y74M=2/3[y74br,y74tr]; +x116J=x116bl; y116J=2/3[y116bl,y116tl]; +x106J=2/3[x74N,x116J]; +HxH(74M, 106J, 116J); +drawnormalthree(74M, 74M.hxh, 116J.hxh); +drawnormalCA(116J.hxh,116J); +smoothtwo(74M, 74M.hxh, 116J.hxh, 116J); + +%%%%%%%%%%%%%%%%%%%% A5 -> A2 + +x116N=x116br; y116N=1/3[y116br,y116tr]; +x126N=2/3[x114L,x124L]; y126N=y116N; +drawnormal(116N,126N); + +x55G=x55bl; y55G=5/6[y55bl,y55tl]; +x45G=3/4[x36br,x55G]; y45G=y55G; +drawnormalCA(45G,55G); + +y97B=2/3[y116tl,y97A]; +VyV(45G, 97B, 126N); +drawnormalfour(45G, 45G.vyv, 126N.vyv, 126N); +smoothtwo(116N, 126N, 126N.vyv, 45G.vyv); +smoothtwo(126N.vyv, 45G.vyv, 45G, 55G); + +%%%%%%%%%%%%%%%%%%%% A5 -> A3 + +x116M=x116br; y116M=2/3[y116br,y116tr]; +x126M=1/3[x114L,x124L]; y126M=y116M; +drawnormal(116M,126M); + +x74G=x74bl; y74G=4/5[y74bl,y74tl]; +x64G=2/3[x55br,x74G]; y64G=y74G; +drawnormalCA(64G,74G); + +y97C=1/3[y116tl,y97A]; +VyV(64G, 97C, 126M); +drawnormalfour(64G, 64G.vyv, 126M.vyv, 126M); +smoothtwo(116M, 126M, 126M.vyv, 64G.vyv); +smoothtwo(126M.vyv, 64G.vyv, 64G, 74G); + + +%%%%%%%%%%%%%%%%%%%%%% Analysis Objectives INPUT + +x36J=x36bl; y36J=1/3[y36bl, y36tl]; +x93I=x93bl; y93I=2/4[y93bl, y93tl]; +x25=cx2; y25=1/2[y55,y36]; +z15=(cx1,y25); +label.ulft(btex \twolines{Analysis}{Objectives} etex, z25); +HxH(36J, 25, 93I); +drawnormalCA(36J.hxh, 36J); % to A1 +drawnormalCA(93I.hxh, 93I); % to A4 +drawnormal(15,25); +drawnormal(36J.hxh,93I.hxh); +smoothtwo(15, 25, 36J.hxh, 36J); +smoothtwo(15, 25, 93I.hxh, 93I); + +x55J=x55bl; y55J=2/6[y55bl,y55tl]; % to A2 +z25J=(x25,y55J); +drawnormalCA(25J,55J); +smooth(25, 25J, 55J); + +x74J=x74bl; y74J=2/5[y74bl,y74tl]; % to A3 +z24J=(x25,y74J); +drawnormalCA(24J,74J); +smooth(25, 24J, 74J); + +%%%%%%%%%%%%%%%%%%%%%% Flow Physics INPUT + + +x55K=x55bl; y55K=1/6[y55bl,y55tl]; % to A2 +x93J=x93bl; y93J=1/4[y93bl, y93tl]; % to A4 +x25B=1/3[cx2,cx3]; y25B=1/2[y93,y74]; +z15B=(cx1,y25B); +z25C=(x25,y25B); +label.ulft(btex \threelines{Definition of}{Expected Flow}{Physics} etex, z25C); +HxH(55K, 25B, 93J); +drawnormalCA(55K.hxh, 55K); % to A2 +drawnormalCA(93J.hxh, 93J); % to A4 +drawnormal(15B,25B); +drawnormal(55K.hxh, 93J.hxh); +smoothtwo(15B, 25B, 55K.hxh, 55K); +smoothtwo(15B, 25B, 93J.hxh, 93J); + +x74K=x74bl; y74K=1/5[y74bl,y74tl]; % to A3 +z24K=(x25B,y74K); +drawnormalCA(24K,74K); +smooth(25B, 24K, 74K); + +%%%%%%%%%%%%%%%%%%%%%% Flowfield & Customer OUTPUT + +x93N=x93br; y93N=2/5[y93br,y93tr]; +z103N=(x114, y93N); +drawnormalCA(93N,103N); +label.urt(btex Flowfield Data etex, z103N); + +x93P=x93br; y93P=1/5[y93br,y93tr]; +z103P=(x103N,y93P); +drawnormalCA(93P,103P); +label.lrt(btex \twolines{Information to}{Analysis Customer} etex, z103P); + + + +endfig; % end fig 2 + +end + diff --git a/Master/texmf-dist/metapost/expressg/expeg.mp b/Master/texmf-dist/metapost/expressg/expeg.mp new file mode 100644 index 00000000000..d8c5d64982f --- /dev/null +++ b/Master/texmf-dist/metapost/expressg/expeg.mp @@ -0,0 +1,1357 @@ +%% +%% This is file `expeg.mp', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% expressg.dtx (with options: `eg') +%% +%% Author: Peter Wilson (CUA) now at peter.r.wilson@boeing.com until June 2004 +%% (or pandgwilson@earthlink.net) +%% Copyright 1996, 2003 Peter R. Wilson +%% +%% v1.0 1996/05/09 (first release) +%% v1.2 1999/11/15 +%% v1.3 2000/05/22 +%% v1.4 2000/07/10 +%% v1.5 2003/07/31 +%% v1.6 2004/02/29 +%% v1.61 2004/03/17 +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% This program is provided under the terms of the +%% LaTeX Project Public License distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% +%%% EXPEG.MP Example MetaPost EXPRESS-G diagrams + + +verbatimtex \def\twolines#1#2{\vbox{\hbox{#1} \hbox{#2}}} etex + +input expressg + +beginfig(1) + +z1=(0,0); +drawEXPRESSION(1); + +z2bl=z1tr; +drawINTEGER(2); + +z3bl=z2tr; +drawBOOLEAN(3); + +z4bm=z3tm; +drawcirclebox(4, namespace(btex ABS etex)(nextra))(btex ABS etex); + +numeric diam; +diam = namespace(btex ABS etex)(nextra); + +z5bm=z4tm; +drawcirclebox(5, diam)(btex SAB etex); + +x5ml-x5tl = x5tr-x6bl; +y6mr=y5tm; +drawENT(6, pconl, enth)(btex an\_ent etex); + +z7bm=(x6tm,y6tm+u); +drawLEVENT(7, pconl, eventh)(btex levent etex); + +z8=(x7tl, y7tr+u); +drawGEVENT(8, pconl, eventh)(btex gevent etex); + +z9br=1/8[z3tl,z3tr]; +drawSCHEMA(9, pconl, schemah)(btex a\_schema etex); + +numeric xmid, len; +xmid = x8tr + diam; +len = 2diam; + +z11=(xmid, y1ml); z111=z11 shifted (len, 0); +drawdashO(11, 111); + +pair moveright; +moveright = (len, 0); + +z12=(xmid, y2ml); z121=z12 shifted moveright; +drawnormalO(12, 121); + +z13=(xmid, y3ml); z131=z13 shifted moveright; +drawthickO(13, 131); + +pair moveup; +moveup = (0, y13-y12); + +z14=z13 shifted moveup; z141=z14 shifted moveright; +drawnormalD(14, 141); + +z15=z14 shifted moveup; z151=z15 shifted moveright; +drawnormalCA(15, 151); + +z16=z15 shifted moveup; z161=z16 shifted moveright; +drawnormalOA(16, 161); + +z17=z16 shifted moveup; z171=z17 shifted moveright; +drawnormalF(17, 171); + +z300=(0,y8tm+diam); z301=(x111,y300); +draw z300--z301 dashes; + +numeric mup; mup := onelineh; + +z302=(0,y300+mup); +drawcardbox(302, pconl, onelineh, 1/4onelineh)(""); + +z303bm=(x302tm, y302tm+mup); +drawdiamondbox(303, pconl, 2onelineh)(btex jewel etex); + +z304=(0, y303tm+mup); +drawdoublerectangle(304, pconl, 2onelineh, 3/4); +label(btex top etex, z304ct); + +z305=(0, y304tm+mup); +drawtriplerectangle(305, pconl, 3onelineh, 2/5, 0.2); +label(btex top etex, z305ct); +label("middle", z305cm); + +z306=(0,y305tm+mup); +drawindexbox(306, 2pconl, 3onelineh, 3/4pconl, onelineh)(btex pack etex); +z307=1/8[z306bl,z306tr]; +drawENT(307, 1/4pconl, onelineh)(btex E etex); + +z308=(0, y306P.tl+mup); +z309ml=z308c; +drawcardbox(308, pconl, 2onelineh, 1/4onelineh)(btex covered etex); +drawdashboxover(309, pconl, onelineh); + +z310bm=(x306bm,y309tm+mup); +drawovalbox(310, 2pconl, 2onelineh)(""); + +z311ml=(x310mr+mup, y310ml); +drawroundedbox(311, 2pconl, 2onelineh, 1/2onelineh)("rounded"); + +z312ml=(x311mr+mup, y311mr); +drawroundedbox(312, 2pconl, 2onelineh, 3/2onelineh)(btex large radius etex); + +z314=(x312bm-1/4pconl, y312bm-1/2mup); +hiderectangle(314, 1/2pconl, (3/2onelineh + mup)); + +z315tm=(x312bm, y312bm-mup); +drawdashellipse(315, 2pconl, 2onelineh); + +z316tm=(x315bm, y315bm-mup); +drawdashcircle(316, diam); + +z317bc=(x311bm,y304br); +drawdrum(317, pconl, 3onelineh)(btex drum etex); +z317A=(x317tc, y317tc+2onelineh); +drawnormalthree(317tml, 317A, 317tmr); +smooth(317tml, 317A, 317tmr); + +z320bm = (x317bm, y302); +drawstickman(320, onelineh, 2onelineh); + +z325bm = (x320bm, y306); +drawoutputbox(325, pconl, 2onelineh)(btex output etex); + +z330 = (x320bm, y309ml); +drawCircledDot(330, 3/2onelineh); + +z401bm=(1/2[x11,x111], y301+mup); +drawcircleA(401, diam); + +z402=(xmid, y401tm+mup); z502=(x111, y402); +drawdashA(402, 502); + +z403=(xmid, y402+mup); z503=(x111, y403); +drawdashOA(403, 503); + +z404=(xmid, y403+mup); z504=(x111, y404); +drawnormalOD(404, 504); + +z405=(xmid, y404+mup); z505=(x111, y405); +drawnormalCD(405, 505); + +z406=(xmid, y405+mup); z506=(x111, y406); +drawnormalDCA(406, 506); + +numeric ang; ang = 180/7; +z600=(xmid, y406+2mup); +z699=(x600+len, y600); +z601=z699 rotatedaround(z600, ang); +z602=z699 rotatedaround(z600, 2ang); +z603=z699 rotatedaround(z600, 3ang); +z604=z699 rotatedaround(z600, 4ang); +z605=z699 rotatedaround(z600, 5ang); +z606=z699 rotatedaround(z600, 6ang); +z607=z699 rotatedaround(z600, 7ang); +drawnormalCA(600,601); +drawnormalOA(600,602); +drawnormalF(600,603); +drawdashA(600,604); +drawnormalOD(600,605); +drawnormalCD(600,606); + +endfig; % end figure 1 + +beginfig(2) % schema level model + +numeric lb, hb; % length & height of boxes +lb=20u; hb=schemah; +numeric upshift; % vertical distance between rows +upshift = 20u; +numeric sideshift; % horizontal distance between boxes +sideshift = 10u; + +%%% bottom row + +z9=(lb+sideshift,0); +drawSCHEMA(9, lb, hb)("nine"); + +z11=(x9br+sideshift,y9); +drawSCHEMA(11, lb, hb)("eleven"); + +%%% middle row + +z1=(0,y9tl+upshift); +drawSCHEMA(1, lb, hb)("one"); + +z3=(x1br+sideshift, y1); +drawSCHEMA(3, lb, hb)("three"); + +z5=(x3br+sideshift, y1); +drawSCHEMA(5, lb, hb)("five"); + +z7=(x5br+sideshift, y1); +drawSCHEMA(7, lb, hb)("seven"); + +%%% top row + +x50 = 1/2[x3br,x5bl]; +z31bm=(x50,y1tl+upshift); +drawSCHEMA(31, lb, hb)("thirtyone"); + +%%% connectors + +drawdashOO(9tm, 3bm); % three/nine +drawdashO(5bm, 11tm); % five/eleven +drawdashO(3ml, 1mr); % three/one +drawdashO(3mr, 5ml); % three/five +drawdashOO(9mr, 11ml); % nine/eleven + +%%% thirtyone/nine +z90=((x1bl-sideshift), y9ml); +z31A=3/4[z31bl,z31tl]; +VH(90, 31A); +drawdashO(90vh, 31A); +drawdashthreeO(90vh, 90, 9ml); +pickup thickpen; +draw z90; +pickup normalpen; +label.lft("z90", z90); + +%%% one/eleven +z1A=1/3[z1bl,z1br]; +z11A=(x11bm, (y11bm-sideshift)); +VH(1A, 11A); +drawdashthree(1A, 1A.vh, 11A); % note it is 1A.vh and not 1Avh +drawdashO(11A, 11bm); +dotlabel.rt("z11A", z11A); +dotlabel.lft("z1A.vh", z1A.vh); % note it is z1A.vh and not z1Avh + +%%% thirtyone/eleven +z31B=3/4[z31br,z31tr]; +x31BC=x7br+sideshift; +HxH(31B, 31BC, 11mr); +drawdashfourO(31B, 31B.hxh, 11mr.hxh, 11mr); + +%%% thirtyone/seven +z31D=1/4[z31br,z31tr]; +VH(7tm, 31D); +drawnormalthreeO(31D, 7tm.vh, 7tm); + +%%% thirtyone/one +z31C=1/4[z31bl,z31tl]; +VH(1tm, 31C); +drawdashO(1tm.vh, 31C); +drawdashO(1tm.vh, 1tm); + +%%% thirtyone/three +z31E=1/4[z31bl,z31br]; +VhV(31E, 3tm); +drawnormalfourO(31E, 31E.vhv, 3tm.vhv, 3tm); + +%%% thirtyone/five +z31F=3/4[z31bl,z31br]; +VhV(31F, 5tm); +drawnormalfourO(31F, 31F.vhv, 5tm.vhv, 5tm); + +%%% labeled arrow +z3111=1/4[z31B,z31B.hxh]; +numeric arrowsize; +arrowsize := schemah; +z3112=(x3111, y3111+arrowsize); +drawnormalCA(3112, 3111); +label.rt(btex an\_import etex, 1/2[z3111, z3112]); + +endfig; % end fig 2 + + +%%%% some commonly used variables & values + +numeric pl, ph; % length & height of numeric page connectors +pl:=pconl; ph:=pconh; % for eg., 9,9 (9,9) +numeric plnamed; % length of named page connector +numeric irh; % height of interschema boxes +irh:=ish; % normally one line of text +numeric sdtl, sdth; % length & height of SDT (e.g. INTEGER) boxes +sdtl:=sdtbl; sdth:=sdtbh; +numeric edtl, edth; % length & height of enum boxes (inset is sdtbs) +edth:=sdtbh; % normally one text line +numeric el, eh; % length & height of entity boxes +eh:=enth; % normally one text line +numeric upshift; % vertical space between rows of boxes +numeric nextup; % vertical space between bases of rows of boxes +picture sindex, pindex; +sindex := btex eleven.Index etex; % interschema reference text +pindex := btex 9,9 Index etex; % page reference text +numeric slindex, plindex; +slindex := namespace(sindex)(nextra); % length of Index interschema +plindex := namespace(pindex)(nextra); % length of Index page reference +numeric hspace[]; % horizontal spaces +numeric lyc[]; % Y coords of box bases + +%%%%%%%%%%% end commonly used variables & values + +beginfig(3) % example fig 3 +%%%drawgrid; + +edtl := namespace(btex standard\_data\_name etex)(niextra); +upshift=2sdth; +nextup=sdth+upshift; +%%% the y coords of box bases +lyc1:=0; +lyc2:=lyc1+nextup; +lyc3:=lyc2+nextup; +lyc4:=lyc3+nextup; +lyc5:=lyc4+nextup; +lyc6:=lyc5+nextup; +lyc7:=lyc6+nextup; +lyc8:=lyc7+nextup; +hspace1 := 1/3edtl; % space between data enums +hspace2 := 2/3edtl; % initial space at start of second row + +%%% bottom two rows (1 & 2) + +z11=(0,lyc1); +drawENUM(11, edtl, edth)(btex coordinates etex); + +z22=(hspace2, lyc2); +drawENUM(22, edtl, edth)(btex solution\_data etex); + +z31=(x11br+hspace1, lyc1); +drawENUM(31, edtl, edth)(btex pressure\_loads etex); + +z42=(x22br+hspace1, lyc2); +drawENUM(42, edtl, edth)(btex nondimensional etex); + +z51=(x31br+hspace1, lyc1); +drawENUM(51, edtl, edth)(btex temperature etex); + +z62=(x42br+hspace1, lyc2); +drawENUM(62, edtl, edth)(btex force\_loads etex); + +%%% third row (horizontal line between 2 & 4 row) + +z13=(x11tm,lyc3); +VyV(11tm, 13, 62tm); +drawnormal(11tm.vyv, 62tm.vyv); +z23=(x22tm,lyc3); z33=(x31tm,lyc3); z43=(x42tm,lyc3); z53=(x51tm,lyc3); +drawnormalO(11tm.vyv,11tm); +drawnormalO(23,22tm); +drawnormalO(33,31tm); +drawnormalO(43,42tm); +drawnormalO(53,51tm); +drawnormalO(62tm.vyv,62tm); + +%%% fourth row + +z3224=1/3[z13,z62tm.vyv]; +z3554=2/3[z13,z62tm.vyv]; + +%%% standard_data_name +z24bm=(x3224,lyc4); +drawSELECT(24, edtl, edth)(btex standard\_data\_name etex); +drawnormal(24bm,3224); + +%%% adhoc_data_name +z54bm=(x3554,lyc4); +drawTYPE(54, edtl, edth)(btex adhoc\_data\_name etex); + +%%% STRING +z64br=(x62br,lyc4); +drawSTRING(64); + +%%% fifth row + +z35=(1/2[x24tm,x54tm], lyc5); +VyV(24tm, 35, 54tm); +drawnormalthreeO(35, 24tm.vyv, 24tm); +drawnormalthreeO(35, 54tm.vyv, 54tm); + +%%% sixth row + +z36bm=(x35,lyc6); +drawSELECT(36,edtl, edth)(btex data\_name etex); +drawnormal(36bm,35); + +%%% data_name +z66=(x62,lyc6); +drawPREF(66, sdtl, ph)(btex 3,1 (4) etex); + +%%%% rest of the connectors + +%%% adhoc/STRING (54, 64) +drawnormalO(54mr,64ml); + +%%% PREF/data_name (36, 66) +drawdashO(66ml,36mr); + +endfig; % end fig 3 + + +beginfig(4) % example 4 +%%%drawgrid; + +%%% length of named page reference boxes +plnamed := namespace(btex 9,9 data\_name etex)(nextra); + +%%% length of entity boxes +el := namespace(btex (ABS) Data\_t etex)(nextra); + +upshift := 2sdth; % vertical space between boxes +nextup := sdth+upshift; % vertical space between bases of boxes +hspace1 := 1/2el; % space between entity boxes + +%%% the y coords of box bases +lyc1:=0; +lyc2:=lyc1+nextup; +lyc3:=lyc2+nextup; +lyc4:=lyc3+nextup; +lyc5:=lyc4+nextup; +lyc6:=lyc5+nextup; +lyc7:=lyc6+nextup; +lyc8:=lyc7+nextup; + +%%%% 2nd row + +%%% IntArray +z12=(0,lyc2); +drawENT(12, el, eh)(btex IntArray etex); + +%%% RealArray +z22=(x12br+hspace1, lyc2); +drawENT(22, el, eh)(btex RealArray etex); + +%%% CharArray +z42=(x22br+hspace1, lyc2); +drawENT(42, el, eh)(btex CharArray etex); + +%%% BitArray +z52=(x42br+hspace1, lyc2); +drawENT(52, el, eh)(btex BitArray etex); + +%%%% 1st row + +z11bm=(x12bm,lyc1); +drawINTEGER(11); + +z21bm=(x22bm,lyc1); +drawREAL(21); + +z41bm=(x42bm,lyc1); +drawSTRING(41); + +z51bm=(x52bm,lyc1); +drawBINARY(51); + +%%% 3rd row + +y13= y23= y43= y53=lyc3; +x13=x12tm; x23=x22tm; x43=x42tm; x53=x52tm; +drawthick(13,53); % horizontal line +%%% vertical connectors +drawthickO(13,12tm); drawthickO(23,22tm); +drawthickO(43, 42tm); drawthickO(53, 52tm); + +z33=1/2[z13,z53]; % midpoint of horizontal line + +%%% 4th row + +%%% Data_t +z34bm=(x33,lyc4); +drawENT(34, el, 3eh)(btex \twolines{(ABS)}{Data\_t} etex); +drawthick(34bm,33); +label.urt("1", z33); % label the connection point + +%%% Index +z14=(0,lyc4); +drawPREF(14, plindex, ph)(pindex); + +%%% INTEGER +z54br=(x51br,lyc4); +drawINTEGER(54); + +%%% 5th row + +lyc5:=y34tm-ph; % change the initial y coord value + +%%% Index +z15=(0,lyc5); +drawPREF(15, plindex, ph)(pindex); + +%%% DataType +z55=(x54,lyc5); +drawPREF(55, plnamed, ph)(btex 3,1 data\_name etex); + +%%% 6th row + +%%% PREF to Data_t +lyc6:=lyc5+nextup; +z36bm=(x34tm,lyc6); +drawPREF(36, pl, ph)(btex 7,5 (6) etex); + +%%%% attributes + +%%% Sizes Data_t/Index (34, 14) +z3414=(x34,y14mr); +drawnormal(3414,14mr); +label.ulft(btex Sizes A[1:Limit] etex, z3414); + +%%% num Data_t/INTEGER (34, 54) +z3454=(x34mr,y54ml); +drawnormalO(3454,54ml); +label.urt(btex (DER) num etex, z3454); + +%%% Limit Data_t/Index (34, 15) +z3415=(x34,y15mr); +drawnormal(3415,15mr); +label.ulft(btex Limit etex, z3415); + +%%% Kind Data_t/data_name (34, 55) +z3455=(x34mr, y55ml); +drawnormal(3455, 55ml); +label.urt(btex Kind etex, z3455); + +%%% PREF into Data_t (36, 34) +drawdashO(36bm, 34tm); + +%%% Data IntArray/INTEGER (12, 11) +drawnormalO(12bm, 11tm); +label.lrt(btex Data A[1:num] etex, z12bm); + +%%% Data RealArray/REAL (22, 21) +drawnormalO(22bm, 21tm); +label.lrt(btex Data A[1:num] etex, z22bm); + +%%% Data CharArray/STRING (42, 41) +drawnormalO(42bm, 41tm); +label.lrt(btex Data A[1:num] etex, z42bm); + +%%% Data BitArray/BINARY (52, 51) +drawnormalO(52bm, 51tm); +label.lrt(btex Data A[1:num] etex, z52bm); + +endfig; % end fig 4 + +beginfig(5) % example 5 +%%drawgrid; + +plnamed := namespace(btex 7,4 Unstructured\_Donor etex)(nextra); + +numeric irls, irll; % length of short and long ISR boxes +irls = namespace(btex eleven.MeshLocation etex)(nextra); +irll = namespace(btex eleven.MeshConnectivityType etex)(nextra); + +upshift := irh; +nextup := irh+upshift; + +numeric maxrx; % max x coordinate value of LH of right column boxes +maxrx := maxx-irrl; +numeric xmid; % x coord of figure center +xmid := 1/2[irls, maxx-irll]; + +el := namespace(btex MeshConnectivity1\_1 etex)(nextra); +eh := irh; + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+nextup; +lyc3 := lyc2+nextup; +lyc4 := lyc3+nextup+irh; +lyc5 := lyc4+nextup; +lyc6 := lyc5+nextup; +lyc7 := lyc6+nextup; +lyc8 := lyc7+nextup; +lyc9 := lyc8+nextup; + +%%% Zcol/row +%%% row 1 + +%%% PREF for Overlapping +z21bm=(xmid,lyc1); +drawPREF(21, pl, ph)(btex 5,3 (8) etex) + +%%% row 2 + +%%% OverlappingArea +z22bm=(x21bm,lyc2); +drawENT(22, el, eh)(btex OverlappingArea etex); + +%%% row 3 + +%%% IndexArray +z13=(pl,lyc3); +drawISR(13, irls, irh)(btex eleven.IndexArray etex); + +%%% Index +z23bm=(x22bm,lyc3); +drawISR(23, slindex, irh)(sindex); + +%%% MeshLocation +z33br=(maxx,lyc3); +drawISR(33, irls, irh)(btex eleven.MeshLocation etex); + +%%% row 4 + +%%% MeshConnectivity +z24bm=(x23bm,lyc4); +drawENT(24, el, eh)(btex MeshConnectivity etex); + +%%% PREF for MeshConnectivity +z14ml=(pl,y24ml); +drawPREF(14, pl, ph)(btex 5,2 (8) etex); + +%%% Structured_Donor +z34br=(maxx,lyc4); +drawPREF(34, plnamed, ph)(btex 7,5 Structured\_Donor etex); + +%%% row 5 + +%%% Unstructured_donor +z35br=(maxx,lyc5); +drawPREF(35, plnamed, ph)(btex 7,4 Unstructured\_Donor etex); + +%%% row 6 + +%%% MeshConnType +z36br=(maxx,lyc6); +drawISR(36, irll, irh)(btex eleven.MeshConnectivityType etex); + +%%% row 7 + +%%% IndexRange +z17=(0,lyc7); +drawISR(17, irls, irh)(btex eleven.IndexRange etex); + +%%% INTEGER +x27bm=x24bm; y27ml=y17mr; +drawINTEGER(27); + +%%% Zone +z37br=(maxx,lyc7); +drawISR(37, irls, irh)(btex seven.Zone etex); + +%%% row 8 + +%%% 1to1 +z28bm=(x24bm,lyc8); +drawENT(28, el, eh)(btex MeshConnectivity1\_1 etex); + +%%% row 9 + +%%% PREF to 1to1 +z29bm=(x28bm,lyc9); +drawPREF(29, pl, ph)(btex 5,1 (8) etex); + +%%%% attributes, etc + +drawthickO(21tm,22bm); % PREF to Overlap (21, 22) +drawthickO(14mr,24ml); % PREF to MeshConn (14, 24) +drawthickO(29bm,28tm); % PREF to 1to1 (29, 28) + +%%% PointListSize (22, 23) +drawdashO(22tm,23bm); +label.llft(btex PointListSize etex, z23bm); + +%%% PointRange (22, 17) +z22A=1/4[z22bl,z22tl]; z17A=(1/2[0,x13], y17); +VH(17A,22A); +drawdashthreeO(22A, 17A.vh, 17A); +label.ulft(btex PointRange etex, z22A); + +%%% PointList (22, 13) +z22B=3/4[z22bl,z22tl]; +VH(13bm,22B); +drawdashthreeO(22B, 13bm.vh, 13bm); +label.ulft(btex PointList etex, z22B); + +%%% MeshLocation (22, 33) +z22C=1/4[z22br,z22tr]; +z33B=2/3[z33bl,z33br]; +VH(33B,22C); +drawnormalthreeO(22C, 33B.vh, 33B); +label.urt(btex (DER) Location etex, z22C); + +%%% Meshloc (22, 33) +z22D=3/4[z22br,z22tr]; +z33A=1/3[z33bl,z33br]; +VH(33A,22D); +drawdashthreeO(22D, 33A.vh, 33A); +label.urt(btex Meshloc etex, z22D); + +%%% PointListSize (24, 23) +drawnormalO(24bm, 23tm); +label.ulft(btex PointListSize etex, z23tm); + +%%% StructuredDonor (24, 34) +z24A=(x24br,y34ml); +draw z24A--z34ml dashes; +label.lrt(btex StructuredDonor etex, z24A); + +%%% UnstructuredDonor (24, 35) +z24B=3/4[z24br,z24tr]; +HvH(24B,35ml); +drawdashfourO(24B, 24B.hvh, 35ml.hvh, 35ml); +label.urt(btex UnstructuredDonor etex, z24B.hvh); + +%%% Meshloc (24, 33) +z24C=4/6[z24bl,z24br]; +z33C=(x33A,y33tm); +y2433C=1/3[y33C,y24C]; +VyV(24C, 2433C, 33C); +drawdashfourO(24C, 24C.vyv, 33C.vyv, 33C); +label.lrt(btex Meshloc etex, z24C.vyv); + +%%% Location (24, 33) +z24D=5/6[z24bl,z24br]; +z33D=(x33B,y33tm); +y2433D=2/3[y33D,y24D]; +VyV(24D, 2433D, 33D); +drawnormalfourO(24D, 24D.vyv, 33D.vyv, 33D); +label.lrt(btex (DER) Location etex, z24D.vyv); + +%%% ConnectivityType (24, 36) +z24H=(x24D,y24tr); +z36H=z36bm; +y2436H=1/2[y35tr,y36br]; +VyV(24H, 2436H, 36H); +drawnormalfourO(24H, 24H.vyv, 36H.vyv, 36H); +label.urt(btex (DER) ConnectivityType etex, z24H.vyv); + +%%% Meshcon (24, 36) +z24G=(x24C,y24tr); +z36G=z36ml; +VH(24G,36G); +drawdashthreeO(24G, 24G.vh, 36G); +label.urt(btex Meshcon etex, z24G.vh); + +%%% K (24, 27) +drawnormalO(24tm, 27bm); +label.ulft(btex K etex, z24tm); + +%%% PointRange (24, 17) +z24E=1/4[z24tl,z24tr]; +x17br-x17E = x17A-x17bl; +y17E = y17A; +VhV(24E,17E); +drawdashfourO(24E, 24E.vhv, 17E.vhv, 17E); +label.ulft(btex PointRange etex, z24E); + +%%% PointList (24, 13) +z24F=1/4[z24bl,z24br]; +z13F=1/2[z13tl,z13tr]; +VhV(24F,13F); +drawnormalfourO(24F, 24F.vhv, 13F.vhv, 13F); +label.llft(btex PointList etex, z24F); + +%%% N (28, 27) +z27A=1/5[z27tl,z27tr]; +z28A=(x27A,y28bl); +drawnormalO(28A,27A); +label.llft(btex N etex, z28A); + +%%% trans (28, 27) +z27B=1/2[z27tl,z27tr]; +z28B=(x27B,y28bl); +drawdashO(28B,27B); +label.lrt(btex \twolines{trans}{A[1:N]} etex, z28B); + +%%% Transform (28, 27) +z27C=1/2[z27br,z27tr]; +z28C=(1/2[x27C,x28br], y28br); +VH(28C,27C); +drawnormalthreeO(28C,28C.vh,27C); +label.lrt(btex (DER) Transform A[1:N] etex , z28C); + +%%% DonorZone (28, 37) +z28D=1/2[z28br,z28tr]; +z37D=z37tm; +VH(37D,28D); +drawdashthreeO(28D,37D.vh,37D); +label.urt(btex DonorZone etex, z28D); + +%%% DonorPointRange (28, 17) +z28G=3/4[z28bl,z28tl]; +z17G=(x17A,y17tl); +VH(17G,28G); +drawnormalthreeO(28G,17G.vh,17G); +label.ulft(btex DonorPointRange etex, z28G); + +%%% PointRange (28, 17) +z28H=1/4[z28bl,z28tl]; +z17H=(x17E,y17G); +VH(17H,28H); +drawnormalthreeO(28H,17H.vh,17H); +label.ulft(btex PointRange etex, z28H); + +endfig; % end fig 5 + + +beginfig(6) % example 6 EXPRESS-G +%%%drawgrid; + +upshift := 3/2onelineh; +nextup := onelineh+upshift; + +el := namespace(btex manufacturer etex)(nextra); +eh := onelineh; + +hspace1 := 1/2el; + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+nextup; +lyc3 := lyc2+nextup; +lyc4 := lyc3+nextup; +lyc5 := lyc4+nextup; + +%%% Zcol/row + +%%% rows 4 and 5 +z14=(0,lyc4); +drawENT(14, el, eh)(btex manufacturer etex); + +z25=(x14br+hspace1, lyc5); +drawSTRING(25); + +z34=(x25br+hspace1, lyc4); +drawENT(34, el, eh)(btex car\_model etex); + +%%% row 3 + +z33bm=(x34bm, lyc3); +drawENT(33, el, eh)(btex car etex); + +%%% row 2 + +z22=(x25, lyc2); +drawINTEGER(22); + +%%% row 1 + +z21=(x22, lyc1); +drawSTRING(21); + +%%% attributes + +%%% manufacturer name (14, 25) +VH(14tm, 25ml); +drawnormalthreeO(14tm, 14tm.vh, 25ml); +label.urt(btex *name etex, z14tm.vh); + +%%% model name (34, 25) +VH(34tm, 25mr); +drawnormalthreeO(34tm, 34tm.vh, 25mr); +label.ulft(btex *name etex, z34tm.vh); + +%%% made_by (34, 14) +drawnormalO(34ml, 14mr); +label.ulft(btex made\_by etex, z34ml); + +%%% model_type (33, 34) +drawnormalO(33tm, 34bm); +label.urt(btex model\_type etex, z33tm); + +%%% DER made_by (33, 14) +VH(14bm, 33ml); +drawnormalthreeO(33ml, 14bm.vh, 14bm); +label.ulft(btex (DER) *made\_by etex, z33ml); + +%%% year (33, 22) +z33A=1/3[z33bl, z33br]; +VH(33A, 22mr); +drawnormalthreeO(33A, 33A.vh, 22mr); +label.ulft(btex year etex, z33A.vh); + +%%% serial_no +z33B=2/3[z33bl, z33br]; +VH(33B, 21mr); +drawnormalthreeO(33B, 33B.vh, 21mr); +label.ulft(btex *serial\_no etex, z33B.vh); + +endfig; % end fig 6 + + +beginfig(7) % example 7 +%%%drawgrid; + +el := namespace(btex MANUFACTURER etex)(niextra); +eh := onelineh; + +hspace1 := namespace(btex made by maker of etex)(4ndextra); + +hspace2 := 6onelineh; % height of CAR +hspace3 := 5onelineh; % space between rows +hspace4 := 3onelineh; % height of MANUFACTURER + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+hspace2+hspace3; + +%%% Zcol/row + +%%% row 2 + +z12=(0, lyc2); +drawENT(12, el, hspace4)(""); +x121=x12+sdtbs; +label.rt(btex MANUFACTURER etex, (x121, 2/3[y12bl, y12tl])); +label.rt(btex * manuf-name etex, (x121, 1/3[y12bl, y12tl])); + +z22=(x12br+hspace1, lyc2); +drawENT(22, el, hspace4)(""); +x221=x22+sdtbs; +label.rt(btex CAR-MODEL etex, (x221, 2/3[y12bl, y12tl])); +label.rt(btex * model-name etex, (x221, 1/3[y12bl, y12tl])); + +%%% row 1 + +z21=(x22, lyc1); +drawENT(21, el, hspace2)(""); +x211=x21+sdtbs; +label.rt(btex CAR etex, (x211, 5/6[y21bl, y21tl])); +label.rt(btex o year etex, (x211, 4/6[y21bl, y21tl])); +label.rt(btex o model (R) etex, (x211, 3/6[y21bl, y21tl])); +label.rt(btex * serial-no etex, (x211, 2/6[y21bl, y21tl])); +label.rt(btex * maker (R) etex, (x211, 1/6[y21bl, y21tl])); + +%%%%% relationship lines + +%%% MANUFACTURER / CAR-MODEL (12, 22) +drawnormalDCA(12mr, 22ml); +drawnormalCA(22ml, 12mr); +label.urt(btex { }{ }made by etex, z12mr); +label.llft(btex maker of{ }{ } etex, z22ml); + +%%% MANUFACTURER / CAR (12, 21) +VH(12bm, 21ml); +drawnormalCA(12bm.vh, 12bm); +drawnormalDCA(12bm.vh, 21ml); +label.llft(btex { }{ }made by etex, z12bm); +label.ulft(btex maker of{ }{ } etex, z21ml); + +%%% CAR-MODEL / CAR (22, 21) +drawnormalDCA(22bm, 21tm); +drawnormalCA(21tm, 22bm); +label.lrt(btex { }one of etex, z22bm); +label.ulft(btex type of{ } etex, z21tm); + +endfig; % end fig 7 + + +beginfig(8) % example 8 IDEF1X +%%%drawgrid; + +el := namespace(btex MANUFACTURER etex)(niextra); +eh := onelineh; + +hspace1 := namespace(btex made by maker of etex)(4ndextra); + +hspace2 := 5onelineh; % height of CAR +hspace3 := 5onelineh; % space between rows +hspace4 := 3onelineh; % height of MANUFACTURER + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+hspace2+hspace3; + +%%% Zcol/row + +%%% row 2 + +z12=(0, lyc2); +drawdoublerectangle(12, el, hspace4, 1/2); +label.urt(btex Manufacturer etex, z12tl); +x121=x12+sdtbs; +label.rt(btex manuf-name etex, (x121, 3/4[y12bl, y12tl])); + +z22=(x12br+hspace1, lyc2); +drawdoublerectangle(22, el, hspace4, 1/2); +label.urt(btex Car-model etex, z22tl); +x221=x22+sdtbs; +label.rt(btex Model-name etex, (x221, 3/4[y12bl, y12tl])); +label.rt(btex Manuf-name (FK) etex, (x221, 1/4[y12bl, y12tl])); + +%%% row 1 + +z21=(x22, lyc1); +drawroundedbox(21, el, hspace2, 2sdtbs)(""); +label.urt(btex Car etex, z21tl); +draw z21ml--z21mr; +x211=x21+sdtbs; +label.rt(btex Serial-no etex, (x211, 5/6[y21bl, y21tl])); +label.rt(btex Manuf-name (FK) etex, (x211, 4/6[y21bl, y21tl])); +label.rt(btex Model-name (FK) etex, (x211, 2/6[y21bl, y21tl])); +label.rt(btex Year etex, (x211, 1/6[y21bl, y21tl])); + +%%%%% relationship lines + +%%% MANUFACTURER / CAR-MODEL (12, 22) +drawnormalD(12mr, 22ml); +label.top(btex of etex, 1/2[z12mr, z22ml]); + +%%% MANUFACTURER / CAR (12, 21) +VH(12bm, 21ml); +drawnormalthreeD(12bm, 12bm.vh, 21ml); +label.top(btex makes etex, 1/2[z12bm.vh, z21ml]); +label.ulft(btex P{ } etex, z21ml); + +%%% CAR-MODEL / CAR (22, 21) +drawnormalD(22bm, 21tm); +label.lft(btex of etex, 1/2[z21tm,z22bm]); +label.urt(btex { }P etex, z21tm); + +endfig; % end fig 8 + + +beginfig(9) % example 9 OMT +%%%drawgrid; + +el := namespace(btex {\bf MANUFACTURER} etex)(niextra); +eh := onelineh; + +hspace1 := namespace(btex made by maker of etex)(4ndextra); + +hspace2 := 4onelineh; % height of CAR +hspace3 := 4onelineh; % space between rows +hspace4 := 3onelineh; % height of MANUFACTURER + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+hspace2+hspace3; + +%%% Zcol/row + +%%% row 2 + +z12=(0, lyc2); +drawdoublerectangle(12, el, hspace4, 1/2); +x121=x12+sdtbs; +label.rt(btex {\bf Manufacturer} etex, (x121, 3/4[y12bl, y12tl])); +label.rt(btex name : String etex, (x121, 1/4[y12bl, y12tl])); + +z22=(x12br+hspace1, lyc2); +drawdoublerectangle(22, el, hspace4, 1/2); +x221=x22+sdtbs; +label.rt(btex {\bf Car Model} etex, (x221, 3/4[y22bl, y22tl])); +label.rt(btex name: String etex, (x221, 1/4[y22bl, y22tl])); + +%%% row 1 + +z21=(x22, lyc1); +drawdoublerectangle(21, el, hspace2, 1/3); +x211=x21+sdtbs; +label.rt(btex {\bf Car} etex, (x211, 5/6[y21bl, y21tl])); +label.rt(btex serial-no : String etex, (x211, 4/9[y21bl, y21tl])); +label.rt(btex year : Integer etex, (x211, 2/9[y21bl, y21tl])); + +%%%%% relationship lines + +%%% MANUFACTURER / CAR-MODEL (12, 22) +drawnormalD(12mr, 22ml); +label.top(btex {\it makes} etex, 1/2[z12mr, z22ml]); +label.ulft(btex 1+{ } etex, z22ml); + +%%% MANUFACTURER / CAR (12, 21) +VH(12bm, 21ml); +drawnormalthreeD(12bm, 12bm.vh, 21ml); +label.top(btex {\it makes} etex, 1/2[z12bm.vh, z21ml]); +label.ulft(btex 1+{ } etex, z21ml); + +%%% CAR-MODEL / CAR (22, 21) +drawnormalD(22bm, 21tm); +label.lft(btex {\it produced as} etex, 1/2[z21tm,z22bm]); + +endfig; % end fig 9 + + +beginfig(10) % example 10 E-R +%%%drawgrid; + +numeric diam; diam := 2onelineh; + +upshift := diam; % circle diameter +nextup := diam+upshift; + +el := namespace(btex MANUFACTURER etex)(niextra); +eh := onelineh; + +numeric dl, dh; % length and height of diamond boxes +dl := 1/2el; dh := 2eh; + +numeric marg; marg := 4u; % double the seperation between parallel lines + +hspace1 := 1/2el; + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+nextup; +lyc3 := lyc2+nextup; +lyc4 := lyc3+nextup; +lyc5 := lyc4+nextup; + +%%% Zcol/row +%%% row 4 + +z14=(0,lyc4); +drawENT(14, el, eh)(btex manufacturer etex); + +z34ml=(x14br+hspace1, y14mr); +drawdiamondbox(34, dl, dh)(btex has etex); + +z54ml=(x34mr+hspace1, y34mr); +drawENT(54, el, eh)(btex car\_model etex); + +%%% row 5 + +z15bm=(x14bm, lyc5); +drawcirclebox(15, diam)(btex Name etex); + +z55bm=(x54bm, lyc5); +drawcirclebox(55, diam)(btex Name etex); + +%%% row 3 + +z53bm=(x54bm, lyc3); +drawdiamondbox(53, dl, dh)(btex of etex); + +z13c=(x14bm, y53c); +drawtwodiamondbox(13, dl+marg, dh+marg, 2/5marg)(btex Makes etex); + +%%% row 2 + +z32bm=(x34bm, lyc2); +drawENT(32, el, eh)(btex car etex); +z31c=z32c; +drawENT(31, el+marg, eh+marg)(""); + +%%% row 1 + +z21bm=(x32bl, lyc1); +drawcirclebox(21, 5/4diam)(btex \twolines{Serial}{No} etex); + +z41bm=(x32br, lyc1); +drawcirclebox(41, diam)(btex Year etex); + +%%%%%% lines + +%%% Name / manufacturer (15, 14) +drawnormal(15bm, 14tm); + +%%% Name / model (55, 54) +drawnormal(55bm, 54tm); + +%%% Mnf / has (14, 34) +drawnormal(14mr, 34ml); +label.top(btex 1 etex, 1/2[z14mr,z34ml]); + +%%% has/ model (34, 54) +drawnormal(34mr, 54ml); +label.top(btex N etex, 1/2[z34mr,z54ml]); + +%%% Mnf / makes (14, 13) +drawnormal(14bm, 13tm); +label.rt(btex 1 etex, 1/2[z14bm,z13tm]); + +%%% model / of (54, 53) +drawnormal(54bm, 53tm); +label.rt(btex 1 etex, 1/2[z54bm,z53tm]); + +%%% makes / car (13, 31) +drawnormal(13bm, 31ml); +z31A=(x31ml, y31ml+1/2marg); +z13U-z31A = z13bm-z31ml; +z13A = whatever[z13U,z31A] = whatever[z13bm,z13mr]; +draw z13A--z31A; +label.urt(btex N etex, 1/2[z13A,z31A]); + +%%% of / car (53, 31) +drawnormal(53bm, 31mr); +z31B=(x31mr, y31mr+1/2marg); +z53U - z31B = z53bm - z31mr; +z53B = whatever[z53U,z31B] = whatever[z53bm,z53ml]; +draw z53B--z31B; +label.ulft(btex N etex, 1/2[z53B,z31B]); + +%%% car / serial no (31, 21) +z31C=(x21tm, y31bl); +drawnormal(31C, 21tm); + +%%% car / year (31, 41) +z31D=(x41tm, y31br); +drawnormal(31D, 41tm); + +endfig; % end fig 10 + + +beginfig(11) % example 11 NIAM +%%%drawgrid; + +numeric diam; diam := 2onelineh; % circle diameter + +upshift := diam; +nextup := diam+upshift; + +numeric hel, vel; % length of horizontal and vertical box pairs +eh := onelineh; +hel = namespace(btex made by etex)(nextra); +vel = namespace(btex of prod etex)(nextra); + +numeric del, deh; % horizontal & vertical diameters of oval boxes +del := namespace(btex MANUFACTURER etex)(niextra); +deh := 2eh; + +numeric marg; marg := 2u; % margin for doubly enclosed oval boxes +numeric lmarg; lmarg := marg; % gap for short lines + +numeric dashel, dasheh; % diameters of dashed ellipses +dashel := del+2marg; +dasheh := deh+2marg; + +hspace1 := diam; + +%%% y coords +lyc1 := 0; +lyc2 := lyc1+nextup; +lyc3 := lyc2+nextup; + +%%% Zcol/row + +%%% row 3 + +x13ml=0; y13bm=lyc3; +drawovalbox(13, del, deh)(btex manufacturer etex); +z14=z13c; +drawdashellipse(14, dashel, dasheh); + +z23ml=(x14mr+hspace1, y14mr); +drawENT(23, hel, eh)(btex of etex); + +z33bl=z23br; +drawENT(33, hel, eh)(btex made by etex); + +z44ml=(x33mr+hspace1, y33mr); +drawdashellipse(44, dashel, dasheh); +z43=z44c; +drawovalbox(43, del, deh)(btex car model etex); + +z53ml=(x44mr+hspace1, y44mr); +drawdashcircle(53, diam); +label(btex year etex, z53c); + +%%% row 2 + +z22c=(x23bm,lyc2); +drawcirclebox(22, namespace(btex U etex)(2nextra))(btex U etex); + +x42tm=x43bm; y42ml=lyc2; +drawdoublerectangle(42, vel, 2eh, 1/2); +label(btex of etex, z42ct); +label(btex is of etex, z42cb); + +%%z52c=(x53x,lyc2); +x52tm=x53bm; y52ml=lyc2; +drawdoublerectangle(52, vel, 2eh, 1/2); +label(btex of prod etex, z52ct); +label(btex prod in etex, z52cb); + +%%% row 1 + +z11ml=(x13ml,lyc1); +drawdashellipse(11, del, deh); +label(btex serial no etex, z11c); + +z21ml=(x23ml,lyc1); +drawENT(21, hel, eh)(btex of etex); + +z31bl=z21br; +drawENT(31, hel, eh)(btex has etex); + +z41c=(x43c,lyc1); +drawcirclebox(41, diam)(btex car etex); + +%%%%%% lines + +%%% manufacturer / of (14, 23) +drawnormal(14mr, 23ml); + +%%% made by / car model (33, 44) +drawnormal(33mr, 44ml); +draw (x33tl, y33tl+lmarg)--(x33tr, y33tl+lmarg); +draw (x33mr, y33mr+lmarg)--(x33mr+eh, y33mr+lmarg); + +%%% serial no / of (11, 21) +drawnormal(11mr, 21ml); + +%%% of / of (23, 22, 21) +drawnormal(23bm, 22tm); drawnormal(22bm, 21tm); +label.rt(btex id etex, z22mr); + +%%% has / car (31, 41) +drawnormal(31mr, 41ml); +draw (x31tl, y31tl+lmarg)--(x31tr, y31tl+lmarg); +draw (x31mr, y31mr+lmarg)--(x33mr+eh, y31mr+lmarg); + +%%% model / of (44, 42) +drawnormal(43bm, 42tm); + +%%% is of / car (42, 41) +drawnormal(42bm, 41tm); +draw (x42tfr+lmarg, y42tfr)--(x42tfr+lmarg, y42br); +draw (x42bm+lmarg, y42bm)--(x42bm+lmarg, y42bm-eh); + +%%% year / of prod (53, 52) +drawnormal(53bm, 52tm); + +%%% prod in / car (52, 41) +VH(52bm,41mr); +drawnormalthree(52bm, 52bm.vh, 41mr); +draw (x52tfr+lmarg, y52tfr)--(x52tfr+lmarg, y52br); +draw (x52bm+lmarg, y52bm)--(x52bm+lmarg, y52bm-eh); + +endfig; % end fig 11 + +end + diff --git a/Master/texmf-dist/metapost/expressg/expressg.mp b/Master/texmf-dist/metapost/expressg/expressg.mp new file mode 100644 index 00000000000..01d50b134ce --- /dev/null +++ b/Master/texmf-dist/metapost/expressg/expressg.mp @@ -0,0 +1,1250 @@ +%% +%% This is file `expressg.mp', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% expressg.dtx (with options: `up') +%% +%% Author: Peter Wilson (CUA) now at peter.r.wilson@boeing.com until June 2004 +%% (or pandgwilson@earthlink.net) +%% Copyright 1996, 2003 Peter R. Wilson +%% +%% v1.0 1996/05/09 (first release) +%% v1.2 1999/11/15 +%% v1.3 2000/05/22 +%% v1.4 2000/07/10 +%% v1.5 2003/07/31 +%% v1.6 2004/02/29 +%% v1.61 2004/03/17 +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% This program is provided under the terms of the +%% LaTeX Project Public License distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% +%%% EXPRESSG.MP MetaPost macros for EXPRESS-G and other BLA diagrams +%%% version 1.5, 31 July 2003 +%%% version 1.6, 29 February 2004 +%%% version 1.61, 17 March 2004 + +show "expressg.mp version 1.61, 2004/03/17"; + +newinternal u; numeric u; +u := 1mm; + +newinternal maxx, maxy; +numeric maxx, maxy; +maxx := 159.5u; % smidgeon under 160mm for ISO +maxy := 210u; % 210mm for ISO + +newinternal defaultdotdiam, dotdiam; +numeric defaultdotdiam, dotdiam; +defaultdotdiam := 2u; +dotdiam := defaultdotdiam; + +newinternal normalpensize, thickpensize, thinpensize; +numeric normalpensize, thickpensize, thinpensize; +normalpensize := 0.5bp; +thickpensize := 1.5bp; +thinpensize := 0.25bp; +newinternal dotsscale; numeric dotsscale; +dotsscale := 2; + +newinternal normalpen, thickpen, thinpen, dotspen, dotpen; +pen normalpen, thickpen, thinpen, dotspen, dotpen; +normalpen := pencircle scaled normalpensize; % i.e. defaultpen; +thickpen := pencircle scaled thickpensize; +thinpen := pencircle scaled thinpensize; +dotspen := pencircle scaled (dotsscale*normalpensize); +dotpen := pencircle scaled dotdiam; + +newinternal defaultsmoothrad; +numeric smoothrad, defaultsmoothrad; +smoothrad := defaultsmoothrad := 2u; + +newinternal defaultdrumlid; +numeric drumlid, defaultdrumlid; +drumlid := defaultdrumlid := 0.2; + +%%% default length and base width for arrowheads and fanin +newinternal defaultgal, defaultgab, defaultgfl, defaultgfb; +numeric defaultgal, defaultgab, defaultgfl, defaultgfb; +defaultgal := defaultgfl := defaultdotdiam; +defaultgab := defaultgfb := defaultgal; + +%%% length and base width of arrowheads and fanins +newinternal gal, gab, gfl, gfb; +numeric gal, gab, gfl, gfb; +gal := defaultgal; +gab := defaultgab; +gfl := defaultgfl; +gfb := defaultgfb; + +newinternal onelineh; +numeric onelineh; +onelineh := 5u; + +%%% length, height & inset for simple data type boxes +newinternal sdtbl, sdtbh, sdtbs; +numeric sdtbl, sdtbh, sdtbs; +sdtbl := 22u; +sdtbh := onelineh; +sdtbs := 2u; + +%%% length, height & inset for EXPRESSION data type boxes +newinternal sdtbel, sdtbeh, sdtbes; +numeric sdtbel, sdtbeh, sdtbes; +sdtbel := 28u; +sdtbeh := sdtbh; sdtbes := sdtbs; + +%%% length, height & inset for GENERICENT data type boxes +newinternal sdtbgel, sdtbgeh, sdtbges; +numeric sdtbgel, sdtbgeh, sdtbges; +sdtbgel := 38u; +sdtbgeh := sdtbh; sdtbges := sdtbs; + +%%% average length of numeric page connector +newinternal pconl; +numeric pconl; % length of page connector (for e.g., 9,9 (9,9) ) +pconl:=15u; +%%% height of page connectors (one line) +newinternal pconh; +numeric pconh; +pconh := onelineh; + +%%% heights of entity, enum, select, type boxes (One text line) +newinternal enth, typeh; +numeric enth, typeh; +enth := onelineh; +typeh := onelineh; + +%%% height of interschema boxes (one text line, no rename), and (name + rename) +newinternal ish, isrh; +numeric ish, isrh; +ish := 2onelineh; +isrh := 3onelineh; + +%%% height of schema boxes (one text line) +newinternal schemah; +numeric schemah; +schemah := 2onelineh; + +%%% height and slope of event boxes +newinternal eventh, eventslope; +numeric eventh, eventslope; +eventh := onelineh; +eventslope := 0.25; + +%%% extra namespaces for boxed names +newinternal nextra, niextra; +numeric nextra, niextra; +nextra := 2u; +niextra := nextra+sdtbs; + +%%% extra namespace for attribute names +newinternal ndextra; +numeric ndextra; +ndextra := nextra+dotdiam; + +%%% calculates mid-point on a path like |_ (vertical, horizontal) +%%% final points are: z$, z$vh, z$$, where z$vh=(x$,y$$) +def VH(suffix $, $$) = + z$vh=(x$,y$$); +enddef; + +%%% Calculates mid-points on a path like |_ +%%% | (vertical, horizontal, vertical) +%%% final points are: z$, z$vhv, z$$vhv, z$$ +def VhV(suffix $, $$) = + y$$vhv=1/2[y$,y$$]; x$$vhv=x$$; + z$vhv=(x$,y$$vhv); +enddef; + +%%% Calculates mid-points on a path like -|_ (horizontal, vertical, horizontal) +%%% final points are: z$, z$hvh, z$$hvh, z$$ +def HvH(suffix $, $$) = + x$hvh=1/2[x$,x$$]; y$hvh=y$; + z$$hvh=(x$hvh,y$$); +enddef; + +%%% Calculates turning points on a U shaped path (vertical, horizontal, vertical) +%%% final points are: z$, z$vyv, z$$vyv, z$$ +def VyV(suffix $, @, $$) = + z$$vyv=(x$$,y@); + z$vyv =(x$, y@); +enddef; + +%%% Calculates corner points rotated U shaped path (horizontal, vertical, horizontal) +%%% final points are: z$, z$hxh, z$$hxh, z$$ +def HxH(suffix $, @, $$) = + z$$hxh=(x@,y$$); + z$hxh =(x@,y$); +enddef; + +%%% calculates length taken up by typesetting str, plus margin +def namespace(text str)(expr margin) = + (xpart lrcorner(str) - xpart llcorner(str) + margin) +enddef; + +def dashes = + dashed evenly +enddef; + +def dots = + dashed withdots +enddef; + +def dashedgrid(expr nx, ny, dist) = + save zg_, zg__, oldpen; + pair zg_[], zg__[]; + pen oldpen; oldpen = currentpen; + pickup thinpen; + for i = 0 upto nx: + zg_[i] = (i*dist, 0); zg_[i+1000] = (i*dist, ny*dist); + draw zg_[i]--zg_[i+1000] dashes; + label.bot(decimal(i), zg_[i]); + endfor + for i = 0 upto ny: + zg__[i] = (0, i*dist); zg__[i+1000] = (nx*dist, i*dist); + draw zg__[i]--zg__[i+1000] dashes; + label.lft(decimal(i), zg__[i]); + endfor + pickup oldpen; +enddef; + +%%% draw a 1cm spaced grid of 16(x) by 21(y) cms. (units are mm) +def drawgrid = + dashedgrid(16, 21, 10mm); +enddef; + +%%% calculates corner and midpoints of a rectangle, +%%% bottom left at $, length l, height h +def rectpoints(suffix $)(expr l, h) = + z$bl = z$; + z$tr = (x$+l, y$+h); + z$br = (x$tr, y$bl); + z$tl = (x$bl, y$tr); + z$ml = 1/2[z$bl, z$tl]; + z$mr = 1/2[z$br, z$tr]; + z$bm = 1/2[z$bl, z$br]; + z$tm = 1/2[z$tl, z$tr]; +enddef; + +%%% calculate corner, midpoints and center point of a rhomboid. +def rhompoints(suffix $)(expr l, h, s) = + save eshift; + numeric eshift; eshift = s*h; + z$bl = z$; + z$tr = (x$+l+eshift, y$+h); + z$br = (x$bl+l, y$bl); + z$tl = (x$bl+eshift, y$tr); + z$ml = 1/2[z$bl, z$tl]; + z$mr = 1/2[z$br, z$tr]; + z$bm = (1/2[x$ml,x$mr], y$bl); + z$tm = (x$bm, y$tr); +enddef; + +%%% calculate circumferential points on a circle +def circpoints(suffix $)(expr diam) = + save rad, sinrad, cosrad; + numeric rad, sinrad, cosrad; + rad = diam/2; + sinrad = rad*(sind 45); + cosrad = rad*(cosd 45); + z$c=z$; + z$ml=(x$c-rad, y$c); + z$mr=(x$c+rad, y$c); + z$bm=(x$c, y$c-rad); + z$tm=(x$c, y$c+rad); + z$tr=(x$c+cosrad, y$c+sinrad); + z$bl=(x$c-cosrad, y$c-sinrad); + z$br=(x$tr, y$bl); + z$tl=(x$bl, y$tr); +enddef; + +%%% circular arc join between two paths +tertiarydef p ~ q = + begingroup + c_ := fullcircle scaled 2smoothrad shifted point 0 of q; + a_ := ypart(c_ intersectiontimes p); + b_ := ypart(c_ intersectiontimes q); + if a_ < 0: point 0 of p{direction 0 of p} else: subpath(0,a_) of p fi + ... if b_ < 0: {direction infinity of q}point infinity of q + else: subpath(b_,infinity) of q fi + endgroup +enddef; + +%%% piecewise linear path between the given points +def sharply(text t) = % t is a list of pairs + hide(n_:=0; for z=t: z_[incr n_]:=z; endfor) + z_1 for k=2 upto n_: --z_[k] endfor +enddef; + +%%% piecewise linear path between the given points with smooth corners +def smoothly(text t) = % t is a list of pairs + hide(n_:=0; for z=t: z_[incr n_]:=z; endfor) + (z_1 for k=2 upto n_-1: --z_[k]) ~ (z_[k] endfor --z_[n_]) +enddef; + +%%% Draw an open circle at end of vector from $ to $$ +def drawO(suffix $, $$) = + begingroup + save v_, c_, l, p; + pair v_, c_; + numeric l; + path p; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (dotdiam/(2l))[z$$,z$]; + p := fullcircle scaled dotdiam shifted c_; + unfill p; + draw p; draw p; + endgroup +enddef; + +%%% Draw a closed circle at end of vector from $ to $$ +def drawD(suffix $, $$) = + begingroup + save v_, c_, l, p; + pair v_, c_; + numeric l; + path p; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (dotdiam/(2l))[z$$,z$]; + p := fullcircle scaled dotdiam shifted c_; + fill p; + endgroup +enddef; + +%%% draw an open arrowhead at end of vector from $ to $$ +def drawOA(suffix $, $$) = + begingroup + save v_, c_, v_u, c_t, c_b, l, hb, p; + pair v_, c_, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gab/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gal/(l))[z$$,z$]; % base of arrowhead + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p = c_b--z$$--c_t--cycle; + unfill p; + draw p; draw p; + endgroup +enddef; + +%%% draw a closed arrowhead at end of vector from $ to $$ +def drawCA(suffix $, $$) = + begingroup + save v_, c_, v_u, c_t, c_b, l, hb, p; + pair v_, c_, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gab/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gal/(l))[z$$,z$]; % base of arrowhead + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p = c_b--z$$--c_t--cycle; + filldraw p; + endgroup +enddef; + +%%% draw a simple arrowhead at end of vector from $ to $$ +def drawA(suffix $, $$) = + begingroup + save v_, c_, v_u, c_t, c_b, l, hb, p; + pair v_, c_, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gab/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gal/(l))[z$$,z$]; % base of arrowhead + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p = c_b--z$$--c_t; + draw p; + endgroup +enddef; + +%%% draws a fanin at the end of the vector from $ to $$ +def drawF(suffix $, $$) = + begingroup + save v_, c_, v_u, c_t, c_b, l, hb, p; + pair v_, c_, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gfb/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gfl/(l))[z$$,z$]; % apex of fan + v_u := unitvector v_; + c_t := z$$ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - z$$ = z$$ - c_t; + p = c_b--c_--c_t; + draw p; + endgroup +enddef; + +%%% Draw a dotted line from $ to $$ +def drawdots(suffix $, $$) = + pickup dotspen; + draw z$--z$$ dots; + pickup normalpen; +enddef; + +%%% Draws the dotted line $--@--$$ +def drawdotsthree(suffix $, @, $$) = + pickup dotspen; + draw z$--z@--z$$ dots; + pickup normalpen; +enddef; + +%%% Draw the dotted line $--@--@@--$$ +def drawdotsfour(suffix $, @, @@, $$) = + pickup dotspen; + draw z$--z@--z@@--z$$ dots; + pickup normalpen; +enddef; + +%%% Draw a dotted line from $ to $$ with open circle at $$ +def drawdotsO(suffix $, $$) = + pickup dotspen; + draw z$--z$$ dots; + pickup normalpen; + drawO($, $$); +enddef; + +%%% Draws the dotted line $--@--$$ +def drawdotsthreeO(suffix $, @, $$) = + pickup dotspen; + draw z$--z@--z$$ dots; + pickup normalpen; + drawO(@, $$); +enddef; + +%%% Draw the dotted line $--@--@@--$$ +def drawdotsfourO(suffix $, @, @@, $$) = + pickup dotspen; + draw z$--z@--z@@--z$$ dots; + pickup normalpen; + drawO(@@, $$); +enddef; + +%%% Draw the dotted line from $ to $$, ending in circles diameter dotdiam at $ and $$ +def drawdotsOO(suffix $, $$) = + pickup dotspen; + draw z$--z$$ dots; + pickup normalpen; + drawO($, $$); drawO($$, $); +enddef; + +%%% draws a dashed line from $ to $$ +def drawdash(suffix $, $$) = + draw z$--z$$ dashes; +enddef; + +%%% draws the dashed line $--@--$$ +def drawdashthree(suffix $, @, $$) = + draw z$--z@--z$$ dashes; +enddef; + +%%% draws the dashed line $--@--@@--$$ +def drawdashfour(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$ dashes; +enddef; + +%%% draws a dashed line from $ to $$, ending in a circle diameter dotdiam at $$ +def drawdashO(suffix $, $$) = + draw z$--z$$ dashes; + drawO($, $$); +enddef; + +%%% draws the dashed line $--@--$$ with circle at $$ +def drawdashthreeO(suffix $, @, $$) = + draw z$--z@--z$$ dashes; + drawO(@, $$); +enddef; + +%%% draws the dashed line $--@--@@--$$ with circle at $$ +def drawdashfourO(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$ dashes; + drawO(@@, $$); +enddef; + +%%% draws a dashed line from $ to $$, ending in circles diameter dotdiam at $ and $$ +def drawdashOO(suffix $, $$) = + draw z$--z$$ dashes; + drawO($, $$); drawO($$, $); +enddef; + +%%% draws a normal line from $ to $$. +def drawnormal(suffix $, $$) = + draw z$--z$$; +enddef; + +%%% draws the normal line $--@--$$ +def drawnormalthree(suffix $, @, $$) = + draw z$--z@--z$$; +enddef; + +%%% draws the normal line $--@--@@--$$ +def drawnormalfour(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$; +enddef; + +%%% draws a normal line from $ to $$, ending in a circle diameter dotdiam at $$ +def drawnormalO(suffix $, $$) = + draw z$--z$$; + drawO($, $$); +enddef; + +%%% draws the normal line $--@--$$, ending in a circle at $$ +def drawnormalthreeO(suffix $, @, $$) = + draw z$--z@--z$$; + drawO(@, $$); +enddef; + +%%% draws the line $--@--@@--$$, ending in a circle at $$ +def drawnormalfourO(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$; + drawO(@@, $$); +enddef; + +%%% draws a normal line from $ to $$, ending in circles diameter dotdiam at $ and $$ +def drawnormalOO(suffix $, $$) = + draw z$--z$$; + drawO($, $$); drawO($$, $); +enddef; + +%%% draws a normal line from $ to $$, ending in a dot diameter dotdiam at $$ +def drawnormalD(suffix $, $$) = + draw z$--z$$; + drawD($, $$); +enddef; + +%%% draws the normal line $--@--$$, ending in a dot at $$ +def drawnormalthreeD(suffix $, @, $$) = + draw z$--z@--z$$; + drawD(@, $$); +enddef; + +%%% draws the normal line $--@--@@--$$, ending in a dot at $$ +def drawnormalfourD(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$; + drawD(@@, $$); +enddef; + +%%% draws a normal line from $ to $$, ending in dots diameter dotdiam at $ and $$ +def drawnormalDD(suffix $, $$) = + draw z$--z$$; + drawD($, $$); drawD($$, $); +enddef; + +%%% draws a normal line from $ to $$, ending with an open arrowhead at $$ +def drawnormalOA(suffix $, $$) = + draw z$--z$$; + drawOA($, $$); +enddef; + +%%% draws a normal line from $ to $$, ending with a closed arrowhead at $$ +def drawnormalCA(suffix $, $$) = + draw z$--z$$; + drawCA($, $$); +enddef; + +%%% draws the normal line $--@--$$, ending in a black arrowhead at $$ +def drawnormalthreeCA(suffix $, @, $$) = + draw z$--z@--z$$; + drawCA(@, $$); +enddef; + +%%% draws the normal line $--@--@@--$$, ending in a black arrowhead at $$ +def drawnormalfourCA(suffix $, @, @@, $$) = + draw z$--z@--z@@--z$$; + drawCA(@@, $$); +enddef; + +%%% draws a normal line from $ to $$, ending with a fanin at $$ +def drawnormalF(suffix $, $$) = + draw z$--z$$; + drawF($, $$); +enddef; + +%%% draws a normal line from $ to $$, with a fanin at $ and an open circle at $$ +def drawnormalFO(suffix $, $$) = + draw z$--z$$; + drawO($, $$); drawF($$, $); +enddef; + +%%% draws a thick line from $ to $$. +def drawthick(suffix $, $$) = + pickup thickpen; + draw z$--z$$; + pickup normalpen; +enddef; + +%%% draws a thick line from $ to $$, ending in a circle diameter dotdiam at $$ +def drawthickO(suffix $, $$) = + pickup thickpen; + draw z$--z$$; + drawO($, $$); + pickup normalpen; +enddef; + +%%% draws a thick line from $ to $$, ending in circles diameter dotdiam at $ and $$ +def drawthickOO(suffix $, $$) = + pickup thickpen; + draw z$--z$$; + drawO($, $$); drawO($$, $); + pickup normalpen; +enddef; + +%%% replaces the sharp corner on $--@--$$ with a circular arc radius smoothrad +def smooth(suffix $, @, $$) = + begingroup + save v_, c_, l, p; + pair v_, v_', c_, c_'; + path p; + v_ := z@-z$; + l := (xpart v_)++(ypart v_); % length of $--@ + c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ + v_' := z$$-z@; + l := (xpart v_')++(ypart v_'); % length of @--$$ + c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ + undraw c_--z@--c_'; % blank original join + draw c_{v_}..{v_'}c_'; % draw the arc + endgroup +enddef; + +%%% replaces the sharp corners on $--@--@@--$$ with a circular arc radius smoothrad +def smoothtwo(suffix $, @, @@, $$) = + smooth($, @, @@); smooth(@, @@, $$); +enddef; + +%%% replaces the sharp corner on the dashed lines $--@--$$ +%%% with a circular arc radius smoothrad +def smoothdash(suffix $, @, $$) = + begingroup + save v_, c_, l, p; + pair v_, v_', c_, c_'; + path p; + v_ := z@-z$; + l := (xpart v_)++(ypart v_); % length of $--@ + c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ + v_' := z$$-z@; + l := (xpart v_')++(ypart v_'); % length of @--$$ + c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ + undraw c_--z@--c_'; % blank original join + draw c_{v_}..{v_'}c_' dashes; % draw the dashed arc + endgroup +enddef; + +%%% replaces the sharp corner on the dotted line $--@--$$ +%%% with a circular arc radius smoothrad +def smoothdots(suffix $, @, $$) = + begingroup + save oldpen; + pen oldpen; oldpen := currentpen; + save v_, c_, l, p; + pair v_, v_', c_, c_'; + path p; + v_ := z@-z$; + l := (xpart v_)++(ypart v_); % length of $--@ + c_ := (smoothrad/l)[z@,z$]; % start of arc on $--@ + v_' := z$$-z@; + l := (xpart v_')++(ypart v_'); % length of @--$$ + c_' := (smoothrad/l)[z@,z$$]; % end of arc on @--$$ + undraw c_--z@--c_'; % blank original join + pickup dotspen; + draw c_{v_}..{v_'}c_' dots; % draw the dotted arc + pickup oldpen; + endgroup +enddef; + +%%% draws a schema box, bottom left at $, length l, height h +def drawSCHEMA(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + x$c = 1/2[x$ml, x$mr]; + y$c = 1/2[y$ml, y$tl]; + draw z$bl--z$br--z$tr--z$tl--cycle; % outer box + draw z$ml--z$mr; % dividing line + label(str, z$c); +enddef; + +def drawSDT(suffix $)(text str) = + rectpoints($, sdtbl, sdtbh); + z$ti = (x$tr-sdtbs, y$tr); + z$bi = (x$ti, y$br); + z$c = 1/2[z$bl,z$ti]; + draw z$bl--z$br--z$tr--z$tl--cycle; + draw z$bi--z$ti; + label(str, z$c); +enddef; + +def drawASDT(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + z$ti = (x$tr-sdtbs, y$tr); + z$bi = (x$ti, y$br); + z$c = 1/2[z$bl,z$ti]; + draw z$bl--z$br--z$tr--z$tl--cycle; + draw z$bi--z$ti; + label(str, z$c); +enddef; + +def drawBINARY(suffix $) = drawASDT($)(sdtbl, sdtbh)("BINARY"); + enddef; +def drawBOOLEAN(suffix $) = drawASDT($)(sdtbl, sdtbh)("BOOLEAN"); + enddef; +def drawCOMPLEX(suffix $) = drawASDT($)(sdtbl, sdtbh)("COMPLEX"); + enddef; +def drawEXPRESSION(suffix $) = drawASDT($)(sdtbel, sdtbeh)("EXPRESSION"); + enddef; +def drawGENERIC(suffix $) = drawASDT($)(sdtbl, sdtbh)("GENERIC"); + enddef; +def drawINTEGER(suffix $) = drawASDT($)(sdtbl, sdtbh)("INTEGER"); + enddef; +def drawLOGICAL(suffix $) = drawASDT($)(sdtbl, sdtbh)("LOGICAL"); + enddef; +def drawNUMBER(suffix $) = drawASDT($)(sdtbl, sdtbh)("NUMBER"); + enddef; +def drawREAL(suffix $) = drawASDT($)(sdtbl, sdtbh)("REAL"); + enddef; +def drawSTRING(suffix $) = drawASDT($)(sdtbl, sdtbh)("STRING"); + enddef; + +%%% draw an enumeration type box, bottom left at $, length l, height h +def drawENUM(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + z$ti = (x$tr-sdtbs, y$tr); + z$bi = (x$ti, y$br); + z$c = 1/2[z$bl,z$ti]; + draw z$bl--z$br--z$tr--z$tl--cycle dashes; + draw z$bi--z$ti dashes; + label(str, z$c); +enddef; + +%%% draw a select type box, bottom left at $, length l, height h +def drawSELECT(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + z$ti = (x$tl+sdtbs, y$tl); + z$bi = (x$ti, y$bl); + z$c = 1/2[z$br,z$ti]; + draw z$bl--z$br--z$tr--z$tl--cycle dashes; + draw z$bi--z$ti dashes; + label(str, z$c); +enddef; + +%%% draw a simple user defined TYPE box, bottom left at $, length l, height h +def drawTYPE(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + z$c = 1/2[z$bl,z$tr]; + draw z$bl--z$br--z$tr--z$tl--cycle dashes; + label(str, z$c); +enddef; + +%%% draw an entity box, bottom left at $, length l, height h +def drawENT(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + z$c = 1/2[z$bl,z$tr]; + draw z$bl--z$br--z$tr--z$tl--cycle; + label(str, z$c); +enddef; + +def drawOB(suffix $)(expr l, h) = + save rad; + numeric rad; rad := h/2; + rectpoints($, l, h); + z$cl = 1/2[z$bl, z$tl]; + z$cr = 1/2[z$br, z$tr]; + z$bli = (x$bl+rad, y$bl); + z$tli = (x$bli, y$tl); + z$bri = (x$br-rad, y$br); + z$tri = (x$bri, y$tr); + z$c = 1/2[z$bl,z$tr]; + draw z$bli--z$bri..z$cr..z$tri--z$tli..z$cl..cycle; +enddef; + +%%% draw a page reference box oval, bottom left at $, length l, height h +def drawPREF(suffix $)(expr l, h)(text str) = + drawOB($, l, h); + label(str, z$c); +enddef; + +%%% draw an interschema USE box, bottom left at $, length l, height h +def drawISU(suffix $)(expr l, h)(text str) = + save quarter; + numeric quarter; quarter := h/4; + rectpoints($, l, h); + z$o = (x$, y$+quarter); + drawOB($o, l, 2quarter); + z$c = 1/2[z$bl,z$tr]; + label(str, z$c); + draw z$bl--z$br--z$tr--z$tl--cycle; +enddef; + +%%% draw an interschema USE RENAME box, bottom left at $, length l, height h +def drawISUR(suffix $)(expr l, h)(text str, rname) = + save third; + numeric third; third := h/3; + rectpoints($, l, h); + z$o = (x$, y$+third); + drawOB($o, l, third); + z$c = 1/2[z$bl, z$tr]; + label(str, z$c); + z$rnm = 1/2[z$bl,(x$br,y$br+third)]; + draw z$bl--z$br--z$tr--z$tl--cycle; + label(rname, z$rnm); +enddef; + +%%% draw an interschema REFERENCE box, bottom left at $, length l, height h +def drawISR(suffix $)(expr l, h)(text str) = + save quarter; + numeric quarter; quarter := h/4; + rectpoints($, l, h); + z$o = (x$, y$+quarter); + drawOB($o, l, 2quarter); + z$c = 1/2[z$bl,z$tr]; + label(str, z$c); + draw z$bl--z$br--z$tr--z$tl--cycle dashes; +enddef; + +%%% draw an interschema REFERENCE RENAME box, bottom left at $, length l, height h +def drawISRR(suffix $)(expr l, h)(text str, rname) = + save third; + numeric third; third := h/3; + rectpoints($, l, h); + z$o = (x$, y$+third); + drawOB($o, l, third); + z$c = 1/2[z$bl,z$tr]; + label(str, z$c); + z$rnm = 1/2[z$bl,(x$br,y$br+third)]; + draw z$bl--z$br--z$tr--z$tl--cycle dashes; + label(rname, z$rnm); +enddef; + +%%% draw a Local EVENT box, bottom left at $, length l, height h +def drawLEVENT(suffix $)(expr l, h)(text str) = + rhompoints($, l, h, eventslope); + z$c = 1/2[z$ml,z$mr]; + draw z$bl--z$br--z$tr--z$tl--cycle; + label(str, z$c); +enddef; + +%%% draw a Global EVENT box, bottom left at $, length l, height h +def drawGEVENT(suffix $)(expr l, h)(text str) = + rhompoints($, l, h, eventslope); + z$c = 1/2[z$ml,z$mr]; + pickup thickpen; + draw z$bl--z$br--z$tr--z$tl--cycle; + pickup normalpen; + label(str, z$c); +enddef; + +%%% draw a circled name, diameter diam centered at $ +def drawcirclebox(suffix $)(expr diam)(text str) = + circpoints($, diam); + draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle; + label(str, z$c); +enddef; + +%%% length and base width of diamond line end styles +newinternal gdl, gdb; +numeric gdl, gdb; +gdl := 2defaultgal; +gdb := 0.75defaultgab; + +def ellipsepoints(suffix $)(expr l, h) = + save epp, move; + path epp; + pair move; + z$ml=(x$-l/2, y$); z$mr=(x$ml+l,y$); + z$tm=(x$, y$+h/2); z$bm=(x$, y$tm-h); + move = 1/2[z$ml,z$mr]; + epp = fullcircle scaled h xscaled (l/h) shifted move; + z$tr = point 1.2 of epp; + z$tl = point 2.8 of epp; + z$bl = point 5.2 of epp; + z$br = point 6.8 of epp; +enddef; + +%%% draws double closed arrowheads at end of vector from $ to $$ +def drawDCA(suffix $, $$) = + begingroup + save v_, c_, v_u, c_t, c_b, l, hb, p; + pair v_, c_, v_u, c_t, c_b; + path p[]; + numeric l, hb; + hb := gab/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gal/(l))[z$$,z$]; % base of arrowhead + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p1 := c_b--z$$--c_t--cycle; + filldraw p1; + p2 := p1 shifted ((xpart c_ - x$$), (ypart c_ - y$$)); + filldraw p2; + endgroup +enddef; + +%%% draws an open diamond at end of vector from $ to $$ +def drawOD(suffix $, $$) = + begingroup + save v_, c_, c__, v_u, c_t, c_b, l, hb, p; + pair v_, c_, c__, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gdb/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gdl/(2l))[z$$,z$]; % base of diamond + c__ := (gdl/(l))[z$$,z$]; % interior tip of diamond + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p = c_b--z$$--c_t--c__--cycle; + unfill p; + draw p; draw p; + endgroup +enddef; + +%%% draws a closed diamond at end of vector from $ to $$ +def drawCD(suffix $, $$) = + begingroup + save v_, c_, c__, v_u, c_t, c_b, l, hb, p; + pair v_, c_, c__, v_u, c_t, c_b; + numeric l, hb; + path p; + hb := gdb/2; + v_ := z$-z$$; + l := (xpart v_)++(ypart v_); % length of the line + c_ := (gdl/(2l))[z$$,z$]; % base of diamond + c__ := (gdl/(l))[z$$,z$]; % interior tip of diamond + v_u := unitvector v_; + c_t := c_ shifted (-hb*(ypart v_u), hb*(xpart v_u)); + c_b - c_ = c_ - c_t; + p = c_b--z$$--c_t--c__--cycle; + filldraw p; + endgroup +enddef; + +%%% draws a dashed line from $ to $$, ending with an arrowhead at $$ +def drawdashA(suffix $, $$) = + draw z$--z$$ dashes; + drawA($, $$); +enddef; + +%%% draws a dashed line from $ to $$, ending with an open arrowhead at $$ +def drawdashOA(suffix $, $$) = + draw z$--z$$ dashes; + drawOA($, $$); +enddef; + +%%% draws a normal line from $ to $$, ending with double closed arrowheads at $$ +def drawnormalDCA(suffix $, $$) = + draw z$--z$$; + drawDCA($, $$); +enddef; + +%%% draws a normal line from $ to $$, ending with an open diamond at $$ +def drawnormalOD(suffix $, $$) = + draw z$--z$$; + drawOD($, $$); +enddef; + +%%% draws a normal line from $ to $$, ending with a closed diamond at $$ +def drawnormalCD(suffix $, $$) = + draw z$--z$$; + drawCD($, $$); +enddef; + +%%% draws an open dashed circle, center z$, diameter diam +def drawdashcircle(suffix $)(expr diam) = + circpoints($, diam); + draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle dashes; +enddef; + +%%% draws an open circle, center z$, diameter diam, with an arrow at the top +def drawcircleA(suffix $)(expr diam) = + circpoints($, diam); + begingroup + save c_, c_t, c_b, hb; + pair c_, c_t, c_b; + numeric hb; + hb := gab/2; + c_ := z$tm shifted (gal*right); % base of arrowhead + c_t := c_ shifted (hb*up); + c_b := c_ shifted (hb*down); + draw z$bl..z$bm..z$br..z$mr..z$tr..z$tm..z$tl..z$ml..cycle; + draw c_t--z$tm--c_b; + endgroup +enddef; + +%%% draws black dot, center z$, diameter diam +def drawDot(suffix $)(expr diam) = + begingroup + save p; + path p; + p := fullcircle scaled diam shifted z$; + filldraw p; + endgroup +enddef; + +%%% draws black dot surrounded by a circle, center z$, diameter diam +def drawCircledDot(suffix $)(expr diam) = + begingroup + save l_, p; + numeric l_; + path p[]; + l_ := 5/7diam; + p1 := fullcircle scaled diam shifted z$; + unfill p1; + draw p1; + p2 := fullcircle scaled l_ shifted z$; + filldraw p2; + endgroup +enddef; + +def drawcardbox(suffix $)(expr l, h, m)(text str) = + rectpoints($, l, h); + begingroup + save c; + pair c[]; + c1 = (x$tr-m, y$tr); + c3 = (x$tr, y$tr-m); + c2 = (xpart c1, ypart c3); + draw z$bl--z$br--c3--c1--z$tl--cycle; + draw c1--c2--c3; + endgroup; + z$c = 1/2[z$ml,z$mr]; + label(str, z$c); +enddef; + +def drawdiamondbox(suffix $)(expr l, h)(text str) = + z$ml=(x$-l/2, y$); z$tm=(x$, y$+h/2); + z$mr=(x$ml+l, y$); z$bm=(x$, y$tm-h); + z$bl=1/2[z$ml,z$bm]; + z$br=1/2[z$bm,z$mr]; + z$tr=1/2[z$mr,z$tm]; + z$tl=1/2[z$tm,z$ml]; + z$c=z$; + draw z$ml--z$bm--z$mr--z$tm--cycle; + label(str, z$c); +enddef; + +def drawtwodiamondbox(suffix $)(expr l, h, mrg)(text str) = + z$ml=(x$-l/2, y$); z$tm=(x$, y$+h/2); + z$mr=(x$ml+l, y$); z$bm=(x$, y$tm-h); + z$bl=1/2[z$ml,z$bm]; + z$br=1/2[z$bm,z$mr]; + z$tr=1/2[z$mr,z$tm]; + z$tl=1/2[z$tm,z$ml]; + z$c=z$; + begingroup + save v_, p, tl, sf; + pair v_; + numeric tl, sf; + path p[]; + p1 = z$ml--z$bm--z$mr--z$tm--cycle; + draw p1; + v_ := z$c-z$tr; + tl := (xpart v_)++(ypart v_); + sf = 1.0 - mrg/tl; + p2 = p1 shifted -z$c scaled sf shifted z$c; + draw p2; + endgroup; + label(str, z$c); + +enddef; + +def drawdoublerectangle(suffix $)(expr l, h, tf) = + rectpoints($, l, h); + z$tfl=tf[z$tl,z$bl]; z$tfr=tf[z$tr,z$br]; + z$cb=1/2[z$bl,z$tfr]; + z$ct=1/2[z$tfl,z$tr]; + draw z$bl--z$br--z$tr--z$tl--cycle; + draw z$tfl--z$tfr; +enddef; + +def drawtriplerectangle(suffix $)(expr l, h, tf, bf) = + rectpoints($, l, h); + z$tfl=tf[z$tl,z$bl]; z$tfr=tf[z$tr,z$br]; + z$bfl=bf[z$bl,z$tl]; z$bfr=bf[z$br,z$tr]; + z$cb=1/2[z$bl,z$bfr]; + z$cm=1/2[z$bfl,z$tfr]; + z$ct=1/2[z$tfl,z$tr]; + draw z$bl--z$br--z$tr--z$tl--cycle; + draw z$bfl--z$bfr; + draw z$tfl--z$tfr; +enddef; + +def hiderectangle(suffix $)(expr l, h) = + begingroup + save c; + pair c[]; + c1=(x$,y$); + c2=c1+(l,0); + c3=c1+(l,h); + c4=c1+(0,h); + unfilldraw c1--c2--c3--c4--cycle; + endgroup +enddef; + +def drawdashboxover(suffix $)(expr l, h) = + rectpoints($, l, h); + hiderectangle($, l, h); + z$c = 1/2[z$bl,z$tr]; + draw z$bl--z$br--z$tr--z$tl--cycle dashes; +enddef; + +def drawindexbox(suffix $)(expr l, h, lp, hp)(text str) = + rectpoints($, l, h); + z$c = 1/2[z$bl,z$tr]; + z$P = z$tl; + rectpoints($P, lp, hp); + z$P.c = 1/2[z$P.bl, z$P.tr]; + draw z$bl--z$br--z$tr--z$tl--cycle; + draw z$P.bl--z$P.br--z$P.tr--z$P.tl--cycle; + label(str, z$P.c); +enddef; + +def drawroundedbox(suffix $)(expr l, h, r)(text str) = + rectpoints($, l, h); + begingroup + save rad; + numeric rad; rad := r; + if rad > l/2: + rad := l/2; + fi + if rad > h/2: + rad := h/2; + fi + draw (x$br-rad, y$br){right}..{up}(x$br, y$br+rad)-- + (x$tr, y$tr-rad){up}..{left}(x$tr-rad, y$tr)-- + (x$tl+rad, y$tl){left}..{down}(x$tl, y$tl-rad)-- + (x$bl, y$bl+rad){down}..{right}(x$bl+rad, y$bl)--cycle; + endgroup; + z$c = 1/2[z$bl,z$tr]; + label(str, z$c); +enddef; + +def drawovalbox(suffix $)(expr l, h)(text str) = + ellipsepoints($, l, h); + z$c = 1/2[z$ml,z$mr]; + begingroup + save p; + path p; + p = fullcircle scaled h xscaled (l/h) shifted z$c; + draw p; + endgroup; + label(str, z$c); +enddef; + +def drawdashellipse(suffix $)(expr l, h) = + ellipsepoints($, l, h); + z$c = 1/2[z$ml,z$mr]; + begingroup + save p; + path p; + p = fullcircle scaled h xscaled (l/h) shifted z$c; + draw p dashes; + endgroup +enddef; + +def drawdrum(suffix $)(expr l, h)(text str) = + save vdia; numeric vdia; + vdia := drumlid*l; % ellipse vertical diameter + save pf, ph; path pf, ph; % full & half ellipse paths + + % points on the basic rectangle + z$bl = z$; + z$tr = (x$+l, y$+h); + z$br = (x$tr, y$); + z$tl = (x$, y$tr); + z$ml = 1/2[z$bl,z$tl]; + z$mr = 1/2[z$br,z$tr]; + z$tc = 1/2[z$tl,z$tr]; % center of top rectangle line + z$bc = 1/2[z$bl,z$br]; + % draw box sides + draw z$tl--z$bl; draw z$tr--z$br; + + % points on top ellipse + z$T''' = z$tc; % ellipse center + ellipsepoints($T''', l, vdia); + z$tm = z$T'''.tm; + z$tml = z$T'''.tl; + z$tmr = z$T'''.tr; + + % points on bottom ellipse + z$B''' = z$bc; + ellipsepoints($B''', l, vdia); + z$bm = z$B'''.bm; + z$bml = z$B'''.bl; + z$bmr = z$B'''.br; + + % box center point + z$c = 1/2[z$T'''.bm, z$B'''.bm]; + + % draw top ellipse + pf = fullcircle scaled vdia xscaled (l/vdia) shifted z$T'''; + draw pf; + % draw bottom half ellipse + ph = (halfcircle rotated 180) scaled vdia xscaled (l/vdia) shifted z$B'''; + draw ph; + label(str, z$c); +enddef; + +def drawoutputbox(suffix $)(expr l, h)(text str) = + rectpoints($, l, h); + begingroup + save c; + pair c[]; + c1 = (x$br, y$br+1/8h); % right side of box is shorter + c2 = (x$bm, y$bm+1/16h); + % draw the tear + draw z$bl..c2{dir 45}..c1{dir -15}--z$tr--z$tl--cycle; + endgroup; + z$c = (x$bm, 1/2(y$bm+y$tm)); + label(str, z$c); +enddef; + +\def drawstickman(suffix $)(expr l, h) = + rectpoints($,l,h); + begingroup + save c; + pair c[]; + c1 = 8/24[z$bm,z$tm]; + c2 = 15/24[z$bm,z$tm]; + c3 = 18/24[z$bm,z$tm]; + c4 = 1/2[c3,z$tm]; + c6 = (x$bl, ypart(c2)); + c7 = (x$br, ypart(c2)); + draw z$bl--c1--z$br; % legs + draw c1--c3; % body + draw c6--c7; % arms + draw c3{right}..z$tm{left}..cycle; % head + endgroup; +enddef; + -- cgit v1.2.3