-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMojiBloki.sty
320 lines (308 loc) · 10.9 KB
/
MojiBloki.sty
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
\tikzset{
controller/.style = {draw, fill=blue!20, rectangle, minimum height=3.5em, minimum width=6em},
subblock/.style= {draw, fill=blue!5, rectangle, minimum height=3.5em, minimum width=6em},
pidblocks/.style = {draw, fill=green!5, rectangle, minimum height=3.5em, minimum width=6em, text width= 6em},
sum/.style = {draw, circle, node distance=1cm, inner sep=0.15cm},
input/.style = {coordinate},
output/.style ={coordinate},
block/.style = {draw, fill=white, rectangle, minimum height=2em, minimum width=2em},
pinstyle/.style ={pin edge={to-,thin,black}},
dot/.style = {anchor=base,fill,circle,inner sep=1pt}
}
\tikzset{%
saturation block/.style={%
draw, minimum size = 0.3cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,0) -- (1,0) (0,-1) -- (0,1);
\draw [very thick] (-1,-.7) -- (-.7,-.7) -- (.7,.7) -- (1,.7);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above right] at (\mainnode.north west) {#1}%
}
}
}
\tikzset{%
Filt block/.style = {%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (-1,1) (-1,-1) -- (1,-1);
\draw [very thick] (-0.95, -1) arc [x radius =1.9, y radius = 1.4, start angle = 180, end angle = 90] ;
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above right] at (\mainnode.north west) {#1}%
}
}
}
\tikzset{%
Pctrl block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (-1,1) (-1,-1) -- (1,-1);
\draw [very thick] (-1,.4) -- (1,.4);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above] at (\mainnode.north) {#1}%
}
}
}
\tikzset{%
PIctrl block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (-1,1) (-1,-1) -- (1,-1);
\draw [very thick] (-0.95,-1) -- (-0.95, -0.2) -- (0.9,.4);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above] at (\mainnode.north) {#1}%
}
}
}
\tikzset{%
Difer block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (-1,1) (-1,-1) -- (1,-1);
\draw [very thick] (-0.97,-1) -- (-0.97, 0.6);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above right] at (\mainnode.north west) {#1}%
}
}
}
\tikzset{%
Integ block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (-1,1) (-1,-1) -- (1,-1);
\draw [very thick] (-1,-1) -- (1, 1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above] at (\mainnode.north) {#1}%
}
}
}
\tikzset{%
Limit block/.style={%
fill = none, minimum size = 0.5cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [thick] (-1,1) -- (-0.8, 0.5) -- (0.8,0.5) -- (1,1);
\draw [thick] (-1,-1) -- (-0.8, -0.5) -- (0.8,-0.5) -- (1,-1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above] at (\mainnode.north) {#1}%
}
}
}
\tikzset{%
mul above/.style={%
draw, minimum size = 0.3cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
% \tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [thick] (-1,-1) -- (1,1);
\draw [thick] (-1,1) -- (1,-1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above](A1) at ([yshift=0.5cm]\mainnode.north) {#1}%
[->] (A1) edge (\mainnode.north)
},
}
}
\tikzset{%
mul below/.style={%
draw, minimum size = 0.3cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
% \tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [thick] (-1,-1) -- (1,1);
\draw [thick] (-1,1) -- (1,-1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[below](A1) at ([yshift=-0.5cm]\mainnode.south) {#1}%
[->] (A1) edge (\mainnode.south)
},
}
}
\tikzset{%
mul left/.style={%
draw, minimum size = 0.3cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
% \tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [thick] (-1,-1) -- (1,1);
\draw [thick] (-1,1) -- (1,-1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[left](A1) at ([xshift=-0.5cm]\mainnode.west) {#1}%
[->] (A1) edge (\mainnode.west)
},
}
}
\tikzset{%
mul right/.style={%
draw, minimum size = 0.3cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
% \tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [thick] (-1,-1) -- (1,1);
\draw [thick] (-1,1) -- (1,-1);
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[right](A1) at ([xshift=0.5cm]\mainnode.east) {#1}%
[->] (A1) edge (\mainnode.east)
},
}
}
\tikzset{%
notch block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (1,-1);
\draw [thick] (-0.5, 0.8) arc [x radius =0.4, y radius = 2.4, start angle = 90, end angle =15] (-1, 0.8) -- (-0.5, 0.8) ;
\draw [thick] (0.5, 0.8) arc [x radius =0.4, y radius = 2.4, start angle = 90, end angle = 165] (1, 0.8) -- (0.5, 0.8) ;
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above right] at (\mainnode.north west) {#1}%
}
}
}
\tikzset{%
bandstop block/.style={%
draw, minimum size = 0.8cm,
path picture={
% Get the width and height of the path picture node
\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
{\pgfpointanchor{path picture bounding box}{north east}}
\pgfgetlastxy\x\y
% Scale the x and y vectors so that the range
% -1 to 1 is slightly shorter than the size of the node
\tikzset{x=\x*.4, y=\y*.4}
%
% Draw annotation
\draw [very thin] (-1,-1) -- (1,-1);
\draw [thick] (-0.5, 0.8) arc [x radius =0.8, y radius = 1.8, start angle = 90, end angle =0] (-1, 0.8) -- (-0.5, 0.8) ;
},
append after command={\pgfextra{\let\mainnode=\tikzlastnode}
node[above right] at (\mainnode.north west) {#1}%
}
}
}
\tikzset{%
set gear dots/.style={
gear dots/.style={dash pattern=on 4pt off 4pt, dash phase=#1}},
set gear dots=0pt,
pics/gears/.style args={size #1 at (#2,#3) and size #4 at (#5,#6)}{code={
\tikzmath{%
\r1 = #1/2; \r2 = #4/2;
\gm = atan2(#3-#6, #2-#5);
\th = acos((\r1 == \r2) ? 0 : (\r2-\r1) / veclen(#5-#2, #6-#3));
coordinate \c, \t;
\c1 = (#2, #3); \t1 = (\c1) + (360-\th+\gm:\r1);
\c2 = (#5, #6); \t2 = (\c2) + (\th+\gm:\r2);
}
\draw [black!80, thick, fill=gray!25] (\c1) circle [radius=\r1];
\draw [black!80, thick, fill=gray!25] (\c2) circle [radius=\r2];
\draw [gray, ultra thick, postaction={draw=gray!50, gear dots, ultra thick}]
(\t2) arc (\th+\gm:360-\th+\gm:\r2) --
(\t1) arc (360-\th+\gm:360+\th+\gm:\r1) -- cycle;
}}}