From 4246735fbfbf7a9ef9cc25386381a215054ae8b4 Mon Sep 17 00:00:00 2001 From: Frank Barknecht Date: Fri, 29 Apr 2005 19:28:36 +0000 Subject: * Initial import of the msd2d-editor. * Changes compared to previous version available on footils.org: * Link creation now done by selectind two or more masses, then the link-bang will connect each two masses with a link. svn path=/trunk/externals/nusmuk/; revision=2856 --- msd2D/editor/README | 10 + msd2D/editor/butterfly.txt | 52 ++++ msd2D/editor/dancer.txt | 54 ++++ msd2D/editor/gem_links.pd | 38 +++ msd2D/editor/gem_masses.pd | 30 ++ msd2D/editor/gem_strings.pd | 38 +++ msd2D/editor/ilinker.pd | 28 ++ msd2D/editor/link-set.pd | 29 ++ msd2D/editor/link2masses.pd | 25 ++ msd2D/editor/mass-set.pd | 56 ++++ msd2D/editor/msd2d-editor.pd | 634 +++++++++++++++++++++++++++++++++++++++++++ msd2D/editor/msd_append.pd | 74 +++++ msd2D/editor/structures.pd | 27 ++ 13 files changed, 1095 insertions(+) create mode 100644 msd2D/editor/README create mode 100644 msd2D/editor/butterfly.txt create mode 100644 msd2D/editor/dancer.txt create mode 100644 msd2D/editor/gem_links.pd create mode 100644 msd2D/editor/gem_masses.pd create mode 100644 msd2D/editor/gem_strings.pd create mode 100644 msd2D/editor/ilinker.pd create mode 100644 msd2D/editor/link-set.pd create mode 100644 msd2D/editor/link2masses.pd create mode 100644 msd2D/editor/mass-set.pd create mode 100644 msd2D/editor/msd2d-editor.pd create mode 100644 msd2D/editor/msd_append.pd create mode 100644 msd2D/editor/structures.pd (limited to 'msd2D/editor') diff --git a/msd2D/editor/README b/msd2D/editor/README new file mode 100644 index 0000000..12e4ad0 --- /dev/null +++ b/msd2D/editor/README @@ -0,0 +1,10 @@ +msd2d-editor +------------ + +patched by Frank Barknecht with a big hand from Nicolas +Montgermont who wrote the msd2D external required +for using this patch. GEM is used to provide an alternative visualization, but +it is not required for the patch to work. +Thanks Nicolas for a great external colletion. + +msd2d-editor.pd is the patch to open, further documentation is inside. diff --git a/msd2D/editor/butterfly.txt b/msd2D/editor/butterfly.txt new file mode 100644 index 0000000..e235fa3 --- /dev/null +++ b/msd2D/editor/butterfly.txt @@ -0,0 +1,52 @@ +data; +template liaison; +float x1; +float y1; +float x2; +float y2; +float mid1; +float mid2; +float lid; +; +template mass; +float x; +float y; +float mid; +float mob; +; +; +liaison 140 278 94 339 3 11 0; +liaison 95 230 140 278 12 3 0; +liaison 210 267 95 230 2 12 0; +liaison 95 230 211 303 12 6 0; +liaison 94 339 211 303 11 6 0; +liaison 94 339 210 267 11 2 0; +mass 95 230 12 0; +mass 94 339 11 0; +liaison 242 303 140 278 5 3 0; +liaison 140 278 241 268 3 4 0; +liaison 211 303 293 284 6 7 0; +liaison 293 284 210 267 7 2 0; +liaison 293 284 333 348 7 0 0; +liaison 293 284 330 222 7 1 0; +liaison 333 348 242 303 0 5 0; +liaison 241 268 333 348 4 0 0; +liaison 330 222 241 268 1 4 0; +liaison 330 222 242 303 1 5 0; +liaison 221 187 241 268 8 4 0; +liaison 221 187 210 267 8 2 0; +liaison 242 303 241 268 5 4 0; +liaison 210 267 211 303 2 6 0; +liaison 242 303 210 267 5 2 0; +liaison 211 303 242 303 6 5 0; +liaison 241 268 211 303 4 6 0; +liaison 210 267 241 268 2 4 0; +mass 221 187 8 900; +mass 293 284 7 0; +mass 211 303 6 0; +mass 242 303 5 0; +mass 241 268 4 0; +mass 140 278 3 0; +mass 210 267 2 0; +mass 330 222 1 0; +mass 333 348 0 0; diff --git a/msd2D/editor/dancer.txt b/msd2D/editor/dancer.txt new file mode 100644 index 0000000..971ea73 --- /dev/null +++ b/msd2D/editor/dancer.txt @@ -0,0 +1,54 @@ +data; +template liaison; +float x1; +float y1; +float x2; +float y2; +float mid1; +float mid2; +float lid; +; +template mass; +float x; +float y; +float mid; +float mob; +; +; +liaison 160.067 196.866 175.068 187.056 9 6 0; +liaison 122.843 187.056 137.844 196.866 5 12 0; +liaison 164.966 167.633 149 100 11 0 0; +liaison 149 100 133.946 167.633 0 10 1; +mass 149 100 0 900; +liaison 173.155 235.499 184.692 300 4 2 2; +liaison 184.692 300 122.843 187.056 2 5 3; +liaison 113.219 300 124.756 235.499 1 3 4; +liaison 113.219 300 175.068 187.056 1 6 5; +liaison 215.173 220.483 122.843 187.056 8 5 6; +liaison 175.068 187.056 215.173 220.483 6 8 7; +liaison 82.7376 220.483 175.068 187.056 7 6 8; +liaison 122.843 187.056 82.7376 220.483 5 7 9; +liaison 175.068 187.056 122.843 187.056 6 5 10; +liaison 124.756 235.499 173.155 235.499 3 4 11; +liaison 122.843 187.056 124.756 235.499 5 3 12; +liaison 173.155 235.499 122.843 187.056 4 5 13; +liaison 175.068 187.056 173.155 235.499 6 4 14; +liaison 124.756 235.499 175.068 187.056 3 6 15; +liaison 133.946 167.633 164.966 167.633 10 11 16; +liaison 133.946 167.633 137.844 196.866 10 12 17; +liaison 137.844 196.866 160.067 196.866 12 9 18; +liaison 164.966 167.633 137.844 196.866 11 12 19; +liaison 160.067 196.866 164.966 167.633 9 11 20; +liaison 133.946 167.633 160.067 196.866 10 9 21; +mass 113.219 300 1 0; +mass 184.692 300 2 0; +mass 124.756 235.499 3 0; +mass 173.155 235.499 4 0; +mass 122.843 187.056 5 0; +mass 175.068 187.056 6 0; +mass 82.7376 220.483 7 0; +mass 215.173 220.483 8 0; +mass 160.067 196.866 9 0; +mass 133.946 167.633 10 0; +mass 164.966 167.633 11 0; +mass 137.844 196.866 12 0; diff --git a/msd2D/editor/gem_links.pd b/msd2D/editor/gem_links.pd new file mode 100644 index 0000000..bc9dab3 --- /dev/null +++ b/msd2D/editor/gem_links.pd @@ -0,0 +1,38 @@ +#N canvas 0 0 906 731 10; +#X obj 141 31 inlet; +#X obj 125 308 gemhead; +#X obj 109 369 separator; +#X obj 109 337 any; +#X obj 147 166 t b f; +#X obj 229 116 - 250; +#X obj 147 110 - 250; +#X obj 147 140 / 100; +#X obj 229 143 / -100; +#X obj 352 114 - 250; +#X obj 287 116 - 250; +#X obj 287 151 / 100; +#X obj 352 143 / -100; +#X obj 156 432 curve 2; +#X obj 178 210 pack 0 0 0; +#X obj 255 189 pack 0 0 0; +#X obj 141 62 unpack 0 0 0 0 0; +#X connect 0 0 16 0; +#X connect 1 0 3 1; +#X connect 2 0 13 0; +#X connect 3 0 2 0; +#X connect 4 0 3 0; +#X connect 4 1 14 0; +#X connect 5 0 8 0; +#X connect 6 0 7 0; +#X connect 7 0 4 0; +#X connect 8 0 14 1; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 15 0; +#X connect 12 0 15 1; +#X connect 14 0 13 1; +#X connect 15 0 13 2; +#X connect 16 1 6 0; +#X connect 16 2 5 0; +#X connect 16 3 10 0; +#X connect 16 4 9 0; diff --git a/msd2D/editor/gem_masses.pd b/msd2D/editor/gem_masses.pd new file mode 100644 index 0000000..7406e62 --- /dev/null +++ b/msd2D/editor/gem_masses.pd @@ -0,0 +1,30 @@ +#N canvas 308 314 667 612 10; +#X obj 141 31 inlet; +#X obj 150 361 translateXYZ; +#X obj 107 205 gemhead; +#X obj 150 330 separator; +#X obj 150 298 any; +#X obj 180 162 t b f; +#X obj 220 124 - 250; +#X obj 180 107 - 250; +#X obj 180 137 / 100; +#X obj 220 153 / -100; +#X msg 47 325 draw line; +#X obj 48 300 loadbang; +#X obj 141 61 unpack 0 0 0; +#X obj 150 390 circle 0.05; +#X connect 0 0 12 0; +#X connect 1 0 13 0; +#X connect 2 0 4 1; +#X connect 3 0 1 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 5 1 1 1; +#X connect 6 0 9 0; +#X connect 7 0 8 0; +#X connect 8 0 5 0; +#X connect 9 0 1 2; +#X connect 10 0 13 0; +#X connect 11 0 10 0; +#X connect 12 1 7 0; +#X connect 12 2 6 0; diff --git a/msd2D/editor/gem_strings.pd b/msd2D/editor/gem_strings.pd new file mode 100644 index 0000000..bc9dab3 --- /dev/null +++ b/msd2D/editor/gem_strings.pd @@ -0,0 +1,38 @@ +#N canvas 0 0 906 731 10; +#X obj 141 31 inlet; +#X obj 125 308 gemhead; +#X obj 109 369 separator; +#X obj 109 337 any; +#X obj 147 166 t b f; +#X obj 229 116 - 250; +#X obj 147 110 - 250; +#X obj 147 140 / 100; +#X obj 229 143 / -100; +#X obj 352 114 - 250; +#X obj 287 116 - 250; +#X obj 287 151 / 100; +#X obj 352 143 / -100; +#X obj 156 432 curve 2; +#X obj 178 210 pack 0 0 0; +#X obj 255 189 pack 0 0 0; +#X obj 141 62 unpack 0 0 0 0 0; +#X connect 0 0 16 0; +#X connect 1 0 3 1; +#X connect 2 0 13 0; +#X connect 3 0 2 0; +#X connect 4 0 3 0; +#X connect 4 1 14 0; +#X connect 5 0 8 0; +#X connect 6 0 7 0; +#X connect 7 0 4 0; +#X connect 8 0 14 1; +#X connect 9 0 12 0; +#X connect 10 0 11 0; +#X connect 11 0 15 0; +#X connect 12 0 15 1; +#X connect 14 0 13 1; +#X connect 15 0 13 2; +#X connect 16 1 6 0; +#X connect 16 2 5 0; +#X connect 16 3 10 0; +#X connect 16 4 9 0; diff --git a/msd2D/editor/ilinker.pd b/msd2D/editor/ilinker.pd new file mode 100644 index 0000000..610c904 --- /dev/null +++ b/msd2D/editor/ilinker.pd @@ -0,0 +1,28 @@ +#N canvas 114 149 496 493 10; +#X obj 195 306 pointer mass; +#X msg 147 260 vnext 1; +#X msg 274 218 vnext 1; +#X obj 197 167 pointer mass; +#X obj 197 190 t b p; +#X obj 177 418 link2masses; +#X obj 177 387 pack p p; +#X msg 197 135 traverse pd-data \, vnext 1; +#X obj 147 330 t b p; +#X obj 197 106 inlet; +#X text 111 48 This will create all possible links between all selected +masses like iLink.; +#X connect 0 0 8 0; +#X connect 0 1 1 0; +#X connect 0 2 2 0; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 3 1 2 0; +#X connect 4 0 1 0; +#X connect 4 1 6 1; +#X connect 4 1 0 1; +#X connect 6 0 5 0; +#X connect 7 0 3 0; +#X connect 8 0 1 0; +#X connect 8 1 6 0; +#X connect 9 0 7 0; diff --git a/msd2D/editor/link-set.pd b/msd2D/editor/link-set.pd new file mode 100644 index 0000000..ed70f5f --- /dev/null +++ b/msd2D/editor/link-set.pd @@ -0,0 +1,29 @@ +#N canvas 511 393 574 502 10; +#X obj 251 159 pack 0 p; +#X obj 251 187 route \$1; +#X obj 251 100 t p p; +#X obj 90 229 spigot; +#X msg 132 203 1; +#X obj 216 212 t b p; +#X obj 90 257 route \$1; +#X obj 147 227 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 251 73 r mypointer; +#X obj 90 165 r linkspositions; +#X text 81 137 lid \, x1 \, y1 \, x2 \, y2; +#X obj 251 131 get liaison lid; +#X text 261 220 Select pointer with lid matching \$1; +#X obj 90 349 set liaison x1 y1 x2 y2; +#X connect 0 0 1 0; +#X connect 1 0 5 0; +#X connect 2 0 11 0; +#X connect 2 1 0 1; +#X connect 3 0 6 0; +#X connect 4 0 3 1; +#X connect 4 0 7 0; +#X connect 5 0 4 0; +#X connect 5 1 13 4; +#X connect 6 0 13 0; +#X connect 8 0 2 0; +#X connect 9 0 3 0; +#X connect 11 0 0 0; diff --git a/msd2D/editor/link2masses.pd b/msd2D/editor/link2masses.pd new file mode 100644 index 0000000..6fe8b4b --- /dev/null +++ b/msd2D/editor/link2masses.pd @@ -0,0 +1,25 @@ +#N canvas 567 387 568 421 10; +#X obj 42 51 inlet; +#X obj 42 83 t a b; +#X obj 191 213 append liaison mid1 x1 y1; +#X obj 42 249 set liaison mid2 x2 y2; +#X obj 361 190 pointer; +#X msg 361 161 traverse pd-data \, bang; +#X obj 42 118 unpack p p; +#X obj 191 162 get mass mid x y; +#X obj 42 177 get mass mid x y; +#X text 183 56 Link two masses with a link in [pd data]; +#X connect 0 0 1 0; +#X connect 1 0 6 0; +#X connect 1 1 5 0; +#X connect 2 0 3 3; +#X connect 4 0 2 3; +#X connect 5 0 4 0; +#X connect 6 0 8 0; +#X connect 6 1 7 0; +#X connect 7 0 2 0; +#X connect 7 1 2 1; +#X connect 7 2 2 2; +#X connect 8 0 3 0; +#X connect 8 1 3 1; +#X connect 8 2 3 2; diff --git a/msd2D/editor/mass-set.pd b/msd2D/editor/mass-set.pd new file mode 100644 index 0000000..b40c1f6 --- /dev/null +++ b/msd2D/editor/mass-set.pd @@ -0,0 +1,56 @@ +#N canvas 471 153 686 707 10; +#X obj 251 159 pack 0 p; +#X obj 251 187 route \$1; +#X obj 130 347 set mass x y; +#X obj 251 100 t p p; +#X obj 251 131 get mass mid; +#X text 261 220 Select pointer with mid matching \$1; +#X obj 91 229 spigot; +#X msg 133 203 1; +#X obj 216 212 t b p; +#X obj 91 165 r masspositions; +#X text 94 145 mid \, x \, y; +#X obj 91 291 route \$1; +#X obj 148 227 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X obj 251 73 r mypointer; +#X obj 263 348 pointer; +#X obj 263 509 s pointer2msd; +#X obj 263 395 get mass mid x y; +#X msg 263 448 posX \$1 \$2; +#X obj 263 423 pack 0 0 0; +#X msg 275 474 posY \$1 \$3; +#X obj 91 261 t b a; +#X obj 263 320 spigot; +#X msg 305 294 1; +#X obj 320 318 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X obj 263 274 r pollpos; +#X connect 0 0 1 0; +#X connect 1 0 8 0; +#X connect 3 0 4 0; +#X connect 3 1 0 1; +#X connect 4 0 0 0; +#X connect 6 0 20 0; +#X connect 7 0 6 1; +#X connect 7 0 12 0; +#X connect 8 0 7 0; +#X connect 8 0 22 0; +#X connect 8 1 2 2; +#X connect 8 1 14 1; +#X connect 9 0 6 0; +#X connect 11 0 2 0; +#X connect 13 0 3 0; +#X connect 14 0 16 0; +#X connect 16 0 18 0; +#X connect 16 1 18 1; +#X connect 16 2 18 2; +#X connect 17 0 15 0; +#X connect 18 0 17 0; +#X connect 18 0 19 0; +#X connect 19 0 15 0; +#X connect 20 1 11 0; +#X connect 21 0 14 0; +#X connect 22 0 21 1; +#X connect 22 0 23 0; +#X connect 24 0 21 0; diff --git a/msd2D/editor/msd2d-editor.pd b/msd2D/editor/msd2d-editor.pd new file mode 100644 index 0000000..7e060e0 --- /dev/null +++ b/msd2D/editor/msd2d-editor.pd @@ -0,0 +1,634 @@ +#N struct liaison float x1 float y1 float x2 float y2 float mid1 float +mid2 float lid; +#N struct mass float x float y float mid float mob; +#N canvas 0 192 837 493 10; +#N canvas 601 27 617 552 data 1; +#X scalar liaison 160.067 196.866 175.068 187.056 9 6 0 \;; +#X scalar liaison 122.843 187.056 137.844 196.866 5 12 1 \;; +#X scalar liaison 164.966 167.633 149 100 11 0 2 \;; +#X scalar liaison 149 100 133.946 167.633 0 10 3 \;; +#X scalar mass 149 100 0 900 \;; +#X scalar liaison 173.155 235.499 184.692 300 4 2 4 \;; +#X scalar liaison 184.692 300 122.843 187.056 2 5 5 \;; +#X scalar liaison 113.219 300 124.756 235.499 1 3 6 \;; +#X scalar liaison 113.219 300 175.068 187.056 1 6 7 \;; +#X scalar liaison 215.173 220.483 122.843 187.056 8 5 8 \;; +#X scalar liaison 175.068 187.056 215.173 220.483 6 8 9 \;; +#X scalar liaison 82.7376 220.483 175.068 187.056 7 6 10 \;; +#X scalar liaison 122.843 187.056 82.7376 220.483 5 7 11 \;; +#X scalar liaison 175.068 187.056 122.843 187.056 6 5 12 \;; +#X scalar liaison 124.756 235.499 173.155 235.499 3 4 13 \;; +#X scalar liaison 122.843 187.056 124.756 235.499 5 3 14 \;; +#X scalar liaison 173.155 235.499 122.843 187.056 4 5 15 \;; +#X scalar liaison 175.068 187.056 173.155 235.499 6 4 16 \;; +#X scalar liaison 124.756 235.499 175.068 187.056 3 6 17 \;; +#X scalar liaison 133.946 167.633 164.966 167.633 10 11 18 \;; +#X scalar liaison 133.946 167.633 137.844 196.866 10 12 19 \;; +#X scalar liaison 137.844 196.866 160.067 196.866 12 9 20 \;; +#X scalar liaison 164.966 167.633 137.844 196.866 11 12 21 \;; +#X scalar liaison 160.067 196.866 164.966 167.633 9 11 22 \;; +#X scalar liaison 133.946 167.633 160.067 196.866 10 9 23 \;; +#X scalar mass 113.219 300 1 0 \;; +#X scalar mass 184.692 300 2 0 \;; +#X scalar mass 124.756 235.499 3 0 \;; +#X scalar mass 173.155 235.499 4 0 \;; +#X scalar mass 122.843 187.056 5 0 \;; +#X scalar mass 175.068 187.056 6 0 \;; +#X scalar mass 82.7376 220.483 7 0 \;; +#X scalar mass 215.173 220.483 8 0 \;; +#X scalar mass 160.067 196.866 9 0 \;; +#X scalar mass 133.946 167.633 10 0 \;; +#X scalar mass 164.966 167.633 11 0 \;; +#X scalar mass 137.844 196.866 12 0 \;; +#X restore 106 64 pd data; +#X obj 274 105 keyup; +#X obj 274 150 select 108; +#X text 354 151 "L"; +#X obj 274 126 spigot; +#X obj 311 82 tgl 20 0 empty empty add_links_with_L 0 -6 0 8 -24198 +-1 -1 0 1; +#X obj 70 439 structures; +#X msg 54 138 \; pd-data clear; +#X obj 58 214 bng 24 250 50 0 empty \$0-generate generate 0 -6 0 8 +-24198 -1 -1; +#X text 74 417 Data Struct Definitions; +#N canvas 460 399 104 45 save 0; +#X obj 2 3 cnv 15 100 40 empty empty empty 20 12 0 14 -228992 -66577 +0; +#X obj 4 17 bng 20 250 50 0 empty empty load 0 -6 0 8 -258699 -1 -1 +; +#X obj 62 17 bng 20 250 50 0 empty empty save_as 0 -6 0 8 -24198 -1 +-1; +#X obj 101 60 savepanel; +#X obj 50 168 s pd-data; +#X msg 101 115 write \$1; +#X obj 20 91 openpanel; +#X msg 20 115 read \$1; +#X obj 20 138 t b a; +#X obj 20 195 s \$0-generate; +#X obj 33 17 bng 20 250 50 0 empty empty save 0 -6 0 8 -241291 -1 -1 +; +#X obj 100 91 symbol; +#X connect 1 0 6 0; +#X connect 2 0 3 0; +#X connect 3 0 11 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 6 0 11 1; +#X connect 7 0 8 0; +#X connect 8 0 9 0; +#X connect 8 1 4 0; +#X connect 10 0 11 0; +#X connect 11 0 5 0; +#X coords 0 0 1 1 102 44 1; +#X restore 55 88 pd save; +#X text 31 61 Edit here:; +#N canvas 0 0 781 748 generator 0; +#N canvas 210 99 931 555 getter 0; +#X obj 244 89 inlet; +#X obj 244 141 outlet; +#X text 91 57 First build masses \, then links!!; +#X obj 148 281 outlet; +#X obj 547 456 table \$0-mid; +#X obj 531 482 table \$0-msdid; +#N canvas 403 15 685 826 fix-mass-ids 0; +#X obj 139 158 t b b b b b b b; +#X msg 175 254 traverse pd-data \, next; +#X msg 116 316 next; +#X obj 175 284 pointer mass; +#X obj 239 189 s \$0-reset-counter; +#N canvas 331 520 708 349 counter 0; +#X obj 156 125 f 0; +#X msg 172 102 0; +#X obj 172 74 r \$0-reset-counter; +#X obj 188 125 + 1; +#X obj 156 179 outlet; +#X obj 156 50 inlet; +#X connect 0 0 3 0; +#X connect 0 0 4 0; +#X connect 1 0 0 1; +#X connect 2 0 1 0; +#X connect 3 0 0 1; +#X connect 5 0 0 0; +#X restore 192 384 pd counter; +#X obj 192 420 tabread \$0-msdid; +#X obj 192 482 set mass mid; +#X text 272 286 At end: fix links!; +#X obj 282 386 get mass mid; +#X obj 175 333 t b b b b p p; +#X obj 307 461 pack 0 0; +#X obj 307 490 tabwrite \$0-mid2msdid; +#X text 269 520 Store a mapping mid => msdid for fixing links later +; +#X obj 139 116 inlet; +#X obj 254 307 outlet; +#X connect 0 5 1 0; +#X connect 0 6 4 0; +#X connect 1 0 3 0; +#X connect 2 0 3 0; +#X connect 3 0 10 0; +#X connect 3 1 2 0; +#X connect 3 2 15 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X connect 6 0 11 0; +#X connect 9 0 11 1; +#X connect 10 0 2 0; +#X connect 10 1 5 0; +#X connect 10 4 9 0; +#X connect 10 5 7 1; +#X connect 11 0 12 0; +#X connect 14 0 0 0; +#X restore 330 177 pd fix-mass-ids; +#N canvas 403 15 685 826 fix-links 0; +#X obj 139 158 t b b b b b b b; +#X msg 175 254 traverse pd-data \, next; +#X msg 116 316 next; +#X obj 239 189 s \$0-reset-counter; +#X obj 175 284 pointer liaison; +#X text 293 285 At end: make links in msd*!; +#X obj 192 420 tabread \$0-mid2msdid; +#X obj 192 482 set liaison mid1 mid2; +#X obj 343 418 tabread \$0-mid2msdid; +#X obj 192 389 get liaison mid1 mid2; +#X obj 175 333 t b b b b p p; +#X obj 139 128 inlet; +#X obj 275 312 outlet; +#X connect 0 5 1 0; +#X connect 1 0 4 0; +#X connect 2 0 4 0; +#X connect 4 0 10 0; +#X connect 4 1 2 0; +#X connect 4 2 12 0; +#X connect 6 0 7 0; +#X connect 8 0 7 1; +#X connect 9 0 6 0; +#X connect 9 1 8 0; +#X connect 10 0 2 0; +#X connect 10 4 9 0; +#X connect 10 5 7 2; +#X connect 11 0 0 0; +#X restore 330 200 pd fix-links; +#X obj 505 510 table \$0-mid2msdid; +#N canvas 0 0 920 707 get-masses 0; +#X obj 228 162 t b b b b b b b; +#X msg 264 258 traverse pd-data \, next; +#X msg 215 362 next; +#X obj 264 288 pointer mass; +#X obj 347 432 get mass x y mid mob; +#X obj 482 459 select 0; +#X msg 522 484 0; +#X obj 347 514 pack 0 0 0 0; +#X msg 481 483 1; +#X obj 328 193 s \$0-reset-counter; +#N canvas 331 520 708 349 counter 0; +#X obj 156 125 f 0; +#X msg 172 102 0; +#X obj 172 74 r \$0-reset-counter; +#X obj 188 125 + 1; +#X obj 156 179 outlet; +#X obj 156 50 inlet; +#X connect 0 0 3 0; +#X connect 0 0 4 0; +#X connect 1 0 0 1; +#X connect 2 0 1 0; +#X connect 3 0 0 1; +#X connect 5 0 0 0; +#X restore 364 362 pd counter; +#X obj 264 337 t b b b b p p b; +#X obj 364 385 s \$0-current-mass-idx; +#X obj 437 537 s \$0-current-mid; +#X msg 328 213 const 0; +#X obj 328 234 s \$0-mid; +#X obj 390 234 s \$0-msdid; +#X text 575 330 At end: start 2nd pass; +#X obj 228 113 inlet; +#X obj 347 564 outlet; +#X obj 656 566 r \$0-current-mass-idx; +#X obj 605 539 r \$0-current-mid; +#X obj 605 616 tabwrite \$0-mid; +#X obj 605 592 pack 0 0; +#X text 598 515 Write old mids to table; +#X obj 605 640 print mass-as-in-struct; +#X obj 612 368 outlet; +#X connect 0 5 1 0; +#X connect 0 6 9 0; +#X connect 0 6 14 0; +#X connect 1 0 3 0; +#X connect 2 0 3 0; +#X connect 3 0 11 0; +#X connect 3 1 2 0; +#X connect 3 2 26 0; +#X connect 4 0 7 0; +#X connect 4 1 7 1; +#X connect 4 2 7 2; +#X connect 4 2 13 0; +#X connect 4 3 5 0; +#X connect 5 0 8 0; +#X connect 5 1 6 0; +#X connect 6 0 7 3; +#X connect 7 0 19 0; +#X connect 8 0 7 3; +#X connect 10 0 12 0; +#X connect 11 0 2 0; +#X connect 11 5 4 0; +#X connect 11 6 10 0; +#X connect 14 0 15 0; +#X connect 14 0 16 0; +#X connect 18 0 0 0; +#X connect 20 0 23 1; +#X connect 21 0 23 0; +#X connect 23 0 22 0; +#X connect 23 0 25 0; +#X restore 244 115 pd get-masses; +#N canvas 0 0 768 708 make-links 0; +#X obj 156 275 get liaison mid1 mid2; +#X obj 174 318 pack 0 0; +#X obj 156 229 pointer liaison; +#X msg 156 203 next; +#X msg 194 204 traverse pd-data \, bang; +#X obj 126 251 t b p; +#X obj 357 240 print endmasses; +#X obj 194 177 r \$0-make-links; +#X obj 174 351 outlet; +#X obj 191 147 inlet; +#X obj 388 303 outlet; +#X text 440 302 Now set lid field of links.; +#X connect 0 0 1 0; +#X connect 0 1 1 1; +#X connect 1 0 8 0; +#X connect 2 0 5 0; +#X connect 2 1 3 0; +#X connect 2 2 10 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 4 0 6 0; +#X connect 5 0 3 0; +#X connect 5 1 0 0; +#X connect 7 0 4 0; +#X connect 9 0 4 0; +#X restore 148 257 pd make-links; +#N canvas 0 0 590 588 get-ids-from-msd 0; +#X obj 176 209 r \$0-msd-attr; +#X msg 287 189 infosL; +#X obj 176 277 route Mass; +#N canvas 331 520 708 349 counter 0; +#X obj 156 125 f 0; +#X msg 172 102 0; +#X obj 172 74 r \$0-reset-counter; +#X obj 188 125 + 1; +#X obj 156 179 outlet; +#X obj 156 50 inlet; +#X connect 0 0 3 0; +#X connect 0 0 4 0; +#X connect 1 0 0 1; +#X connect 2 0 1 0; +#X connect 3 0 0 1; +#X connect 5 0 0 0; +#X restore 206 324 pd counter; +#X obj 176 301 t a b; +#X obj 287 233 s \$0-msd; +#X obj 176 249 spigot; +#X msg 347 187 1; +#X msg 237 185 0; +#X obj 176 350 pack 0 0; +#X obj 176 374 tabwrite \$0-msdid; +#X obj 176 412 print mass-as-in-msd; +#X msg 176 325 \$1; +#X obj 239 151 t b b b b; +#X obj 239 120 inlet; +#X obj 94 208 outlet; +#X text 71 167 Then fix mass ids; +#X connect 0 0 6 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 9 1; +#X connect 4 0 12 0; +#X connect 4 1 3 0; +#X connect 6 0 2 0; +#X connect 7 0 6 1; +#X connect 8 0 6 1; +#X connect 9 0 10 0; +#X connect 9 0 11 0; +#X connect 12 0 9 0; +#X connect 13 0 15 0; +#X connect 13 1 8 0; +#X connect 13 2 1 0; +#X connect 13 3 7 0; +#X connect 14 0 13 0; +#X restore 330 151 pd get-ids-from-msd; +#X text 569 416 TABLES USED:; +#X text 639 457 ordered mass ids; +#X text 639 481 ordered mass ids as in [msd*]; +#X text 639 510 mass id as index \, msdid as value; +#X text 354 111 First get masses positions \, send to msd2D \, store +in table mid; +#X text 482 152 Then get numercial ids from msd2D \, store in table +msdid; +#X text 484 174 Change DS mass ids to match msdIds \, store mid2msdid +mapping; +#X text 480 200 Fix mid1 and mid2 in links to match what msd2D thinks +is right.; +#X text 257 258 Create messages to msd2D to create links; +#N canvas 209 87 622 579 set-lid 0; +#X obj 162 163 r \$0-msd-attr; +#X obj 288 201 s \$0-msd; +#X obj 162 203 spigot; +#X msg 292 129 1; +#X msg 236 127 0; +#X obj 238 62 inlet; +#X obj 238 93 t b b b b b; +#X obj 310 307 pointer liaison; +#X msg 310 281 traverse pd-data \, next; +#X msg 288 163 infosL; +#X obj 162 231 route Link; +#X obj 175 352 set liaison lid mid1 mid2; +#X msg 175 327 \$1 \$3 \$4; +#X msg 272 307 next; +#X obj 145 254 t b a; +#X text 105 394 This will move around the links \, but it's not critical +as long as we have the same number of graphical links as we have inside +the msd2D object. And we'd better damn sure should have the same amount +\, otherwise somethings went really \, really wrong and took a bad +turn and crashed the car and left the toilet seat open.; +#X text 104 481 Shouldn't happen.; +#X connect 0 0 2 0; +#X connect 2 0 10 0; +#X connect 3 0 2 1; +#X connect 4 0 2 1; +#X connect 5 0 6 0; +#X connect 6 1 4 0; +#X connect 6 2 9 0; +#X connect 6 3 3 0; +#X connect 6 4 8 0; +#X connect 7 0 11 3; +#X connect 7 1 13 0; +#X connect 8 0 7 0; +#X connect 9 0 1 0; +#X connect 10 0 14 0; +#X connect 12 0 11 0; +#X connect 13 0 7 0; +#X connect 14 0 13 0; +#X connect 14 1 12 0; +#X restore 234 286 pd set-lid; +#X text 314 284 Correct lids to match what msd2D tells us; +#X connect 0 0 9 0; +#X connect 6 0 7 0; +#X connect 7 0 10 0; +#X connect 9 0 1 0; +#X connect 9 1 11 0; +#X connect 10 0 3 0; +#X connect 10 1 21 0; +#X connect 11 0 6 0; +#X restore 131 221 pd getter; +#X obj 131 369 s \$0-msd; +#X msg 175 154 reset; +#X obj 175 200 s \$0-msd; +#X msg 175 175 Xmin 0 \, Xmax 800 \, Ymin 0 \, Ymax 800; +#X msg 239 300 mass fix 0 100 \$1 \$2; +#X msg 189 275 mass id \$4 100 \$1 \$2; +#X obj 112 132 t b b b b; +#N canvas 376 279 682 601 make-setters 0; +#X obj 236 443 s pd-setter; +#X msg 206 213 traverse pd-data \, next; +#X obj 168 109 t b b b b; +#X obj 236 329 get mass x y mid; +#X msg 236 396 obj \$1 \$2 mass-set \$3; +#X obj 236 352 pack 0 0 0; +#X msg 151 239 next; +#X obj 145 327 s mypointer; +#X obj 206 272 t p p; +#X msg 226 135 clear; +#X obj 226 160 s pd-setter; +#X obj 168 68 inlet; +#X obj 206 240 pointer mass liaison; +#X obj 480 365 pack 0 0 0; +#X obj 389 340 s mypointer; +#X obj 450 285 t p p; +#X obj 480 342 get liaison x1 y1 lid; +#X msg 480 409 obj \$1 \$2 link-set \$3; +#X obj 480 454 s pd-lsetter; +#X obj 226 186 s pd-lsetter; +#X connect 1 0 12 0; +#X connect 2 2 1 0; +#X connect 2 3 9 0; +#X connect 3 0 5 0; +#X connect 3 1 5 1; +#X connect 3 2 5 2; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 6 0 12 0; +#X connect 8 0 7 0; +#X connect 8 1 3 0; +#X connect 9 0 10 0; +#X connect 9 0 19 0; +#X connect 11 0 2 0; +#X connect 12 0 6 0; +#X connect 12 0 8 0; +#X connect 12 1 6 0; +#X connect 12 1 15 0; +#X connect 12 2 6 0; +#X connect 13 0 17 0; +#X connect 15 0 14 0; +#X connect 15 1 16 0; +#X connect 16 0 13 0; +#X connect 16 1 13 1; +#X connect 16 2 13 2; +#X connect 17 0 18 0; +#X restore 112 401 pd make-setters; +#X obj 201 354 r pointer2msd; +#X obj 112 91 inlet; +#X msg 131 326 link ml \$1 \$2 10 2.5 1.5; +#X connect 0 0 11 0; +#X connect 0 1 6 0; +#X connect 2 0 3 0; +#X connect 4 0 3 0; +#X connect 6 0 1 0; +#X connect 7 0 8 0; +#X connect 7 1 0 0; +#X connect 7 2 4 0; +#X connect 7 3 2 0; +#X connect 9 0 1 0; +#X connect 10 0 7 0; +#X connect 11 0 1 0; +#X restore 58 245 pd generator; +#N canvas 0 0 718 819 activate 0; +#X obj 233 284 msd2D; +#X obj 233 215 r \$0-msd; +#X msg 317 213 infosL; +#X obj 263 325 print msd-attr; +#X msg 300 256 get linksPos; +#X obj 233 449 gem_masses; +#X obj 313 445 gem_links; +#X msg 167 193 bang \, get massesPos \, get linksPos; +#X obj 177 125 gemhead; +#X obj 233 396 route massesPos linksPos; +#X obj 139 498 gemwin; +#X msg 139 447 create \, 1; +#X msg 139 471 0 \, destroy; +#X msg 315 233 forceX id 200; +#X obj 249 354 s \$0-msd-out; +#X obj 139 425 select 1 0; +#X obj 139 397 tgl 24 0 empty empty GEM 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 279 301 s \$0-msd-attr; +#X obj 233 510 s masspositions; +#X obj 313 488 s linkspositions; +#X obj 167 69 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 233 421 spigot; +#X obj 313 421 spigot; +#X text 238 532 sent to the data struct pointers; +#X obj 167 149 t b b; +#X obj 197 172 s pollpos; +#X obj 167 44 inlet data_only; +#X obj 81 316 inlet GEM; +#X obj 341 40 inlet speed; +#X obj 62 378 select 1; +#X msg 62 403 0; +#X obj 80 340 t f f; +#X obj 54 90 select 1; +#X msg 54 115 0; +#X obj 72 52 t f f; +#X msg 225 622 set \$1; +#X msg 56 467 set \$1; +#X obj 231 648 outlet; +#X obj 57 493 outlet; +#X obj 167 92 metro 20; +#X connect 0 0 9 0; +#X connect 0 0 14 0; +#X connect 0 1 17 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 4 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 24 0; +#X connect 9 0 18 0; +#X connect 9 0 21 0; +#X connect 9 1 19 0; +#X connect 9 1 22 0; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 0 0; +#X connect 15 0 11 0; +#X connect 15 1 12 0; +#X connect 16 0 15 0; +#X connect 16 0 21 1; +#X connect 16 0 22 1; +#X connect 16 0 36 0; +#X connect 20 0 35 0; +#X connect 20 0 39 0; +#X connect 21 0 5 0; +#X connect 22 0 6 0; +#X connect 24 0 7 0; +#X connect 24 1 25 0; +#X connect 26 0 34 0; +#X connect 27 0 31 0; +#X connect 28 0 39 1; +#X connect 29 0 30 0; +#X connect 30 0 20 0; +#X connect 31 0 16 0; +#X connect 31 1 29 0; +#X connect 32 0 33 0; +#X connect 33 0 16 0; +#X connect 34 0 20 0; +#X connect 34 1 32 0; +#X connect 35 0 37 0; +#X connect 36 0 38 0; +#X connect 39 0 24 0; +#X restore 59 330 pd activate; +#X obj 59 294 tgl 24 0 empty empty GEM 0 -6 0 8 -233017 -1 -1 0 1; +#X obj 95 294 tgl 24 0 empty empty Graphical_Datastructures 0 -6 0 +8 -1 -262144 -1 0 1; +#X text 426 173 "L" is only active \, if the green toggle is set to +on. Otherwise use the yellow "link" bang.; +#X text 261 222 Press "generate" to generate messages to msd2D and +create the physical model inside.; +#N canvas 0 0 751 433 ignore 0; +#X obj 102 264 print ToMSD; +#X obj 102 234 spigot; +#X obj 139 181 tgl 15 0 empty empty debug 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 102 207 r \$0-msd; +#X obj 281 239 spigot; +#X obj 318 186 tgl 15 0 empty empty debug 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 281 267 print FromMSD; +#X obj 281 212 r \$0-msd-out; +#N canvas 0 0 578 686 setter 0; +#X obj 137 196 mass-set 12; +#X obj 164 167 mass-set 11; +#X obj 133 167 mass-set 10; +#X obj 160 196 mass-set 9; +#X obj 215 220 mass-set 8; +#X obj 82 220 mass-set 7; +#X obj 175 187 mass-set 6; +#X obj 122 187 mass-set 5; +#X obj 173 235 mass-set 4; +#X obj 124 235 mass-set 3; +#X obj 184 300 mass-set 2; +#X obj 113 300 mass-set 1; +#X obj 149 100 mass-set 0; +#X restore 305 122 pd setter; +#N canvas 0 0 822 675 lsetter 0; +#X obj 133 167 link-set 23; +#X obj 160 196 link-set 22; +#X obj 164 167 link-set 21; +#X obj 137 196 link-set 20; +#X obj 133 167 link-set 19; +#X obj 133 167 link-set 18; +#X obj 124 235 link-set 17; +#X obj 175 187 link-set 16; +#X obj 173 235 link-set 15; +#X obj 122 187 link-set 14; +#X obj 124 235 link-set 13; +#X obj 175 187 link-set 12; +#X obj 122 187 link-set 11; +#X obj 82 220 link-set 10; +#X obj 175 187 link-set 9; +#X obj 215 220 link-set 8; +#X obj 113 300 link-set 7; +#X obj 113 300 link-set 6; +#X obj 184 300 link-set 5; +#X obj 173 235 link-set 4; +#X obj 149 100 link-set 3; +#X obj 164 167 link-set 2; +#X obj 122 187 link-set 1; +#X obj 160 196 link-set 0; +#X restore 304 145 pd lsetter; +#X text 288 98 Automatic scripting targets; +#X text 65 66 You can ignore this stuff here \, unless something goes +wrong.; +#X connect 1 0 0 0; +#X connect 2 0 1 1; +#X connect 3 0 1 0; +#X connect 4 0 6 0; +#X connect 5 0 4 1; +#X connect 7 0 4 0; +#X restore 163 439 pd ignore this; +#X floatatom 131 301 5 20 1000 1 frequency - -; +#X text 258 280 Visualization is done using either a GEM OpenGL window +\, or just animate the data structure alone. Better don't use both +at the same time. In GDS-mode you can set the frequency of the internal +metro \, to accelerate or slow down the simulation.; +#X text 429 53 First create structure inside [pd data] using msd_append. +Add mobile masses with black bang \, add fixed masses with the red +bang.; +#X obj 166 88 msd_append; +#X text 259 361 In edit mode and while visualization is active \, you +can move around the masses. The red masses will not receive any other +forces from the model.; +#X text 429 102 Links are created by selecting at least two masses +in edit mode \, then press "L" to connect those with a link. If you +select more than two masses \, then all possible links between those +masses will get created. Use this to mass-connect masses. :); +#X connect 1 0 4 0; +#X connect 2 0 22 2; +#X connect 4 0 2 0; +#X connect 5 0 4 1; +#X connect 8 0 12 0; +#X connect 13 0 14 0; +#X connect 13 1 15 0; +#X connect 14 0 13 0; +#X connect 15 0 13 1; +#X connect 19 0 13 2; diff --git a/msd2D/editor/msd_append.pd b/msd2D/editor/msd_append.pd new file mode 100644 index 0000000..615249b --- /dev/null +++ b/msd2D/editor/msd_append.pd @@ -0,0 +1,74 @@ +#N canvas 862 152 100 78 10; +#X obj 1 16 cnv 15 100 60 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 8 29 bng 15 250 50 0 empty empty mass 0 -6 0 8 -1 -262144 -1 +; +#X obj 39 29 bng 15 250 50 0 empty empty fix 0 -6 0 8 -258699 -1 -1 +; +#X obj 69 29 bng 15 250 50 0 empty empty link 0 -6 0 8 -241291 -1 -1 +; +#N canvas 355 457 863 719 guts 0; +#X obj 252 139 pointer; +#X obj 66 179 random 100; +#X msg 252 102 traverse pd-data \, bang; +#X obj 105 126 random 100; +#X obj 70 24 inlet; +#X obj 177 24 inlet; +#X obj 485 53 inlet; +#X obj 385 351 + 1; +#X obj 355 291 r \$0-counter-bng; +#X obj 355 393 s \$0-nextmass; +#X obj 144 200 r \$0-nextmass; +#X obj 70 97 s \$0-counter-bng; +#X obj 66 231 append mass x y mid mob; +#X obj 70 71 t b b b b b f b; +#X msg 70 47 0; +#X text 111 24 mobile; +#X text 223 24 fixed mass; +#X msg 177 46 900; +#X obj 355 351 f 0; +#X obj 391 316 loadbang; +#X obj 255 294 r \$0-counter; +#X msg 296 384 set \$1; +#X obj 296 425 s \$0-counter-in; +#X obj 66 203 + 20; +#X obj 105 148 + 20; +#X obj 485 83 ilinker; +#X connect 0 0 12 4; +#X connect 1 0 23 0; +#X connect 2 0 0 0; +#X connect 3 0 24 0; +#X connect 4 0 14 0; +#X connect 5 0 17 0; +#X connect 6 0 25 0; +#X connect 7 0 18 1; +#X connect 8 0 18 0; +#X connect 10 0 12 2; +#X connect 13 0 11 0; +#X connect 13 1 1 0; +#X connect 13 3 3 0; +#X connect 13 5 12 3; +#X connect 13 6 2 0; +#X connect 14 0 13 0; +#X connect 17 0 13 0; +#X connect 18 0 7 0; +#X connect 18 0 9 0; +#X connect 18 0 21 0; +#X connect 19 0 18 0; +#X connect 20 0 18 0; +#X connect 21 0 22 0; +#X connect 23 0 12 0; +#X connect 24 0 12 1; +#X restore 154 42 pd guts; +#X obj 125 6 inlet; +#X obj 168 5 inlet; +#X obj 213 6 inlet; +#X obj 23 59 nbx 5 14 -1e+37 1e+37 0 0 \$0-counter \$0-counter-in next +0 -6 0 10 -262144 -1 -1 3 256; +#X connect 1 0 4 0; +#X connect 2 0 4 1; +#X connect 3 0 4 2; +#X connect 5 0 4 0; +#X connect 6 0 4 1; +#X connect 7 0 4 2; +#X coords 0 0 1 1 102 80 1; diff --git a/msd2D/editor/structures.pd b/msd2D/editor/structures.pd new file mode 100644 index 0000000..434a0ee --- /dev/null +++ b/msd2D/editor/structures.pd @@ -0,0 +1,27 @@ +#N canvas 752 10 450 300 10; +#N canvas 389 332 664 321 mass 0; +#X obj 62 182 drawnumber mid 0 -18 0 m; +#X obj 64 72 struct mass float x float y float mid float mob; +#X obj 61 136 filledpolygon mob mob 1 -5 0 -4 4 0 5 4 4 5 0 4 -4 0 +-5 -4 -4; +#X restore 132 125 pd mass; +#N canvas 73 302 487 201 liaison 0; +#X obj 19 25 struct liaison float x1 float y1 float x2 float y2 float +mid1 float mid2 float lid; +#X obj 23 73 drawpolygon 444 2 x1 y1 x2 y2; +#X restore 132 169 pd liaison; +#N canvas 0 0 450 300 model 0; +#X obj 50 102 plot m 0 0 0 0; +#X obj 51 135 plot l 0 0 0 0; +#X obj 45 72 struct model float x1 array m mass array l liaison; +#X restore 132 147 pd model; +#N canvas 389 332 664 321 fixmass 0; +#X obj 64 72 struct fixmass float x float y float mid; +#X obj 61 136 filledpolygon 900 900 1 -5 0 -4 4 0 5 4 4 5 0 4 -4 0 +-5 -4 -4; +#X obj 51 203 drawnumber mid 0 -18 900 m; +#X restore 132 191 pd fixmass; +#N canvas 0 0 450 300 fixed 0; +#X obj 50 97 plot f 0 0 0 0; +#X obj 49 56 struct fixed float x float y array f fixmass; +#X restore 132 213 pd fixed; -- cgit v1.2.1