i'm going to learn data structures. (really i already spent some days
looking into the tutorials)
in particular i am interested in arrays, since my (first) goal is to
realize a multipoint envelope editor/generator.
if you look at the attached patch, i realized a template for array
container (arr) and one for array point (node).
now i have some questions:
- although the template for node has only x/y vars, (in the data
window) i get the resize handle too.... but i haven't supplied a 'w'
field in 'node'. why? my intention was: to connect these x/y points by a
fixed width line.
2) after placing the array, i use [setsize] to set num. of elements in
it. but the container doesn't grows horizontally, so it is painful have
10 points, all in the same x/y coordinate.
3) it is possible to set a constraint on a specific field? (i.e.: i do
not want the x value of a point to be negative.)
bye
--
Federico
#N struct arr float x float y array pts node;
#N struct node float x float y float w;
#N canvas 594 370 619 510 10;
#N canvas 100 489 450 300 paint 1;
#X scalar arr 0 0 ; -63 94 49 ; -23 94 16 ; 22 94 30 ; 85 104 35
; 85 104 0 ; 85 104 0 ; 85 104 0 ; 85 104 0 ; 85 104 0 ; 85 104
0 ; ;;
#X restore 16 64 pd paint;
#N canvas 662 84 450 300 node 0;
#X obj 58 76 struct node float x float y;
#X obj 66 159 filledpolygon 900 1 0 0 20 0;
#X restore 16 43 pd node;
#X obj 137 35 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 337 99 ; pd-paint clear;
#X msg 317 134 traverse pd-paint , bang;
#X obj 317 157 pointer;
#N canvas 511 554 450 300 arr 0;
#X obj 101 87 struct arr float x float y array pts node;
#X obj 101 127 plot pts 700 3 100 0;
#X obj 102 184 filledpolygon 0 5 0 0 90 0 0 0 300 0;
#X restore 16 22 pd arr;
#X obj 282 196 append arr x y;
#X obj 260 135 0;
#X obj 153 291 setsize arr pts;
#X obj 260 157 t b f f;
#X msg 229 235 traverse pd-paint , next;
#X obj 229 258 pointer;
#X obj 137 55 t b b b b b b b b b b b b;
#X obj 167 258 10;
#X text 158 30 < clear , create array , resize array;
#X connect 2 0 13 0;
#X connect 4 0 5 0;
#X connect 5 0 7 2;
#X connect 8 0 10 0;
#X connect 10 1 7 0;
#X connect 10 2 7 1;
#X connect 11 0 12 0;
#X connect 12 0 9 1;
#X connect 13 2 14 0;
#X connect 13 6 11 0;
#X connect 13 8 8 0;
#X connect 13 10 4 0;
#X connect 13 11 3 0;
#X connect 14 0 9 0;