/usr/lib/pd/extra/list-abs/list-centroid-help.pd is in pd-list-abs 0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #N struct 1031-centroid float x;
#N canvas 0 26 626 572 10;
#X floatatom 129 468 5 0 0 0 centroid - -;
#X msg 129 363 1 1 1 1;
#X msg 245 260 0 0 0 0;
#X msg 245 279 -1 1;
#X obj 215 469 bng 15 250 50 0 empty empty result_undefined 17 7 1
10 -262144 -1 -1;
#X msg 129 245 0 1 0;
#X obj 129 439 list-centroid;
#X text 63 25 [list-centroid];
#X text 93 90 centroid = sum(mi * i) / sum(mi);
#X text 71 49 Calculates the centroid or center of mass of a list of
floats according to:;
#X text 67 115 where the index i starts from 0;
#X msg 247 344 -1 3;
#X msg 129 287 1 2 3;
#X text 314 270 these two are undefined!;
#X msg 129 341 5 5 5;
#N canvas 0 0 450 300 randlist 0;
#X obj 134 129 until;
#X msg 246 151 set;
#X msg 134 193 add2 \$1;
#X obj 112 101 t b f b;
#X obj 135 249 outlet;
#X obj 112 31 inlet;
#X obj 112 73 + 1;
#X obj 112 53 random 10;
#X obj 134 151 random 10;
#X obj 134 171 - 5;
#X connect 0 0 8 0;
#X connect 1 0 4 0;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 3 1 0 0;
#X connect 3 2 1 0;
#X connect 5 0 7 0;
#X connect 6 0 3 0;
#X connect 7 0 6 0;
#X connect 8 0 9 0;
#X connect 9 0 2 0;
#X restore 295 337 pd randlist;
#X msg 295 363 4;
#X msg 295 315 bang;
#X msg 129 306 10 20 30;
#X msg 129 267 0 2 0 0 0 1;
#X msg 248 325 -1 2;
#X msg 248 407 -10 9;
#X text 305 406 Note: a centroid can be negative!;
#X text 75 520 2007 Frank Barknecht;
#X text 67 146 Negative values are possible.;
#X text 65 174 If all floats add up to 0 \, the result is undefined.
In this case \, no result will be sent to the first outlet \, instead
the second outlet will bang and a console warning will be issued.;
#N canvas 318 53 641 556 graphical-centroid 0;
#N canvas 0 0 450 300 randlist 0;
#X obj 134 129 until;
#X msg 246 151 set;
#X msg 134 193 add2 \$1;
#X obj 112 101 t b f b;
#X obj 135 249 outlet;
#X obj 112 31 inlet;
#X obj 134 151 random 100;
#X obj 134 171 / 100;
#X msg 112 59 10;
#X connect 0 0 6 0;
#X connect 1 0 4 0;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 3 1 0 0;
#X connect 3 2 1 0;
#X connect 5 0 8 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 3 0;
#X restore 79 388 pd randlist;
#X msg 79 366 bang;
#X obj 79 447 list prepend 0;
#X obj 79 470 s \$0-tab;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-tab 10 float 0;
#X coords 0 1 9 0 200 140 1;
#X restore 79 105 graph;
#N canvas 0 0 694 427 \$0-c 0;
#X scalar 1031-centroid 0 \;;
#X coords 0 0 18 140 200 140 1;
#X restore 79 105 pd \$0-c;
#X floatatom 339 346 5 0 0 0 - - -;
#X obj 339 313 list-centroid;
#N canvas 336 319 712 355 \$0-centroid 0;
#X obj 19 329 outlet;
#X obj 19 86 route change;
#X obj 19 62 struct \$0-centroid float x;
#X obj 228 62 drawpolygon 900 2 x 0 x 140;
#X connect 1 0 0 0;
#X connect 2 0 1 0;
#X restore 453 315 pd \$0-centroid;
#X obj 339 367 set \$0-centroid x;
#N canvas 0 0 503 429 create 0;
#X msg 242 258 traverse pd-\$1 \, bang;
#X obj 242 238 symbol \$0-c;
#X msg 107 79 0;
#X obj 242 278 pointer;
#X msg 243 178 clear;
#X obj 243 205 s pd-\$0-c;
#X obj 107 302 append \$0-centroid x;
#X obj 107 114 t a b b;
#X obj 107 50 loadbang;
#X obj 107 326 outlet;
#X connect 0 0 3 0;
#X connect 1 0 0 0;
#X connect 2 0 7 0;
#X connect 3 0 6 1;
#X connect 4 0 5 0;
#X connect 6 0 9 0;
#X connect 7 0 6 0;
#X connect 7 1 1 0;
#X connect 7 2 4 0;
#X connect 8 0 2 0;
#X restore 468 339 pd create;
#X obj 339 127 metro 50;
#X obj 339 102 tgl 15 0 empty empty show-centroid 17 7 1 10 -258699
-262144 -1 0 1;
#N canvas 473 338 450 300 countto 0;
#X obj 131 154 f 0;
#X obj 156 153 + 1;
#X msg 174 113 0;
#X obj 131 183 outlet;
#X obj 131 59 inlet;
#X obj 131 116 until;
#X obj 131 96 t a b;
#X connect 0 0 1 0;
#X connect 0 0 3 0;
#X connect 1 0 0 1;
#X connect 2 0 0 1;
#X connect 4 0 6 0;
#X connect 5 0 0 0;
#X connect 6 0 5 0;
#X connect 6 1 2 0;
#X restore 362 195 pd countto;
#X obj 362 219 tabread \$0-tab;
#X obj 362 249 list prepend;
#X obj 452 249 t a;
#X msg 362 175 10;
#X obj 339 148 t b b b;
#X obj 339 274 list;
#X text 77 30 Switch on the "show-centroid"-metro and play with the
values in the array.;
#X obj 79 344 loadbang;
#X msg 79 414 0.56 0.59 0.8 0.98 0.3 0.64 0.96 0.57 0.55 0.08;
#X connect 0 0 22 0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 6 0 9 0;
#X connect 7 0 6 0;
#X connect 8 0 9 1;
#X connect 10 0 9 1;
#X connect 11 0 18 0;
#X connect 12 0 11 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 15 0 19 1;
#X connect 16 0 15 1;
#X connect 17 0 13 0;
#X connect 18 0 19 0;
#X connect 18 1 17 0;
#X connect 18 2 15 1;
#X connect 19 0 7 0;
#X connect 21 0 1 0;
#X connect 22 0 2 0;
#X restore 392 510 pd graphical-centroid;
#X text 321 510 Also see:;
#N canvas 520 35 494 396 META 0;
#X text 12 5 KEYWORDS control list_op;
#X text 12 25 LICENSE SIBSD;
#X text 12 135 AUTHOR Frank Barknecht;
#X text 12 155 HELP_PATCH_AUTHORS Frank Barknecht. "pd meta" information
added by Jonathan Wilkes for Pd version 0.42.;
#X text 12 75 INLET_0 list;
#X text 12 95 OUTLET_0 float;
#X text 12 115 OUTLET_1 bang;
#X text 12 45 DESCRIPTION calculate the centroid or center of mass
of a list of floats;
#X restore 544 540 pd META;
#X connect 1 0 6 0;
#X connect 2 0 6 0;
#X connect 3 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 0 0;
#X connect 6 1 4 0;
#X connect 11 0 6 0;
#X connect 12 0 6 0;
#X connect 14 0 6 0;
#X connect 15 0 16 0;
#X connect 16 0 6 0;
#X connect 17 0 15 0;
#X connect 18 0 6 0;
#X connect 19 0 6 0;
#X connect 20 0 6 0;
#X connect 21 0 6 0;
|