#N struct template1 float x float y float z float q; #N canvas 443 95 579 461 16; #N canvas 32 57 398 345 data 1; #X scalar template1 105 64 35 209 \;; #X scalar template1 160 64 31 9 \;; #X scalar template1 269 61 67 900 \;; #X scalar template1 220 65 23 900 \;; #X coords 0 345 1 344 0 0 0; #X restore 80 156 pd data; #N canvas 413 382 609 424 template1 1; #X text 20 260 The filledpolygon's arguments are interior color \, border color \, border width \, and then the points of the polygon. Arguments which are symbols ("q" and "z" in this case) mean to take the values from the data structure. Other values are constant. The position of the object is automatically controlled by fields named "x" and "y".; #X obj 60 21 struct template1 float x float y float z float q; #X text 21 152 This subpatch acts as a template which describes the data structure. The "struct" specifies four floating point values named x \, y \, z \, and q. The "filledpolygon" is a drawing instruction. Templates should have only one template object but may have any number of drawing instructions.; #X obj 83 81 filledpolygon q q 5 0 0 20 z 40 0; #X obj 85 127 drawnumber y 0 0 0; #X obj 89 57 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1 ; #X obj 76 105 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X connect 5 0 3 0; #X connect 6 0 4 0; #X restore 80 180 pd template1; #N canvas 0 50 440 292 stuff 0; #X obj 235 185 pointer; #X obj 28 187 append template1 x y z q; #X msg 235 127 \; pd-data clear; #X msg 235 163 traverse pd-data \, bang; #X obj 125 128 t b b b; #X msg 125 87 bang; #X obj 125 56 loadbang; #X text 159 87 click here to re-initialize; #X text 25 243 This subpatch sets up the "data" window with two objects. How this works will get explained later.; #X msg 28 164 50 100 30 9 \, 150 100 -20 900; #X connect 0 0 1 4; #X connect 3 0 0 0; #X connect 4 0 9 0; #X connect 4 1 3 0; #X connect 4 2 2 0; #X connect 5 0 4 0; #X connect 6 0 5 0; #X connect 9 0 1 0; #X restore 79 206 pd stuff; #X text 67 134 subpatches:; #N canvas 316 551 829 650 example 1; #X msg 113 59 \; pd-data vis 0; #X msg 112 115 \; pd-data vis 1; #X obj 160 285 pointer; #X msg 160 211 traverse pd-data; #X msg 185 247 next; #X obj 169 315 print x; #X obj 251 318 print y; #X floatatom 75 538 5 0 0 0 - - -, f 5; #X floatatom 156 544 5 0 0 0 - - -, f 5; #X obj 75 509 get template1 x y z q; #X floatatom 216 545 5 0 0 0 - - -, f 5; #X floatatom 297 551 5 0 0 0 - - -, f 5; #X floatatom 156 371 5 0 0 0 - - -, f 5; #X obj 160 408 set template1 x; #X floatatom 327 377 5 0 0 0 - - -, f 5; #X obj 331 414 set template1 z; #X obj 522 162 until; #X obj 554 238 pointer; #X msg 592 191 traverse pd-data; #X msg 534 192 next; #X floatatom 498 92 5 0 0 0 - - -, f 5; #X floatatom 540 332 5 0 0 0 - - -, f 5; #X floatatom 599 334 5 0 0 0 - - -, f 5; #X obj 540 303 get template1 x y z q; #X floatatom 670 336 5 0 0 0 - - -, f 5; #X floatatom 739 340 5 0 0 0 - - -, f 5; #X obj 511 267 pointer; #X obj 502 122 t b f b; #X obj 588 468 osc~; #X obj 588 435 mtof; #X obj 599 503 *~; #X obj 646 466 line~; #X obj 642 506 *~; #X msg 661 415 1 10; #X obj 722 400 del 10; #X msg 722 429 0 1000; #X obj 639 379 b; #X msg 293 32 \; pd-data sort; #X obj 592 558 output~; #X obj 635 42 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 638 72 metro 150; #X obj 638 101 random 4; #X obj 638 130 + 1; #X connect 2 0 5 0; #X connect 2 0 9 0; #X connect 2 0 13 1; #X connect 2 0 15 1; #X connect 2 1 6 0; #X connect 3 0 2 0; #X connect 4 0 2 0; #X connect 9 0 7 0; #X connect 9 1 8 0; #X connect 9 2 10 0; #X connect 9 3 11 0; #X connect 12 0 13 0; #X connect 14 0 15 0; #X connect 16 0 19 0; #X connect 17 0 26 1; #X connect 18 0 17 0; #X connect 19 0 17 0; #X connect 20 0 27 0; #X connect 22 0 29 0; #X connect 22 0 36 0; #X connect 23 0 21 0; #X connect 23 1 22 0; #X connect 23 2 24 0; #X connect 23 3 25 0; #X connect 26 0 23 0; #X connect 27 0 26 0; #X connect 27 1 16 0; #X connect 27 2 18 0; #X connect 28 0 30 0; #X connect 29 0 28 0; #X connect 30 0 38 0; #X connect 30 0 38 1; #X connect 31 0 32 0; #X connect 31 0 32 1; #X connect 32 0 30 1; #X connect 33 0 31 0; #X connect 34 0 35 0; #X connect 35 0 31 0; #X connect 36 0 33 0; #X connect 36 0 34 0; #X connect 39 0 40 0; #X connect 40 0 41 0; #X connect 41 0 42 0; #X connect 42 0 20 0; #X restore 249 156 pd example;