-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTotem1_4.ps
205 lines (171 loc) · 6.51 KB
/
Totem1_4.ps
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
%!PS-Adobe-3.0
%%DocumentData: Clean7Bit
%%EndComments
%%BeginProlog
/threads 5 def
/style 2 def
/parity false def
/LW 0.01 def
/onepiecesize 1 def
%%EndProlog
/params { % par1 .. parn [ name1 .. namen ] ->
1 dict begin /names exch def
/l names length def l array astore /pars exch def
<< 0 1 l 1 sub { dup names 2 -1 roll get pars 3 -1 roll get } for >>
end begin } def
/odd {2 mod 1 eq} def %n -> true, if odd, false, if even
/even {2 mod 0 eq} def %n -> true, if even, false, if odd
/max { % a b -> a, if a>b; b otherwise
[/a /b ] params a b gt {a} {b} ifelse end } def
/onepiece { % x1 y1 direction ->
[/x1 /y1 /dir] params
/x2 x1 onepiecesize add def /y2 y1 onepiecesize add def
/xstep onepiecesize threads div def /ystep onepiecesize threads div def
style 0 eq { % Lines
1 1 threads 1 sub {/i exch def
x1 xstep i mul add y1 moveto
dir {x1 y1 ystep i mul add}
{x2 y2 ystep i mul sub} ifelse lineto stroke
x2 xstep i mul sub y2 moveto
dir {x2 y2 ystep i mul sub}
{x1 y1 ystep i mul add} ifelse lineto stroke
} for
dir {x1 y2 moveto x2 y1 lineto stroke} {x1 y1 moveto x2 y2 lineto stroke} ifelse
} if
style 1 eq { % 2 angles + main diagonal
dir {
x1 y1 moveto x1 xstep add y1 lineto x1 y1 ystep add lineto fill stroke
x2 y2 moveto x2 xstep sub y2 lineto x2 y2 ystep sub lineto fill stroke
x1 xstep add y2 moveto x1 y2 lineto x1 y2 ystep sub lineto
x2 xstep sub y1 lineto x2 y1 lineto x2 y1 ystep add lineto fill stroke
} {
x2 y1 moveto x2 xstep sub y1 lineto x2 y1 ystep add lineto fill stroke
x1 y2 moveto x1 xstep add y2 lineto x1 y2 ystep sub lineto fill stroke
x1 xstep add y1 moveto x1 y1 lineto x1 y1 ystep add lineto
x2 xstep sub y2 lineto x2 y2 lineto x2 y2 ystep sub lineto fill stroke
} ifelse
} if
style 2 eq { % 2 angles + main diagonal
0 1 threads { /k exch def
k odd parity xor {
dir {
x1 xstep k 1 sub mul add y1 moveto x1 xstep k mul add y1 lineto
x1 y1 ystep k mul add lineto x1 y1 ystep k 1 sub mul add lineto fill stroke
x2 xstep k 1 sub mul sub y2 moveto x2 xstep k mul sub y2 lineto
x2 y2 ystep k mul sub lineto x2 y2 ystep k 1 sub mul sub lineto fill stroke
} {
x2 xstep k 1 sub mul sub y1 moveto x2 xstep k mul sub y1 lineto
x2 y1 ystep k mul add lineto x2 y1 ystep k 1 sub mul add lineto fill stroke
x1 xstep k 1 sub mul add y2 moveto x1 xstep k mul add y2 lineto
x1 y2 ystep k mul sub lineto x1 y2 ystep k 1 sub mul sub lineto fill stroke
} ifelse
} if
} for
} if
end} def
/onepiece_ { % x1 y1 direction size->
[/onepiecesize] params
/threads threads onepiecesize mul 8 div def
onepiece
end}def
/onequarter { % rank quarter direction ->
[/rank /quarter /dir] params
gsave 90 quarter mul rotate
0 1 rank 1 sub{/i exch def
0 1 rank 1 sub {/j exch def
% /parity i odd j odd xor def
% /parity dir not def
/parity threads even {i odd j i ge and j odd i j ge and or}{false} ifelse def
i j i j max odd dir xor onepiece
} for
} for
grestore end}def
/Times-Roman 12 selectfont
%%Page: "01" 01
LW setlinewidth
297.638 80.6929 moveto (Totem 1/4) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 68.6929 moveto (Base test) dup stringwidth pop neg 2 div 0 rmoveto show
% 297.638 56.6929 moveto (It needs: 297.638 422.362 translate 226.772 dup scale) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 422.362 translate 226.772 dup scale
% 1 1 moveto -1 1 lineto stroke -1 1 moveto -1 -1 lineto stroke
% -1 -1 moveto 1 -1 lineto stroke 1 -1 moveto 1 1 lineto stroke
0 0 true onepiece 0 -1 false onepiece -1 0 false onepiece -1 -1 true onepiece
showpage
%%EndPage: "01" 01
%%Page: "02" 02
LW setlinewidth
/rank 8 def
297.638 80.6929 moveto (Totem 1/4) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 68.6929 moveto (switched) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 422.362 translate 226.772 rank div dup scale
% rank rank moveto rank neg rank lineto stroke
% rank neg rank moveto rank neg rank neg lineto stroke
% rank neg rank neg moveto rank rank neg lineto stroke
% rank rank neg moveto rank rank lineto stroke
rank 0 false onequarter rank 1 true onequarter
rank 2 false onequarter rank 3 true onequarter
showpage
%%EndPage: "02" 02
%%Page: "03" 03
LW setlinewidth
/rank 8 def
297.638 80.6929 moveto (Totem 1/4) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 68.6929 moveto (straight) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 422.362 translate 226.772 rank div dup scale
% rank rank moveto rank neg rank lineto stroke
% rank neg rank moveto rank neg rank neg lineto stroke
% rank neg rank neg moveto rank rank neg lineto stroke
% rank rank neg moveto rank rank lineto stroke
rank 0 true onequarter rank 1 true onequarter
rank 2 true onequarter rank 3 true onequarter
showpage
%%EndPage: "03" 03
%%Page: "04" 04
LW setlinewidth
/rank 4 def
297.638 80.6929 moveto (Totem 3/4) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 422.362 translate 226.772 rank div 0.8 mul dup scale
% rank rank moveto rank neg rank lineto stroke
% rank neg rank moveto rank neg rank neg lineto stroke
% rank neg rank neg moveto rank rank neg lineto stroke
% rank rank neg moveto rank rank lineto stroke
gsave 45 rotate
rank 0 true onequarter
rank 1 true onequarter
rank 2 false onequarter
rank 3 true onequarter
grestore
showpage
%%EndPage: "04" 04
%%Page: "05" 05
/threads 4 def
LW setlinewidth /onepiecesize 1 def
297.638 80.6929 moveto (Totem Spiral) dup stringwidth pop neg 2 div 0 rmoveto show
297.638 422.362 translate 226.772 18 div dup scale
/first false def /second true def
/basepattern { %first_or_second ->
[/fs] params
/t true fs xor def /f false fs xor def
[ [0 2 f][0 3 f][0 4 f][0 5 f][0 6 f][1 6 f][2 6 f][3 6 f][4 6 f]
[1 1 t][1 2 t][1 3 t][1 4 t][1 5 t][2 5 t][3 5 t][4 5 t][5 5 t]
[2 0 f][2 1 f][2 2 f][2 3 f][2 4 f][3 4 f][4 4 f][5 4 f][6 4 f]
[3 0 t][3 1 t][3 2 t][3 3 t][4 3 t][5 3 t][6 3 t]
[4 1 f][4 2 f][5 1 f][5 2 f]
[4 0 t][5 0 t][6 0 t][6 1 t][6 2 t]
] {aload pop onepiece} forall
end}def
/pattern { % x y phase first_or_second ->
[/x /y /p /fs] params
gsave
x y 4 4 rectclip
x 3 sub p 0.25 mul add y p 0.25 mul sub translate
fs basepattern
grestore
end}def
/a [[-6 -18][0 -20][6 -18][12 -14][14 -8][16 -2][16 4][10 6][4 4][-2 6][-8 4][-10 -2]] def
1 1 a length {/I exch 1 sub def
a I get aload pop I first pattern
a I get aload pop neg 4 sub exch neg 4 sub exch I second pattern
} for
showpage
%%EndPage: "05" 05