[PD] get the position of the mass in the same order than the creation with MSD

Frank Barknecht fbar at footils.org
Sat Jul 10 10:36:10 CEST 2010


Hi,

On Fri, Jul 09, 2010 at 07:18:22PM +0200, cyrille henry wrote:
> a MSD link in pure vanila pd, that would be awesome!

I did run [physigs] on the iPhone with RjDj already and even with the
link-force-distribution made with messages, it's no problem to run a
chain for scanned synthesis that is 256 points long or longer.

> i had the same problem when doing the PM on a GPU shader.
> the solution was to hard coded the link topology in the shader.
> so it does not help you to create a generic solution...
> 
> for physigs i think the solution is the look at the problem the other way around.
> do not have link oriented table, but mass oriented.
> i.e :
> if you wish to connect masse 22 and mass 33 , you have to create a
> conection1 table that could have 33 in the index 22 and 33 in the
> index 22.  then sending connection1 to a code that compute the link.
> 
> you can have an other table to compute a 2nd link with other
> parameter.  all of the links contribution will then be summed with a
> simple "+~"
> 
> of course this is very inefficient if you have 10000 masses and 2
> links, since you have to compute forces for all masses. but if all
> mass n are connected to mass n+1, then all link can be computed in
> only 2 times.  the only optimisation you're missing is that F(1->2) =
> -F(2->1), so you have to compute 2 time the same link.  but this is
> negligible regarding to the performance boost you'll get...
> 
> do you understand my point, and do you think it can be done?

It's a good idea, I will try this. When I hit the wall with my current
approach, I already thought that probably I'd need to try some different
approaches on the level of the basic data structures used. Actually
that's the nice thing about the BSP idiom described in my paper: It is
all patched in Pd without any compiled externals used, so it's very easy
to try out different optimizations or algorithms for a "normal" user.
It's also possible to design "un-physical" modelling systems that
violate the usual Newtonian rules or to get specific meta-information
like center-of-gravity of link-forces or so very efficiently and use
these meta-infos to drive other processes. The latter made me start a
little feature extraction library similar to William Brent's
timbreID/tabletool objects, but with a vanilla taste to use in RjDj or
similar environments.

