summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bardiag/bardiag.cfg
blob: b5910c14424bebfe9c74f3a99c7e815336d22790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
% New colors defined
\definecolor{brown}{rgb}{.65, .16, .16}

\definecolor{lightblue}{rgb}{.68, .85, .9}
\definecolor{lightred}{rgb}{1.0, .65, .65}

\definecolor{darkyellow}{rgb}{0.6, 0.6, 0.3}

\definecolor{palegreen}{rgb}{.6, .98, .6}
\definecolor{pink}{rgb}{1, .75, .8}
\definecolor{wheat}{rgb}{.96, .87, .7}
\definecolor{verylightgray}{gray}{0.95}


\newcommand{\arrowheight}{\dbar}
\newcommand{\arrowwidth}{\dbar}

\newcommand{\ARbot}{0}
\newcommand{\RECTmid}{0}
\newcommand{\RECTwidth}{0.7} % 70% from \dbar
\newcommand{\RECTleft}{0}
\newcommand{\RECTright}{0}

\newcommand{\mytempx}{0}
\newcommand{\mytempxx}{0}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    Additional bar primitives    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\barArrowRect}[6][fillstyle=solid]
{\ifthenelse{\bdorientation = \bdvert}
  {\FPfadd{\mytempx}{#2}{#4}
   \FPdiv{\RECTmid}{\mytempx}{2}

   \FPfsub{\ARbot}{#5}{\arrowheight}
                      
   \FPmul{\mytempx}{\dbar}{\RECTwidth}
   \FPdiv{\mytempxx}{\mytempx}{2}
   \FPfsub{\RECTleft}{\RECTmid}{\mytempxx}
   \FPfadd{\RECTright}{\RECTmid}{\mytempxx}                         
     
   \psframe[linestyle=none,fillcolor=#6,linecolor=#6,#1](\RECTleft,#3)(\RECTright,\ARbot)
   \pspolygon[fillcolor=#6,linecolor=#6,#1](#2,\ARbot)(\RECTmid,#5)(#4,\ARbot)(#2,\ARbot)
  }
  {\FPfadd{\mytempx}{#3}{#5}
   \FPdiv{\RECTmid}{\mytempx}{2}
   \FPfsub{\ARbot}{#4}{\arrowheight}
   \FPmul{\mytempx}{\dbar}{\RECTwidth}
   \FPdiv{\mytempxx}{\mytempx}{2}
   \FPfsub{\RECTleft}{\RECTmid}{\mytempxx}
   \FPfadd{\RECTright}{\RECTmid}{\mytempxx} 
   \psframe[linestyle=none,fillcolor=#6,linecolor=#6,#1](#2,\RECTleft)(\ARbot,\RECTright)
   \pspolygon[fillcolor=#6,linecolor=#6,#1](\ARbot,#3)(#4,\RECTmid)(\ARbot,#5)(\ARbot,#3)
  }
}
%---------------------------------------
\newcommand{\barGradRect}[6][fillstyle=gradient]
{\ifthenelse{\bdorientation = \bdvert} 
  {\psframe[gradbegin=#6,gradend=white,gradmidpoint=1,gradangle=45,
           fillstyle=gradient,linestyle=none,linecolor=#6](#2,#3)(#4,#5)
  }
  {\psframe[gradbegin=#6,gradend=white,gradmidpoint=1,gradangle=-45,
           fillstyle=gradient,linestyle=none,linecolor=#6](#2,#3)(#4,#5)
  }
}

\newcommand{\barGradMidRect}[6][fillstyle=gradient]
{\ifthenelse{\bdorientation = \bdvert} 
  {\psframe[gradbegin=#6,gradend=white,gradmidpoint=0.3,gradangle=90,
           fillstyle=gradient,linestyle=none,linecolor=#6](#2,#3)(#4,#5)
  }
  {\psframe[gradbegin=#6,gradend=white,gradmidpoint=0.3,gradangle=0,
           fillstyle=gradient,linestyle=none,linecolor=#6](#2,#3)(#4,#5)
  }
}
%---------------------------------------
\newcommand{\barGradCylinder}[6][fillstyle=gradient]
{ \FPmul{\xtd}{\dbar}{\tdx}
  \FPmul{\ytd}{\dbar}{\tdy}

  \FPdiv{\elRx}{\dbar}{2}
  \FPdiv{\elRy}{\ytd}{2}

  \ifthenelse{\bdorientation = \bdvert}
  {
    \FPfadd{\tmpvar}{#2}{#4}
    \FPdiv{\xtda}{\tmpvar}{2} % Xcenter of the bottom ellipse
    \FPdiv{\tmpvar}{\ytd}{2}
    \FPfadd{\ytda}{\tmpvar}{#3} % Ycenter of the bottom ellipse
    \newpsstyle{gradcylstyle}{gradbegin=#6,gradend=white,gradmidpoint=0.25,gradangle=90,fillstyle=gradient,linestyle=none,linecolor=#6}
    % Draw the bottom ellipse
    \psellipse[style=gradcylstyle](\xtda,\ytda)(\elRx,\elRy)
    \FPdiv{\tmpvar}{\ytd}{2}
    \FPfadd{\ytdb}{\tmpvar}{#5} % Ycenter of the top ellipse
    % Draw the rectangle
    \psframe[style=gradcylstyle](#2,\ytda)(#4,\ytdb) 
    % Draw the top ellipse
    \psellipse[fillstyle=solid,fillcolor=#6,linecolor=#6](\xtda,\ytdb)(\elRx,\elRy)
  }
  { \FPfadd{\tmpvar}{#3}{#5}
    \FPdiv{\ytda}{\tmpvar}{2}
    \FPdiv{\tmpvar}{\ytd}{2}
    \FPfadd{\xtda}{\tmpvar}{#2}
    \newpsstyle{gradcylstyle}{gradbegin=#6,gradend=white,gradmidpoint=0.25,gradangle=0,fillstyle=gradient,linestyle=none,linecolor=#6}
    % Draw the left ellipse
    \psellipse[style=gradcylstyle](\xtda,\ytda,)(\elRy,\elRx)
    \FPdiv{\tmpvar}{\ytd}{2}
    \FPfadd{\ytdb}{\tmpvar}{#4} 
    % Draw the rectangle
    \psframe[style=gradcylstyle](\xtda,#3)(\ytdb,#5)  
    % Draw the right ellipse
    \psellipse[fillstyle=solid,fillcolor=#6,linecolor=#6](\ytdb,\ytda)(\elRy,\elRx)
  }
}
%---------------------------------------
\newcommand{\barCoil}[6][qq]
{\ifthenelse{\bdorientation = \bdvert}
  {\FPfadd{\mytempx}{#2}{#4}
   \FPdiv{\RECTmid}{\mytempx}{2}
   \pscoil[linecolor=#6,linewidth=3pt]{->}(\RECTmid,#3)(\RECTmid,#5)
  }
  {\FPfadd{\mytempx}{#3}{#5}
   \FPdiv{\RECTmid}{\mytempx}{2}
   \pscoil[linecolor=#5,linewidth=3pt]{->}(#2,\RECTmid)(#4,\RECTmid)
  }
}