Debian Codegraph @

texmf-dist/tex/latex/bardiag/bardiag.bar

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % bar primitives
3 \newcommand{\barRect}[6][fillstyle=solid]
4 {
5 {\psframe[linestyle=none,fillcolor=#6,#1](#2,#3)(#4,#5)}
6 }
7 % - - - - - -
8 \newcommand{\xtd}{0}
9 \newcommand{\ytd}{0}
10 \newcommand{\xtda}{0}
11 \newcommand{\ytda}{0}
12 \newcommand{\xtdb}{0}
13 \newcommand{\ytdb}{0}
14
15 \newcommand{\barTDRect}[6][fillstyle=solid]
16 {
17 %
18 \psframe[linestyle=solid,fillcolor=#6,#1](#2,#3)(#4,#5)
19
20 % let's draw polygons: left and upper
21 % left-> (#4;#3)(#4+\bdar\tdhor;#3+\dbar\tdver)
22 % (#4+\dbar\tdhor;#5+\dbar\tdver)(#4;#5)
23 % right->(#4;#5)(#4+\dbar\tdhor;#5+\dbar\tdver)
24 % (#3+\dbar\tdhor;#5+\dbar\tdver)(#2;#3)
25 %
26
27 \FPmul{\xtd}{\dbar}{\tdhor}
28 \FPmul{\ytd}{\dbar}{\tdver}
29
30 \FPfadd{\xtda}{#2}{\xtd}
31 \FPfadd{\xtdb}{#4}{\xtd}
32 \FPfadd{\ytda}{#3}{\ytd}
33 \FPfadd{\ytdb}{#5}{\ytd}
34
35 \pspolygon[linestyle=solid,fillcolor=#6,#1](#4,#3)(\xtdb,\ytda)(\xtdb,\ytdb)(#4,#5)(#4,#3)
36 \pspolygon[linestyle=solid,fillcolor=#6,#1](#4,#5)(\xtdb,\ytdb)(\xtda,\ytdb)(#2,#5)(#4,#5)
37 }
38
39 \newcommand{\elRx}{0}
40 \newcommand{\elRy}{0}
41 \newcommand{\barCylinder}[6][none]
42 {
43 \FPmul{\xtd}{\dbar}{\tdx}
44 \FPmul{\ytd}{\dbar}{\tdy}
45
46 \FPdiv{\elRx}{\dbar}{2}
47 \FPdiv{\elRy}{\ytd}{2}
48
49 \ifthenelse{\bdorientation = \bdvert}
50 {
51 \FPfadd{\tmpvar}{#2}{#4}
52 \FPdiv{\xtda}{\tmpvar}{2} % Xcenter of the bottom ellipse
53 \FPdiv{\tmpvar}{\ytd}{2}
54 \FPfadd{\ytda}{\tmpvar}{#3} % Ycenter of the bottom ellipse
55 % Draw the bottom ellipse
56 \psellipse[fillstyle=solid,fillcolor=#6](\xtda,\ytda)(\elRx,\elRy)
57 \FPdiv{\tmpvar}{\ytd}{2}
58 \FPfadd{\ytdb}{\tmpvar}{#5} % Ycenter of the top ellipse
59 % Draw the rectangle
60 \psframe[fillstyle=solid,fillcolor=#6,linecolor=#6](#2,\ytda)(#4,\ytdb)
61 \psline(#2,\ytda)(#2,\ytdb)
62 \psline(#4,\ytda)(#4,\ytdb)
63 % Draw the top ellipse
64 \psellipse[fillstyle=solid,fillcolor=#6](\xtda,\ytdb)(\elRx,\elRy)
65 }
66 { \FPfadd{\tmpvar}{#3}{#5}
67 \FPdiv{\ytda}{\tmpvar}{2}
68 \FPdiv{\tmpvar}{\ytd}{2}
69 \FPfadd{\xtda}{\tmpvar}{#2}
70 % Draw the left ellipse
71 \psellipse[fillstyle=solid,fillcolor=#6](\xtda,\ytda,)(\elRy,\elRx)
72 \FPdiv{\tmpvar}{\ytd}{2}
73 \FPfadd{\ytdb}{\tmpvar}{#4}
74 % Draw the rectangle
75 \psframe[fillstyle=solid,fillcolor=#6,linecolor=#6](\xtda,#3)(\ytdb,#5)
76 \psline(\xtda,#3)(\ytdb,#3)
77 \psline(\xtda,#5)(\ytdb,#5)
78 % Draw the right ellipse
79 \psellipse[fillstyle=solid,fillcolor=#6](\ytdb,\ytda)(\elRy,\elRx)
80 }
81 }
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%