From c9684a4f81640fc854b299c86f209554409bde80 Mon Sep 17 00:00:00 2001 From: Frank Barknecht Date: Mon, 2 May 2005 10:36:10 +0000 Subject: Link and Mass structures now carry info about physical parameters, this is settable on creation of links. svn path=/trunk/externals/nusmuk/; revision=2872 --- msd2D/editor/msd2d-editor.pd | 210 ++++++++++++++++++++++--------------------- 1 file changed, 107 insertions(+), 103 deletions(-) (limited to 'msd2D/editor/msd2d-editor.pd') diff --git a/msd2D/editor/msd2d-editor.pd b/msd2D/editor/msd2d-editor.pd index 74d742a..6566249 100644 --- a/msd2D/editor/msd2d-editor.pd +++ b/msd2D/editor/msd2d-editor.pd @@ -1,29 +1,9 @@ -#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 130 52 866 562 10; #N canvas 610 84 617 552 data 1; -#X scalar liaison 473.44 182.541 548 179 7 8 0 \;; -#X scalar liaison 391.87 183.337 473.44 182.541 6 7 1 \;; -#X scalar liaison 313.233 178.369 391.87 183.337 5 6 2 \;; -#X scalar liaison 260.779 172.377 313.233 178.369 4 5 3 \;; -#X scalar liaison 196.229 164.351 260.779 172.377 3 4 4 \;; -#X scalar liaison 137.18 159.608 196.229 164.351 2 3 5 \;; -#X scalar liaison 79.9374 158.402 137.18 159.608 1 2 6 \;; -#X scalar liaison 36 159 79.9374 158.402 0 1 7 \;; -#X scalar mass 36 159 0 900 \;; -#X scalar mass 79.9374 158.402 1 0 \;; -#X scalar mass 137.18 159.608 2 0 \;; -#X scalar mass 196.229 164.351 3 0 \;; -#X scalar mass 260.779 172.377 4 0 \;; -#X scalar mass 313.233 178.369 5 0 \;; -#X scalar mass 391.87 183.337 6 0 \;; -#X scalar mass 473.44 182.541 7 0 \;; -#X scalar mass 548 179 8 900 \;; #X restore 735 71 pd data; #X obj 56 517 structures; #X msg 152 72 \; pd-data clear; -#X obj 60 298 bng 24 250 50 0 empty \$0-generate generate 0 -6 0 8 +#X obj 62 308 bng 24 250 50 0 empty \$0-generate generate 0 -6 0 8 -24198 -1 -1; #X text 57 493 Data Struct Definitions; #N canvas 460 399 104 45 save 0; @@ -57,7 +37,7 @@ mid2 float lid; #X coords 0 0 1 1 102 44 1; #X restore 723 150 pd save; #X text 728 46 Edit here:; -#N canvas 564 255 781 748 generator 0; +#N canvas 257 131 781 748 generator 0; #N canvas 210 99 931 555 getter 0; #X obj 244 89 inlet; #X obj 244 141 outlet; @@ -146,11 +126,9 @@ mid2 float lid; #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 458 455 select 0; +#X msg 498 480 0; +#X msg 457 479 1; #X obj 328 193 s \$0-reset-counter; #N canvas 331 520 708 349 counter 0; #X obj 156 125 f 0; @@ -182,39 +160,40 @@ mid2 float lid; #X text 598 515 Write old mids to table; #X obj 605 640 print mass-as-in-struct; #X obj 612 368 outlet; +#X obj 347 432 get mass x y mid mob M; +#X obj 347 514 pack 0 0 0 0 0; #X connect 0 5 1 0; -#X connect 0 6 9 0; -#X connect 0 6 14 0; +#X connect 0 6 7 0; +#X connect 0 6 12 0; #X connect 1 0 3 0; #X connect 2 0 3 0; -#X connect 3 0 11 0; +#X connect 3 0 9 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 3 2 24 0; +#X connect 4 0 6 0; +#X connect 4 1 5 0; +#X connect 5 0 26 3; +#X connect 6 0 26 3; +#X connect 8 0 10 0; +#X connect 9 0 2 0; +#X connect 9 5 25 0; +#X connect 9 6 8 0; +#X connect 12 0 13 0; +#X connect 12 0 14 0; +#X connect 16 0 0 0; +#X connect 18 0 21 1; +#X connect 19 0 21 0; +#X connect 21 0 20 0; #X connect 21 0 23 0; -#X connect 23 0 22 0; -#X connect 23 0 25 0; +#X connect 25 0 26 0; +#X connect 25 1 26 1; +#X connect 25 2 11 0; +#X connect 25 2 26 2; +#X connect 25 3 4 0; +#X connect 25 4 26 4; +#X connect 26 0 17 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; @@ -223,17 +202,22 @@ mid2 float lid; #X obj 194 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 6 0; -#X connect 2 0 5 0; -#X connect 2 1 3 0; -#X connect 2 2 8 0; -#X connect 3 0 2 0; -#X connect 4 0 2 0; -#X connect 5 0 3 0; -#X connect 5 1 0 0; -#X connect 7 0 4 0; +#X obj 156 275 get liaison mid1 mid2 K D D2; +#X obj 174 318 pack 0 0 0 0 0; +#X connect 0 0 3 0; +#X connect 0 1 1 0; +#X connect 0 2 6 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 1 0; +#X connect 3 1 8 0; +#X connect 5 0 2 0; +#X connect 8 0 9 0; +#X connect 8 1 9 1; +#X connect 8 2 9 2; +#X connect 8 3 9 3; +#X connect 8 4 9 4; +#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; @@ -309,8 +293,6 @@ is right.; #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 @@ -319,6 +301,8 @@ 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 msg 175 332 \$1 \$3 \$4 \$5 \$6 \$7; +#X obj 175 357 set liaison lid mid1 mid2 K D D2; #X connect 0 0 2 0; #X connect 2 0 10 0; #X connect 3 0 2 1; @@ -328,15 +312,15 @@ turn and crashed the car and left the toilet seat open.; #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 7 0 16 6; +#X connect 7 1 11 0; #X connect 8 0 7 0; #X connect 9 0 1 0; -#X connect 10 0 14 0; +#X connect 10 0 12 0; +#X connect 11 0 7 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 connect 12 1 15 0; +#X connect 15 0 16 0; #X restore 234 286 pd set-lid; #X text 314 284 Correct lids to match what msd2D tells us; #X obj 475 458 table \$0-mid 4000; @@ -355,7 +339,7 @@ turn and crashed the car and left the toilet seat open.; #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 368 473 mass fix 0 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; @@ -405,12 +389,12 @@ turn and crashed the car and left the toilet seat open.; #X connect 15 2 13 2; #X connect 16 0 17 0; #X restore 112 401 pd make-setters; -#X obj 201 354 r pointer2msd; +#X obj 181 344 r pointer2msd; #X obj 112 91 inlet; -#X msg 189 275 mass id \$4 100 \$1 \$2; -#X msg 131 324 link ml \$1 \$2 10 2.5 1.5; -#X connect 0 0 11 0; -#X connect 0 1 10 0; +#X msg 131 324 link ml \$1 \$2 \$3 \$4 \$5; +#X msg 189 275 mass id \$4 \$5 \$1 \$2; +#X connect 0 0 10 0; +#X connect 0 1 11 0; #X connect 2 0 3 0; #X connect 4 0 3 0; #X connect 6 0 7 0; @@ -421,7 +405,7 @@ turn and crashed the car and left the toilet seat open.; #X connect 9 0 6 0; #X connect 10 0 1 0; #X connect 11 0 1 0; -#X restore 60 329 pd generator; +#X restore 62 337 pd generator; #N canvas 0 0 718 819 activate 0; #X obj 233 284 msd2D; #X obj 233 215 r \$0-msd; @@ -443,7 +427,7 @@ turn and crashed the car and left the toilet seat open.; #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 1 1 +#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; @@ -512,7 +496,7 @@ turn and crashed the car and left the toilet seat open.; #X restore 61 414 pd activate; #X obj 61 378 tgl 24 0 empty empty GEM 0 -6 0 8 -233017 -1 -1 0 1; #X obj 97 378 tgl 24 0 empty empty Graphical_Datastructures 0 -6 0 -8 -1 -262144 -1 1 1; +8 -1 -262144 -1 0 1; #X text 275 306 Press "generate" to generate messages to msd2D and create the physical model inside.; #N canvas 0 0 751 433 ignore 0; @@ -527,25 +511,45 @@ create the physical model inside.; #X obj 281 267 print FromMSD; #X obj 281 212 r \$0-msd-out; #N canvas 0 0 578 686 setter 0; -#X obj 452 168 mass-set 8; -#X obj 393 207 mass-set 7; -#X obj 317 227 mass-set 6; -#X obj 290 156 mass-set 5; -#X obj 243 172 mass-set 4; -#X obj 185 152 mass-set 3; -#X obj 129 151 mass-set 2; -#X obj 76 155 mass-set 1; -#X obj 36 159 mass-set 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 36 159 link-set 7; -#X obj 76 155 link-set 6; -#X obj 129 151 link-set 5; -#X obj 185 152 link-set 4; -#X obj 243 172 link-set 3; -#X obj 290 156 link-set 2; -#X obj 317 227 link-set 1; -#X obj 393 207 link-set 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 @@ -573,10 +577,6 @@ wrong.; \, 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 274 23 First create structure inside [pd data] using msd_append. -Add mobile masses with black bang \, add fixed masses with the red -bang.; -#X obj 57 24 msd_append; #X text 273 110 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 @@ -639,7 +639,6 @@ masses will get created. Use this to mass-connect masses. :); can move around the masses. The red masses will not receive any other forces from the model. Use the "forces" and "props" subpatches to change parameters of links and send forces.; -#X obj 56 114 morelinks; #X text 271 219 More ways to create links: left-to-right connects masses from left to right. one2many will connect one mass to many others. First select the first mass \, the set the toggle to 1 \, after that @@ -648,6 +647,11 @@ select the other masses and set toggle to 0; #X text 270 181 "L" is only active \, if the green toggle "Key:L" is set to on. Otherwise use the yellow "link" bang.; #X text 705 123 Save network to disk:; +#X obj 56 114 morelinks; +#X obj 57 8 msd_append; +#X text 274 23 First create structure inside [pd data] using msd_append. +Add mobile masses with black bang \, add fixed masses with the red +bang. Set weight of mass with the "M" number box.; #X connect 3 0 7 0; #X connect 8 0 9 0; #X connect 8 1 10 0; -- cgit v1.2.1