| 1 |
%%%%%%%%%%%%%%%%%% ifgeo.gen %%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% (c) Ingo Kloeckl |
| 3 |
% This program can be redistributed and/or modified under the terms |
| 4 |
% of the LaTeX Project Public License Distributed from CTAN |
| 5 |
% archives in directory macros/latex/base/lppl.txt; either |
| 6 |
% version 1 of the License, or any later version. |
| 7 |
|
| 8 |
% History |
| 9 |
% 20.12.1999 v1.0 IK |
| 10 |
% |
| 11 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 12 |
% geometric symbols |
| 13 |
% by I.Kloeckl, [email protected] |
| 14 |
|
| 15 |
pen normalpen; |
| 16 |
normalpen := pencircle scaled 1linewidth; |
| 17 |
|
| 18 |
shadow_x := 2pt; |
| 19 |
shadow_y := 2pt; |
| 20 |
|
| 21 |
|
| 22 |
% some internal utility functions |
| 23 |
def Tri(expr n, s, phi) = |
| 24 |
if ((phi=90) or (phi=-90)): |
| 25 |
beginchar((char n),ystretch*(10pt#),xstretch*(10pt#),0); |
| 26 |
else: |
| 27 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 28 |
fi; |
| 29 |
pickup normalpen; |
| 30 |
bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch) rotated (phi); |
| 31 |
bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch) rotated (phi); |
| 32 |
top z2 = (0pt, 0.5pt*s*ystretch) rotated (phi); |
| 33 |
draw z0--z1--z2--cycle shifted(.5w,.5h); |
| 34 |
endchar; |
| 35 |
enddef; |
| 36 |
|
| 37 |
def FillTri(expr n, s, phi) = |
| 38 |
if ((phi=90) or (phi=-90)): |
| 39 |
beginchar((char n),ystretch*(10pt#),xstretch*(10pt#),0); |
| 40 |
else: |
| 41 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 42 |
fi; |
| 43 |
pickup normalpen; |
| 44 |
fill (-0.5pt,-0.5pt)--(0.5pt,-0.5pt)--(0pt,0.5pt)--cycle |
| 45 |
xscaled (s*xstretch) yscaled (s*ystretch) rotated (phi) |
| 46 |
shifted(.5w,.5h); |
| 47 |
endchar; |
| 48 |
enddef; |
| 49 |
|
| 50 |
def Cir(expr n, s) = |
| 51 |
beginchar((char n),10pt#,10pt#,0); |
| 52 |
pickup normalpen; |
| 53 |
numeric t; |
| 54 |
t:=s*1pt; |
| 55 |
draw fullcircle scaled t shifted(5pt,5pt); |
| 56 |
endchar; |
| 57 |
enddef; |
| 58 |
|
| 59 |
def FillCir(expr n, s) = |
| 60 |
beginchar((char n),10pt#,10pt#,0); |
| 61 |
pickup normalpen; |
| 62 |
numeric t; |
| 63 |
t:=s*1pt; |
| 64 |
fill fullcircle scaled t shifted(5pt,5pt); |
| 65 |
endchar; |
| 66 |
enddef; |
| 67 |
|
| 68 |
def Sq(expr n, s, shadow) = |
| 69 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 70 |
pickup normalpen; |
| 71 |
bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch); |
| 72 |
bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch); |
| 73 |
top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch); |
| 74 |
top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch); |
| 75 |
if shadow=1: |
| 76 |
path p; p := z0--z1--z2; |
| 77 |
draw p shifted(.5w+shadow_x,.5h-shadow_y); |
| 78 |
elseif shadow=2: |
| 79 |
path p; p := z0--z1--z2--z3--cycle; |
| 80 |
fill p shifted(.5w+shadow_x,.5h-shadow_y); |
| 81 |
unfill p shifted(.5w,.5h); |
| 82 |
elseif shadow=3: |
| 83 |
path p; p := z0--z1--z2--z3--cycle; |
| 84 |
draw p shifted(.5w+shadow_x,.5h-shadow_y); |
| 85 |
unfill p shifted(.5w,.5h); |
| 86 |
fi; |
| 87 |
draw z0--z1--z2--z3--cycle shifted(.5w,.5h); |
| 88 |
endchar; |
| 89 |
enddef; |
| 90 |
|
| 91 |
def FillSq(expr n, s, shadow) = |
| 92 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 93 |
pickup normalpen; |
| 94 |
bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch); |
| 95 |
bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch); |
| 96 |
top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch); |
| 97 |
top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch); |
| 98 |
if shadow=1: |
| 99 |
path p; p := z0--z1--z2; |
| 100 |
draw p shifted(.5w+shadow_x,.5h-shadow_y); |
| 101 |
elseif shadow=3: |
| 102 |
path p; p := z0--z1--z2--z3--cycle; |
| 103 |
draw p shifted(.5w+shadow_x,.5h-shadow_y); |
| 104 |
fi; |
| 105 |
fill z0--z1--z2--z3--cycle shifted(.5w,.5h); |
| 106 |
endchar; |
| 107 |
enddef; |
| 108 |
|
| 109 |
def CrossedSq(expr n, s) = |
| 110 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 111 |
pickup normalpen; |
| 112 |
bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch) shifted(.5w,.5h); |
| 113 |
bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch) shifted(.5w,.5h); |
| 114 |
top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch) shifted(.5w,.5h); |
| 115 |
top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch) shifted(.5w,.5h); |
| 116 |
draw z0--z2; draw z1--z3; |
| 117 |
endchar; |
| 118 |
enddef; |
| 119 |
|
| 120 |
def Diamond(expr n, s, shadow, fillshape) = |
| 121 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 122 |
pickup normalpen; |
| 123 |
x0 = 0pt; bot y0 = -0.5pt*s*ystretch; |
| 124 |
rt x1 = 0.5pt*s*xstretch; y1 = 0pt; |
| 125 |
x2 = 0pt; top y2 = 0.5pt*s*ystretch; |
| 126 |
lft x3 = -0.5pt*s*xstretch; y3 = 0pt; |
| 127 |
if shadow=1: |
| 128 |
path p; p := z0--z1--z2; |
| 129 |
draw p shifted(.5w+shadow_x,.5h); |
| 130 |
elseif shadow=2: |
| 131 |
path p; p := z0--z1--z2--z3--cycle; |
| 132 |
fill p shifted(.5w+shadow_x,.5h); |
| 133 |
unfill p shifted(.5w,.5h); |
| 134 |
elseif shadow=3: |
| 135 |
path p; p := z0--z1--z2--z3--cycle; |
| 136 |
draw p shifted(.5w+shadow_x,.5h); |
| 137 |
unfill p shifted(.5w,.5h); |
| 138 |
fi; |
| 139 |
draw z0--z1--z2--z3--cycle shifted(.5w,.5h); |
| 140 |
if fillshape=1: % right half filled |
| 141 |
fill z0--z1--z2--cycle shifted(.5w,.5h); |
| 142 |
elseif fillshape=2: % lower half filled |
| 143 |
fill z0--z1--z3--cycle shifted(.5w,.5h); |
| 144 |
fi; |
| 145 |
endchar; |
| 146 |
enddef; |
| 147 |
|
| 148 |
def FillDiamond(expr n, s, shadow) = |
| 149 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 150 |
pickup normalpen; |
| 151 |
x0 = 0pt; bot y0 = -0.5pt*s*ystretch; |
| 152 |
rt x1 = 0.5pt*s*xstretch; y1 = 0pt; |
| 153 |
x2 = 0pt; top y2 = 0.5pt*s*ystretch; |
| 154 |
lft x3 = -0.5pt*s*xstretch; y3 = 0pt; |
| 155 |
if shadow=1: |
| 156 |
path p; p := z0--z1--z2; |
| 157 |
draw p shifted(.5w+shadow_x,.5h); |
| 158 |
elseif shadow=3: |
| 159 |
path p; p := z0--z1--z2--z3--cycle; |
| 160 |
draw p shifted(.5w+shadow_x,.5h); |
| 161 |
fi; |
| 162 |
fill z0--z1--z2--z3--cycle shifted(.5w,.5h); |
| 163 |
endchar; |
| 164 |
enddef; |
| 165 |
|
| 166 |
def DiamondBar(expr n, s, barshape) = |
| 167 |
beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); |
| 168 |
pickup normalpen; |
| 169 |
x0 = 0pt; bot y0 = -0.5pt*s*ystretch; |
| 170 |
rt x1 = 0.5pt*s*xstretch; y1 = 0pt; |
| 171 |
x2 = 0pt; top y2 = 0.5pt*s*ystretch; |
| 172 |
lft x3 = -0.5pt*s*xstretch; y3 = 0pt; |
| 173 |
path p; |
| 174 |
if barshape=1: % horizontal bar |
| 175 |
p := z1--z3; |
| 176 |
draw p shifted(.5w,.5h); |
| 177 |
elseif barshape=2: % vertical bar |
| 178 |
p := z0--z2; |
| 179 |
draw p shifted(.5w,.5h); |
| 180 |
fi; |
| 181 |
endchar; |
| 182 |
enddef; |
| 183 |
|
| 184 |
"Bigsquare"; Sq(32,10,0); |
| 185 |
"Square"; Sq(48,8,0); |
| 186 |
"Smallsquare"; Sq(64,6,0); |
| 187 |
"FilledBigsquare"; FillSq(80,10,0); |
| 188 |
"FilledSquare"; FillSq(96,8,0); |
| 189 |
"FilledSmallsquare"; FillSq(112,6,0); |
| 190 |
|
| 191 |
"SquareShadow1"; Sq(0,8,1); |
| 192 |
"SquareShadow2"; Sq(1,8,2); |
| 193 |
"SquareShadow3"; Sq(2,8,3); |
| 194 |
"FilledSquareShadow1"; FillSq(3,8,1); |
| 195 |
"FilledSquareShadow3"; FillSq(4,8,3); |
| 196 |
|
| 197 |
|
| 198 |
"BigtriangleUp"; Tri(33,10,0); |
| 199 |
"TriangleUp"; Tri(49,8,0); |
| 200 |
"SmalltriangleUp"; Tri(65,6,0); |
| 201 |
"FilledBigtriangleUp"; FillTri(81,10,0); |
| 202 |
"FilledTriangleUp"; FillTri(97,8,0); |
| 203 |
"FilledSmalltriangleUp"; FillTri(113,6,0); |
| 204 |
|
| 205 |
"BigtriangleLeft"; Tri(34,10,90); |
| 206 |
"TriangleLeft"; Tri(50,8,90); |
| 207 |
"SmalltriangleLeft"; Tri(66,6,90); |
| 208 |
"FilledBigtriangleLeft"; FillTri(82,10,90); |
| 209 |
"FilledTriangleLeft"; FillTri(98,8,90); |
| 210 |
"FilledSmalltriangleLeft"; FillTri(114,6,90); |
| 211 |
|
| 212 |
"BigtriangleDown"; Tri(35,10,180); |
| 213 |
"TriangleDown"; Tri(51,8,180); |
| 214 |
"SmalltriangleDown"; Tri(67,6,180); |
| 215 |
"FilledBigtriangleDown"; FillTri(83,10,180); |
| 216 |
"FilledTriangleDown"; FillTri(99,8,180); |
| 217 |
"FilledSmalltriangleDown"; FillTri(115,6,180); |
| 218 |
|
| 219 |
"BigtriangleRight"; Tri(36,10,-90); |
| 220 |
"TriangleRight"; Tri(52,8,-90); |
| 221 |
"SmalltriangleRight"; Tri(68,6,-90); |
| 222 |
"FilledBigtriangleRight"; FillTri(84,10,-90); |
| 223 |
"FilledTriangleRight"; FillTri(100,8,-90); |
| 224 |
"FilledSmalltriangleRight"; FillTri(116,6,-90); |
| 225 |
|
| 226 |
"Bigcircle"; Cir(37,10); |
| 227 |
"Circle"; Cir(53,8); |
| 228 |
"Smallcircle"; Cir(69,6); |
| 229 |
"FilledBigcircle"; FillCir(85,10); |
| 230 |
"Filledcircle"; FillCir(101,8); |
| 231 |
"FilledSmallcircle"; FillCir(117,6); |
| 232 |
|
| 233 |
|
| 234 |
"BigDiamond"; Diamond(38,10,0,0); |
| 235 |
"Diamond"; Diamond(54,8,0,0); |
| 236 |
"SmallDiamond"; Diamond(70,6,0,0); |
| 237 |
"FilledBigDiamond"; FillDiamond(86,10,0); |
| 238 |
"FilledDiamond"; FillDiamond(102,8,0); |
| 239 |
"FilledSmallDiamond"; FillDiamond(118,6,0); |
| 240 |
"BigRightDiamond"; Diamond(47,10,0,1); |
| 241 |
"RightDiamond"; Diamond(63,8,0,1); |
| 242 |
"SmallRightDiamond"; Diamond(79,6,0,1); |
| 243 |
"BigLowerDiamond"; Diamond(95,10,0,2); |
| 244 |
"LowerDiamond"; Diamond(111,8,0,2); |
| 245 |
"SmallLowerDiamond"; Diamond(127,6,0,2); |
| 246 |
|
| 247 |
"DiamondShadow1"; Diamond(5,8,1,0); |
| 248 |
"DiamondShadow2"; Diamond(6,8,2,0); |
| 249 |
"DiamondShadow3"; Diamond(7,8,3,0); |
| 250 |
"DiamondSquareShadow1"; FillDiamond(8,8,1); |
| 251 |
"DiamondSquareShadow3"; FillDiamond(9,8,3); |
| 252 |
|
| 253 |
"BigCross"; CrossedSq(13,10); |
| 254 |
"Cross"; CrossedSq(14,8); |
| 255 |
"SmallCross"; CrossedSq(15,6); |
| 256 |
"BigHorBar"; DiamondBar(26,10,1); |
| 257 |
"HorBar"; DiamondBar(27,8,1); |
| 258 |
"SmallHorBar"; DiamondBar(28,6,1); |
| 259 |
"BigVertBar"; DiamondBar(29,10,2); |
| 260 |
"VertBar"; DiamondBar(30,8,2); |
| 261 |
"SmallVertBar"; DiamondBar(31,6,2); |
| 262 |
|
| 263 |
end. |
| 264 |
|
| 265 |
%%%%%%%%%%%%%%%%%% end of ifgeo.gen %%%%%%%%%%%%%%%%%%%%%%% |