I also started to clone your pm-mapping objects, see attachment, which
probably uses some list-abs and rj objects (http://github.com/rjdj/rjlib) IIRC.

Ciao
-- 
Frank
-------------- next part --------------
#N canvas 160 0 1120 649 10;
#X obj 550 507 print;
#X obj 667 523 r \$0-massbang;
#X obj 746 548 r \$0-linkbang;
#X obj 825 574 r \$0-control;
#X msg 840 606 help;
#X obj 835 133 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 835 175 f;
#X obj 872 176 ==;
#X obj 835 197 select 0 1;
#X obj 863 219 s \$0-linkbang;
#X obj 835 241 s \$0-massbang;
#X text 858 129 how to drive [physigs];
#X msg 921 148 \; pd dsp 1;
#X msg 190 42 reset;
#X msg 226 106 force 0.2 0.1;
#X msg 215 85 forceY -0.1;
#X obj 511 548 s \$0-control;
#X msg 999 533;
#X obj 94 479 gem-display-fixmob \$0-cloud 16 32;
#X obj 182 548 gemwin;
#X msg 184 521 create \, 1;
#X msg 238 300 table force-x const 0.1;
#X obj 98 280 list-random 1000 2;
#X obj 98 309 list-map;
#X obj 170 306 / 1000;
#X msg 98 248 bang;
#X floatatom 924 194 5 0 0 0 - - -;
#X floatatom 82 114 5 0 0 0 - - -;
#X floatatom 99 129 5 0 0 0 - - -;
#X obj 127 107 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 80 193 pack 0 0;
#X obj 84 223 spigot;
#X msg 103 341 table pos-x 1 \$1 \, table pos-y 1 \$2;
#X msg 606 521 drag \$1;
#X obj 605 501 / 100;
#X floatatom 604 480 5 0 0 0 - - -;
#X obj 667 606 physigs \$0-cloud 16 128;
#X obj 631 146 u_loadmeter;
#X obj 835 154 metro 25;
#X obj 94 447 gemhead;
#X obj 94 512 square 0.1;
#N canvas 128 8 964 624 make_cloud 0;
#N canvas 0 0 450 300 countto 0;
#X obj 99 58 inlet;
#X obj 99 177 f 0;
#X obj 127 177 + 1;
#X msg 142 143 0;
#X obj 99 208 outlet;
#X obj 99 142 until;
#X obj 99 117 t a b;
#X obj 99 96 max;
#X connect 0 0 7 0;
#X connect 1 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 1 1;
#X connect 3 0 1 1;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 6 1 3 0;
#X connect 7 0 6 0;
#X restore 110 109 pd countto;
#X obj 325 232 list-random 1000 2;
#X obj 325 261 list-map;
#X msg 325 200 bang;
#X obj 251 300 list append;
#X obj 38 513 t a;
#X msg 94 17 bang;
#X msg 38 470 auto-link-length;
#X obj 397 258 / 1000;
#X obj 110 133 + 2;
#X msg 70 373 add-link \$1 \$2 0.1 0;
#X obj 38 241 t b b;
#X msg 251 324 table pos-x \$1 \$2 \, table pos-y \$1 \$3 \, table
mobile \$1 1 \, add-link 1 \$1 1 0;
#N canvas 459 257 450 300 all-pairs 0;
#X obj 142 211 take-two;
#X msg 142 163 2 3 4 5 6 7 8 9 10 11 12 13 14 15;
#X obj 296 39 inlet;
#X obj 142 39 inlet;
#X obj 142 238 outlet;
#X msg 296 76 set;
#X obj 142 104 list trim;
#X obj 142 76 list prepend add2;
#X obj 69 40 inlet;
#X obj 69 117 b;
#X connect 0 0 4 0;
#X connect 1 0 0 0;
#X connect 2 0 5 0;
#X connect 3 0 7 0;
#X connect 5 0 1 0;
#X connect 6 0 1 0;
#X connect 7 0 6 0;
#X connect 8 0 9 0;
#X connect 9 0 1 0;
#X restore 70 343 pd all-pairs;
#X obj 110 166 t f f b;
#X obj 38 46 t b b b b;
#X obj 38 541 outlet;
#X obj 38 18 inlet;
#X msg 110 86 14;
#X msg 491 233 reset \, table mobile const 0 \, table mass const 1
\, drag 0.3 \, table pos-x 1 0.5 \, table pos-y 1 0.5 \, xbounds 0
1 \, ybounds 0 1;
#X connect 0 0 9 0;
#X connect 1 0 2 0;
#X connect 2 0 4 1;
#X connect 2 1 8 0;
#X connect 3 0 1 0;
#X connect 4 0 12 0;
#X connect 5 0 16 0;
#X connect 6 0 15 0;
#X connect 7 0 5 0;
#X connect 8 0 2 1;
#X connect 9 0 14 0;
#X connect 10 0 5 0;
#X connect 11 0 7 0;
#X connect 11 1 13 0;
#X connect 12 0 5 0;
#X connect 13 0 10 0;
#X connect 14 0 13 1;
#X connect 14 1 4 0;
#X connect 14 2 1 0;
#X connect 15 0 11 0;
#X connect 15 1 18 0;
#X connect 15 2 13 2;
#X connect 15 3 19 0;
#X connect 17 0 15 0;
#X connect 18 0 0 0;
#X connect 19 0 5 0;
#X restore 748 281 pd make_cloud;
#X msg 748 253 bang;
#X obj 748 303 s \$0-control;
#X msg 359 465 z \$1;
#X obj 400 467 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 322 404 loadbang;
#X msg 322 433 scale 0 1 -4 4;
#X obj 83 81 gemmouse 1 1;
#X obj 125 158 m_scale 0 1 1 0;
#X msg 853 309 bounce \$1;
#X obj 853 287 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X connect 1 0 36 0;
#X connect 2 0 36 1;
#X connect 3 0 36 2;
#X connect 4 0 36 2;
#X connect 5 0 12 0;
#X connect 5 0 38 0;
#X connect 6 0 7 0;
#X connect 6 0 8 0;
#X connect 7 0 6 1;
#X connect 8 0 10 0;
#X connect 8 1 9 0;
#X connect 18 0 40 0;
#X connect 20 0 19 0;
#X connect 21 0 16 0;
#X connect 22 0 23 0;
#X connect 23 0 32 0;
#X connect 23 1 24 0;
#X connect 24 0 23 1;
#X connect 25 0 22 0;
#X connect 26 0 38 1;
#X connect 30 0 31 0;
#X connect 31 0 32 0;
#X connect 32 0 16 0;
#X connect 33 0 16 0;
#X connect 34 0 33 0;
#X connect 35 0 34 0;
#X connect 38 0 6 0;
#X connect 39 0 18 0;
#X connect 41 0 43 0;
#X connect 42 0 41 0;
#X connect 44 0 18 3;
#X connect 45 0 44 0;
#X connect 46 0 47 0;
#X connect 47 0 18 3;
#X connect 48 0 27 0;
#X connect 48 0 30 0;
#X connect 48 1 28 0;
#X connect 48 1 49 0;
#X connect 48 2 29 0;
#X connect 48 2 31 1;
#X connect 49 0 30 1;
#X connect 50 0 43 0;
#X connect 51 0 50 0;


More information about the Pd-list mailing list