From 4cde391f5f1ba80c803fc02adece857e5eb720f7 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Sun, 21 Aug 2005 17:46:52 +0000 Subject: Fixed scalar_redraw to check if glist is visible; moved 'data' doc and updated it somewhat. svn path=/trunk/; revision=3441 --- pd/doc/4.data.structures/05.array.pd | 120 +++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 pd/doc/4.data.structures/05.array.pd (limited to 'pd/doc/4.data.structures/05.array.pd') diff --git a/pd/doc/4.data.structures/05.array.pd b/pd/doc/4.data.structures/05.array.pd new file mode 100644 index 00000000..15e43d22 --- /dev/null +++ b/pd/doc/4.data.structures/05.array.pd @@ -0,0 +1,120 @@ +#N struct template5 float x float y float z float q array bazoo template5-element +; +#N struct template5-element float y; +#N canvas 67 294 709 456 12; +#X obj 235 323 pointer; +#X floatatom 232 183 0 0 0 0 - - -; +#X msg 235 300 bang; +#X floatatom 15 200 0 0 0 0 - - -; +#X floatatom 17 350 0 0 0 0 - - -; +#X floatatom 235 369 0 0 0 0 - - -; +#X floatatom 451 276 0 0 0 0 - - -; +#X obj 451 229 pointer; +#X obj 318 163 pointer; +#X msg 449 194 bang; +#N canvas 0 0 384 196 data5 1; +#X scalar template5 60 109 30 9 \; 0 \; 0 \; 0 \; 0 \; 0 \; 3 \; 0 +\; 0 \; 0 \; 7 \; -60 \; -66 \; -68 \; -70 \; -88 \; -100 \; -100 \; +14 \; 12 \; 8 \; 6 \; 2 \; -4 \; -26 \; -34 \; -58 \; -60 \; -66 \; +-66 \; -66 \; -66 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 +\; 0 \; 0 \; 0 \; 0 \; 43 \; 0 \; 0 \; 0 \; 0 \; \;; +#X restore 508 314 pd data5; +#N canvas 470 534 646 260 template5 1; +#X obj 8 91 filledpolygon 244 q 3 0 0 20 z 40 0; +#X text 6 44 this declares an array named "bazoo" whose elements are +described by "template5-element." Array declarations take three arguments +while "float" declarations take only two.; +#X text 6 136 Here we ask to plot the array \, color 700 \, line width +3 \, starting location (30 \, 10) relative to the scalar \, points +spaced 4 apart.; +#X text 7 186 You can also do (x \, y) plots and/or make the line thickness +variable---see the help window for "plot".; +#X obj 6 8 struct template5 float x float y float z float q array bazoo +template5-element; +#X obj 8 113 plot bazoo 700 3 30 40 4; +#X restore 508 337 pd template5; +#N canvas 65 248 568 128 template5-element 0; +#X text 12 36 This says that array elements will have a single floating-point +number named "y". The variable name "y" is automatically assumed to +control screen height \; if you don't have at least that variable you +can't plot the array..; +#X obj 35 11 struct template5-element float y; +#X restore 508 360 pd template5-element; +#N canvas 515 84 589 429 stuff 0; +#X obj 354 163 pointer; +#X obj 136 102 t b b b; +#X msg 136 61 bang; +#X text 170 61 click here to re-initialize; +#X obj 134 163 append template5 x y z q; +#X msg 354 100 \; pd-data5 clear; +#X msg 354 140 traverse pd-data5 \, bang; +#X msg 283 280 50; +#X obj 284 307 setsize template5 bazoo; +#X obj 137 23 loadbang; +#X msg 134 140 50 150 30 9; +#X obj 134 191 t b b p; +#X floatatom 68 327 0 0 0 0 - - -; +#X floatatom 14 332 0 0 0 0 - - -; +#X obj 14 376 set template5-element y; +#X obj 68 350 element template5 bazoo; +#X obj 20 303 unpack; +#X msg 12 258 3 5 \, 7 9 \, -30 10 \, 43 45; +#X connect 0 0 4 4; +#X connect 1 0 10 0; +#X connect 1 1 6 0; +#X connect 1 2 5 0; +#X connect 2 0 1 0; +#X connect 4 0 11 0; +#X connect 6 0 0 0; +#X connect 7 0 8 0; +#X connect 9 0 2 0; +#X connect 10 0 4 0; +#X connect 11 0 17 0; +#X connect 11 1 7 0; +#X connect 11 2 8 1; +#X connect 11 2 15 1; +#X connect 12 0 15 0; +#X connect 13 0 14 0; +#X connect 15 0 14 1; +#X connect 16 0 13 0; +#X connect 16 1 12 0; +#X connect 17 0 16 0; +#X restore 508 383 pd stuff; +#X msg 318 140 traverse pd-data5 \, next; +#X obj 451 252 getsize template5 bazoo; +#X obj 232 229 setsize template5 bazoo; +#X obj 17 373 set template5-element y; +#X obj 235 346 get template5-element y; +#X obj 15 223 element template5 bazoo; +#X text 38 15 Scalars may contain arrays \, and moreover the elements +of an array can be of any scalar type (and can have sub-arrays recursively.) +The type of the element of an array is fixed in the template. In this +case \, "template5" contains the definition of the top-level scalar +and "template5-element" is the template of each array element (see +the template subpatch.); +#X text 328 121 click to get pointer; +#X text 449 173 get size; +#X text 221 158 set size; +#X text 16 133 select an individual; +#X text 16 153 element \, which is a; +#X text 14 169 scalar with template; +#X text 104 189 template5; +#X text 12 413 work as before \, but on; +#X text 12 433 array elements...; +#X text 433 424 Updated for Pd version 0.35; +#X text 17 395 normal "set" amd "get"; +#X connect 0 0 18 0; +#X connect 1 0 16 0; +#X connect 2 0 0 0; +#X connect 3 0 19 0; +#X connect 4 0 17 0; +#X connect 7 0 15 0; +#X connect 8 0 16 1; +#X connect 8 0 19 1; +#X connect 8 0 7 0; +#X connect 9 0 7 0; +#X connect 14 0 8 0; +#X connect 15 0 6 0; +#X connect 18 0 5 0; +#X connect 19 0 0 0; +#X connect 19 0 17 1; -- cgit v1.2.1