aboutsummaryrefslogtreecommitdiff
path: root/msd3D
diff options
context:
space:
mode:
authorN.N. <nimon@users.sourceforge.net>2005-04-21 14:28:54 +0000
committerN.N. <nimon@users.sourceforge.net>2005-04-21 14:28:54 +0000
commit81d760d4bc6e1284f9bb874dcec75071b8c96b89 (patch)
tree007cbf46601ebce5265e9ee08028c68566a57a5b /msd3D
parent3251c3f5f98bd5ee4fcbd7a5146412d858efc215 (diff)
MSD Version 0.03
svn path=/trunk/externals/nusmuk/; revision=2799
Diffstat (limited to 'msd3D')
-rw-r--r--msd3D/05_msd3Dvline.pd261
-rw-r--r--msd3D/curve16.pd133
-rw-r--r--msd3D/curve2.pd120
-rw-r--r--msd3D/help-msd3D.pd132
-rwxr-xr-xmsd3D/main.cpp257
-rw-r--r--msd3D/partiel.pd18
6 files changed, 519 insertions, 402 deletions
diff --git a/msd3D/05_msd3Dvline.pd b/msd3D/05_msd3Dvline.pd
index d11b21b..97f038d 100644
--- a/msd3D/05_msd3Dvline.pd
+++ b/msd3D/05_msd3Dvline.pd
@@ -1,10 +1,10 @@
-#N canvas 422 196 796 654 10;
+#N canvas 499 155 796 654 10;
#X obj 32 13 loadbang;
#X obj 294 522 print msd;
#X obj 457 430 gemwin;
#X msg 457 408 0 \, destroy;
#X obj 288 577 gemhead;
-#X obj 288 600 world_light;
+#X obj 288 599 world_light;
#X obj 146 205 t a;
#X obj 146 16 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262131 -1
-1;
@@ -15,7 +15,7 @@
#X text 156 412 Ambient force;
#X obj 146 42 t b b b b;
#X msg 296 393 forceZ filet \$1;
-#X obj 444 207 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 1
+#X obj 444 207 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 0
1;
#X obj 444 258 f;
#X obj 444 234 metro 65;
@@ -24,11 +24,11 @@
#X msg 457 327 reset \, dimen 800 800 \, create \, lighting 1 \, 1
;
#X obj 421 221 vsl 15 128 -1 1 0 0 empty empty empty 0 -8 0 8 -262131
--1 -1 9300 1;
+-1 -1 0 1;
#X obj 206 315 sin;
#X obj 206 335 *;
#X obj 206 255 counter 0 360;
-#X obj 206 204 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 1
+#X obj 206 204 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 0
1;
#X obj 206 275 / 3.6;
#X obj 206 295 * 6.28319;
@@ -70,9 +70,12 @@
#X obj 267 99 t b;
#X msg 302 166 0.02 5;
#X msg 178 72 \$2;
-#X obj 178 117 moses 0.0085;
+#X floatatom 257 48 10 0 0 0 - - -;
+#X msg 257 19 \$3;
+#X obj 178 117 moses 0.15;
#X connect 0 0 10 0;
-#X connect 2 0 11 0;
+#X connect 0 0 12 0;
+#X connect 2 0 13 0;
#X connect 3 0 4 1;
#X connect 4 0 1 0;
#X connect 5 0 7 0;
@@ -81,8 +84,9 @@
#X connect 8 0 9 0;
#X connect 9 0 3 0;
#X connect 10 0 2 0;
-#X connect 11 0 5 0;
-#X connect 11 1 8 0;
+#X connect 12 0 11 0;
+#X connect 13 0 5 0;
+#X connect 13 1 8 0;
#X restore 375 627 pd drone;
#X obj 232 154 t f f;
#X msg 143 113 reset;
@@ -143,6 +147,9 @@
#X obj 521 497 hip~ 20;
#X obj 401 501 hip~ 20;
#X obj 443 563 dac~;
+#X obj 232 132 counter 0 29;
+#X obj 235 254 route 0 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;
#X obj 288 385 partiel;
#X obj 250 339 partiel;
#X obj 269 362 partiel;
@@ -162,9 +169,6 @@
#X obj 554 338 partiel;
#X obj 573 361 partiel;
#X obj 592 384 partiel;
-#X obj 232 132 counter 0 29;
-#X obj 235 254 route 0 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;
#X obj 593 314 partiel;
#X obj 612 337 partiel;
#X obj 631 360 partiel;
@@ -179,23 +183,52 @@
#X connect 1 0 9 0;
#X connect 1 1 2 2;
#X connect 1 2 2 3;
-#X connect 2 0 34 0;
+#X connect 2 0 15 0;
#X connect 3 0 11 0;
#X connect 4 0 12 0;
#X connect 4 0 11 0;
#X connect 5 0 2 0;
-#X connect 6 0 33 0;
+#X connect 6 0 14 0;
#X connect 7 0 6 0;
#X connect 8 0 6 0;
-#X connect 9 0 33 0;
+#X connect 9 0 14 0;
#X connect 9 1 2 1;
#X connect 11 0 13 1;
#X connect 12 0 13 0;
-#X connect 14 0 12 0;
-#X connect 15 0 12 0;
-#X connect 16 0 11 0;
-#X connect 17 0 11 0;
-#X connect 18 0 12 0;
+#X connect 14 0 5 0;
+#X connect 15 0 3 0;
+#X connect 15 1 17 0;
+#X connect 15 2 18 0;
+#X connect 15 3 16 0;
+#X connect 15 4 19 0;
+#X connect 15 5 20 0;
+#X connect 15 6 21 0;
+#X connect 15 7 22 0;
+#X connect 15 8 23 0;
+#X connect 15 9 24 0;
+#X connect 15 10 25 0;
+#X connect 15 11 26 0;
+#X connect 15 12 27 0;
+#X connect 15 13 28 0;
+#X connect 15 14 29 0;
+#X connect 15 15 30 0;
+#X connect 15 16 31 0;
+#X connect 15 17 32 0;
+#X connect 15 18 33 0;
+#X connect 15 19 34 0;
+#X connect 15 20 35 0;
+#X connect 15 21 36 0;
+#X connect 15 22 37 0;
+#X connect 15 23 38 0;
+#X connect 15 24 39 0;
+#X connect 15 25 40 0;
+#X connect 15 26 41 0;
+#X connect 15 27 42 0;
+#X connect 15 28 43 0;
+#X connect 15 29 44 0;
+#X connect 16 0 12 0;
+#X connect 17 0 12 0;
+#X connect 18 0 11 0;
#X connect 19 0 11 0;
#X connect 20 0 12 0;
#X connect 21 0 11 0;
@@ -210,38 +243,8 @@
#X connect 30 0 12 0;
#X connect 31 0 11 0;
#X connect 32 0 12 0;
-#X connect 33 0 5 0;
-#X connect 34 0 3 0;
-#X connect 34 1 15 0;
-#X connect 34 2 16 0;
-#X connect 34 3 14 0;
-#X connect 34 4 17 0;
-#X connect 34 5 18 0;
-#X connect 34 6 19 0;
-#X connect 34 7 20 0;
-#X connect 34 8 21 0;
-#X connect 34 9 22 0;
-#X connect 34 10 23 0;
-#X connect 34 11 24 0;
-#X connect 34 12 25 0;
-#X connect 34 13 26 0;
-#X connect 34 14 27 0;
-#X connect 34 15 28 0;
-#X connect 34 15 4 0;
-#X connect 34 16 29 0;
-#X connect 34 17 30 0;
-#X connect 34 18 31 0;
-#X connect 34 19 32 0;
-#X connect 34 20 35 0;
-#X connect 34 21 36 0;
-#X connect 34 22 37 0;
-#X connect 34 23 38 0;
-#X connect 34 24 39 0;
-#X connect 34 25 40 0;
-#X connect 34 26 41 0;
-#X connect 34 27 42 0;
-#X connect 34 28 43 0;
-#X connect 34 29 44 0;
+#X connect 33 0 11 0;
+#X connect 34 0 12 0;
#X connect 35 0 11 0;
#X connect 36 0 12 0;
#X connect 37 0 11 0;
@@ -253,16 +256,12 @@
#X connect 43 0 11 0;
#X connect 44 0 12 0;
#X restore 33 572 pd synthese;
-#X msg 33 379 get massesSpeeds \$1;
#X obj 183 219 vsl 15 128 0 30 0 0 empty empty empty 0 -8 0 8 -262131
--1 -1 12700 1;
-#X msg 33 443 get massesPos;
+-1 -1 0 1;
#N canvas 571 334 938 386 massrender 0;
#X obj 286 2 inlet;
#X obj 35 134 gemhead;
#X obj 44 192 any;
-#X obj 44 288 curve2 ---------------------------------------------
-;
#X obj 382 3 inlet;
#X obj 304 88 f 0;
#X obj 304 129 + 1;
@@ -275,61 +274,60 @@
#X obj 55 227 route 0 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;
#X obj 211 189 sel 0;
-#X connect 0 0 9 0;
+#X obj 44 288 curve16 ---------------------------------------------
+;
+#X connect 0 0 8 0;
#X connect 1 0 2 1;
-#X connect 2 0 3 0;
+#X connect 2 0 14 0;
+#X connect 3 0 9 0;
#X connect 4 0 10 0;
#X connect 5 0 11 0;
#X connect 6 0 12 0;
-#X connect 7 0 13 0;
-#X connect 8 0 7 1;
-#X connect 8 1 7 2;
-#X connect 8 2 7 3;
-#X connect 9 1 5 0;
-#X connect 9 2 8 0;
-#X connect 10 0 5 1;
-#X connect 11 0 6 0;
-#X connect 11 1 7 0;
-#X connect 12 0 5 1;
-#X connect 12 0 14 0;
-#X connect 13 0 3 1;
-#X connect 13 1 3 2;
-#X connect 13 2 3 3;
-#X connect 13 3 3 4;
-#X connect 13 4 3 5;
-#X connect 13 5 3 6;
-#X connect 13 6 3 7;
-#X connect 13 7 3 8;
-#X connect 13 8 3 9;
-#X connect 13 9 3 10;
-#X connect 13 10 3 11;
-#X connect 13 11 3 12;
-#X connect 13 12 3 13;
-#X connect 13 13 3 14;
-#X connect 13 14 3 15;
-#X connect 13 15 3 16;
-#X connect 13 16 3 17;
-#X connect 13 17 3 18;
-#X connect 13 18 3 19;
-#X connect 13 19 3 20;
-#X connect 13 20 3 21;
-#X connect 13 21 3 22;
-#X connect 13 22 3 23;
-#X connect 13 23 3 24;
-#X connect 13 24 3 25;
-#X connect 13 25 3 26;
-#X connect 13 26 3 27;
-#X connect 13 27 3 28;
-#X connect 13 28 3 29;
-#X connect 13 29 3 30;
-#X connect 14 0 2 0;
+#X connect 7 0 6 1;
+#X connect 7 1 6 2;
+#X connect 7 2 6 3;
+#X connect 8 1 4 0;
+#X connect 8 2 7 0;
+#X connect 9 0 4 1;
+#X connect 10 0 5 0;
+#X connect 10 1 6 0;
+#X connect 11 0 4 1;
+#X connect 11 0 13 0;
+#X connect 12 0 14 1;
+#X connect 12 1 14 2;
+#X connect 12 2 14 3;
+#X connect 12 3 14 4;
+#X connect 12 4 14 5;
+#X connect 12 5 14 6;
+#X connect 12 6 14 7;
+#X connect 12 7 14 8;
+#X connect 12 8 14 9;
+#X connect 12 9 14 10;
+#X connect 12 10 14 11;
+#X connect 12 11 14 12;
+#X connect 12 12 14 13;
+#X connect 12 13 14 14;
+#X connect 12 14 14 15;
+#X connect 12 15 14 16;
+#X connect 12 16 14 17;
+#X connect 12 17 14 18;
+#X connect 12 18 14 19;
+#X connect 12 19 14 20;
+#X connect 12 20 14 21;
+#X connect 12 21 14 22;
+#X connect 12 22 14 23;
+#X connect 12 23 14 24;
+#X connect 12 24 14 25;
+#X connect 12 25 14 26;
+#X connect 12 26 14 27;
+#X connect 12 27 14 28;
+#X connect 12 28 14 29;
+#X connect 12 29 14 30;
+#X connect 13 0 2 0;
#X restore 135 573 pd massrender;
-#X obj 33 539 route massesSpeedsNo massesPos;
#X msg 165 140 setFixed 0 \, setFixed 29 \, setFixed 420 \, setFixed
449;
#X text 459 114 Filet abstraction : x0 y0 stepx stepy ny nx;
-#X msg 146 173 Xmax 4 \, Xmin -4 \, Ymax 4 \, Ymin -4 \, Zmax 7 \,
-Zmin -6;
#X text 484 206 <-- Add constant force;
#X text 240 204 <-- Add sinus force;
#X text 136 360 Get middles masses;
@@ -337,7 +335,6 @@ Zmin -6;
#X text 179 18 Reset;
#X obj 184 115 filet -3.2 -3.2 0.22068 0.45714 15 30;
#X msg 327 449 setK fil 20;
-#X msg 457 369 view 0 0 10 0 0 0 1 0 0;
#X obj 146 92 s resban;
#X msg 425 449 setK fil 10;
#X msg 425 468 setD fil 2.5;
@@ -345,6 +342,12 @@ Zmin -6;
#X msg 457 388 view 0 0 5 0 0 0 1 0 0;
#X text 624 390 <-- Zoom in;
#X msg 33 412 forceZ filet 0;
+#X msg 33 379 get massesPos \$1;
+#X msg 146 173 Xmax 4 \, Xmin -4 \, Ymax 4 \, Ymin -4 \, Zmax 9 \,
+Zmin -6;
+#X msg 457 369 view 0 0 11 0 0 0 1 0 0;
+#X msg 33 443 get massesPos;
+#X obj 33 539 route massesPosNo massesPos;
#X connect 0 0 13 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
@@ -352,13 +355,13 @@ Zmin -6;
#X connect 7 0 13 0;
#X connect 8 0 6 0;
#X connect 9 0 19 0;
-#X connect 10 0 44 1;
-#X connect 11 0 35 0;
+#X connect 10 0 40 1;
+#X connect 11 0 53 0;
#X connect 11 1 1 0;
-#X connect 13 0 38 0;
-#X connect 13 0 47 0;
-#X connect 13 1 36 0;
-#X connect 13 2 44 0;
+#X connect 13 0 50 0;
+#X connect 13 0 42 0;
+#X connect 13 1 33 0;
+#X connect 13 2 40 0;
#X connect 13 3 8 0;
#X connect 13 3 10 0;
#X connect 14 0 11 0;
@@ -368,14 +371,14 @@ Zmin -6;
#X connect 18 0 11 0;
#X connect 19 0 11 0;
#X connect 19 0 29 0;
-#X connect 19 0 33 0;
-#X connect 19 0 53 0;
-#X connect 19 1 34 1;
+#X connect 19 0 52 0;
+#X connect 19 0 48 0;
+#X connect 19 1 32 1;
#X connect 19 2 29 0;
-#X connect 19 2 33 0;
-#X connect 19 3 34 1;
+#X connect 19 2 52 0;
+#X connect 19 3 32 1;
#X connect 20 0 2 0;
-#X connect 20 0 42 0;
+#X connect 20 0 38 0;
#X connect 21 0 16 1;
#X connect 22 0 23 0;
#X connect 23 0 14 0;
@@ -384,19 +387,19 @@ Zmin -6;
#X connect 26 0 27 0;
#X connect 27 0 22 0;
#X connect 28 0 24 0;
-#X connect 29 0 31 0;
-#X connect 31 0 11 0;
-#X connect 32 0 23 1;
-#X connect 33 0 11 0;
-#X connect 35 0 30 0;
-#X connect 35 1 34 0;
-#X connect 36 0 6 0;
-#X connect 38 0 6 0;
-#X connect 42 0 46 0;
-#X connect 44 0 6 0;
-#X connect 45 0 11 0;
+#X connect 29 0 49 0;
+#X connect 31 0 23 1;
+#X connect 33 0 6 0;
+#X connect 38 0 51 0;
+#X connect 40 0 6 0;
+#X connect 41 0 11 0;
+#X connect 43 0 11 0;
+#X connect 44 0 11 0;
#X connect 46 0 2 0;
#X connect 48 0 11 0;
#X connect 49 0 11 0;
+#X connect 50 0 6 0;
#X connect 51 0 2 0;
-#X connect 53 0 11 0;
+#X connect 52 0 11 0;
+#X connect 53 0 30 0;
+#X connect 53 1 32 0;
diff --git a/msd3D/curve16.pd b/msd3D/curve16.pd
new file mode 100644
index 0000000..cdf10c6
--- /dev/null
+++ b/msd3D/curve16.pd
@@ -0,0 +1,133 @@
+#N canvas 8 35 1142 910 10;
+#X obj 31 123 GEMglBegin;
+#X obj 86 100 GLdefine GL_LINE_STRIP;
+#X obj 31 13 inlet;
+#X obj 86 77 loadbang;
+#X obj 159 13 inlet;
+#X obj 200 13 inlet;
+#X obj 25 865 GEMglEnd;
+#X obj 31 151 GEMglVertex3fv;
+#X obj 31 175 GEMglVertex3fv;
+#X obj 241 13 inlet;
+#X obj 280 12 inlet;
+#X obj 29 202 GEMglVertex3fv;
+#X obj 29 226 GEMglVertex3fv;
+#X obj 319 12 inlet;
+#X obj 359 12 inlet;
+#X obj 161 76 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 29 252 GEMglVertex3fv;
+#X obj 29 276 GEMglVertex3fv;
+#X obj 29 300 GEMglVertex3fv;
+#X obj 29 324 GEMglVertex3fv;
+#X obj 28 346 GEMglVertex3fv;
+#X obj 28 370 GEMglVertex3fv;
+#X obj 28 394 GEMglVertex3fv;
+#X obj 28 418 GEMglVertex3fv;
+#X obj 403 12 inlet;
+#X obj 444 12 inlet;
+#X obj 485 12 inlet;
+#X obj 524 11 inlet;
+#X obj 563 11 inlet;
+#X obj 603 11 inlet;
+#X obj 28 441 GEMglVertex3fv;
+#X obj 28 465 GEMglVertex3fv;
+#X obj 28 489 GEMglVertex3fv;
+#X obj 27 511 GEMglVertex3fv;
+#X obj 27 535 GEMglVertex3fv;
+#X obj 27 559 GEMglVertex3fv;
+#X obj 27 583 GEMglVertex3fv;
+#X obj 643 13 inlet;
+#X obj 683 13 inlet;
+#X obj 727 13 inlet;
+#X obj 768 13 inlet;
+#X obj 809 13 inlet;
+#X obj 848 12 inlet;
+#X obj 887 12 inlet;
+#X obj 927 12 inlet;
+#X obj 27 605 GEMglVertex3fv;
+#X obj 26 625 GEMglVertex3fv;
+#X obj 26 649 GEMglVertex3fv;
+#X obj 26 672 GEMglVertex3fv;
+#X obj 26 696 GEMglVertex3fv;
+#X obj 26 720 GEMglVertex3fv;
+#X obj 25 742 GEMglVertex3fv;
+#X obj 25 766 GEMglVertex3fv;
+#X obj 25 790 GEMglVertex3fv;
+#X obj 25 814 GEMglVertex3fv;
+#X obj 25 836 GEMglVertex3fv;
+#X obj 970 13 inlet;
+#X obj 1010 13 inlet;
+#X obj 1050 15 inlet;
+#X obj 1090 15 inlet;
+#X obj 1134 15 inlet;
+#X obj 1175 15 inlet;
+#X obj 1216 15 inlet;
+#X obj 1255 14 inlet;
+#X obj 1294 14 inlet;
+#X obj 1334 14 inlet;
+#X connect 0 0 7 0;
+#X connect 1 0 0 1;
+#X connect 2 0 0 0;
+#X connect 3 0 1 0;
+#X connect 4 0 7 1;
+#X connect 5 0 8 1;
+#X connect 7 0 8 0;
+#X connect 8 0 11 0;
+#X connect 9 0 11 1;
+#X connect 10 0 12 1;
+#X connect 11 0 12 0;
+#X connect 12 0 16 0;
+#X connect 13 0 16 1;
+#X connect 14 0 17 1;
+#X connect 15 0 1 0;
+#X connect 16 0 17 0;
+#X connect 17 0 18 0;
+#X connect 18 0 19 0;
+#X connect 19 0 20 0;
+#X connect 20 0 21 0;
+#X connect 21 0 22 0;
+#X connect 22 0 23 0;
+#X connect 23 0 30 0;
+#X connect 24 0 18 1;
+#X connect 25 0 19 1;
+#X connect 26 0 20 1;
+#X connect 27 0 21 1;
+#X connect 28 0 22 1;
+#X connect 29 0 23 1;
+#X connect 30 0 31 0;
+#X connect 31 0 32 0;
+#X connect 32 0 33 0;
+#X connect 33 0 34 0;
+#X connect 34 0 35 0;
+#X connect 35 0 36 0;
+#X connect 36 0 45 0;
+#X connect 37 0 30 1;
+#X connect 38 0 31 1;
+#X connect 39 0 32 1;
+#X connect 40 0 33 1;
+#X connect 41 0 34 1;
+#X connect 42 0 35 1;
+#X connect 43 0 36 1;
+#X connect 44 0 45 1;
+#X connect 45 0 46 0;
+#X connect 46 0 47 0;
+#X connect 47 0 48 0;
+#X connect 48 0 49 0;
+#X connect 49 0 50 0;
+#X connect 50 0 51 0;
+#X connect 51 0 52 0;
+#X connect 52 0 53 0;
+#X connect 53 0 54 0;
+#X connect 54 0 55 0;
+#X connect 55 0 6 0;
+#X connect 56 0 46 1;
+#X connect 57 0 47 1;
+#X connect 58 0 48 1;
+#X connect 59 0 49 1;
+#X connect 60 0 50 1;
+#X connect 61 0 51 1;
+#X connect 62 0 52 1;
+#X connect 63 0 53 1;
+#X connect 64 0 54 1;
+#X connect 65 0 55 1;
diff --git a/msd3D/curve2.pd b/msd3D/curve2.pd
index cdf10c6..b4b8d72 100644
--- a/msd3D/curve2.pd
+++ b/msd3D/curve2.pd
@@ -1,71 +1,15 @@
-#N canvas 8 35 1142 910 10;
+#N canvas 0 25 1255 894 10;
#X obj 31 123 GEMglBegin;
#X obj 86 100 GLdefine GL_LINE_STRIP;
#X obj 31 13 inlet;
#X obj 86 77 loadbang;
#X obj 159 13 inlet;
#X obj 200 13 inlet;
-#X obj 25 865 GEMglEnd;
+#X obj 28 204 GEMglEnd;
#X obj 31 151 GEMglVertex3fv;
#X obj 31 175 GEMglVertex3fv;
-#X obj 241 13 inlet;
-#X obj 280 12 inlet;
-#X obj 29 202 GEMglVertex3fv;
-#X obj 29 226 GEMglVertex3fv;
-#X obj 319 12 inlet;
-#X obj 359 12 inlet;
#X obj 161 76 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
-#X obj 29 252 GEMglVertex3fv;
-#X obj 29 276 GEMglVertex3fv;
-#X obj 29 300 GEMglVertex3fv;
-#X obj 29 324 GEMglVertex3fv;
-#X obj 28 346 GEMglVertex3fv;
-#X obj 28 370 GEMglVertex3fv;
-#X obj 28 394 GEMglVertex3fv;
-#X obj 28 418 GEMglVertex3fv;
-#X obj 403 12 inlet;
-#X obj 444 12 inlet;
-#X obj 485 12 inlet;
-#X obj 524 11 inlet;
-#X obj 563 11 inlet;
-#X obj 603 11 inlet;
-#X obj 28 441 GEMglVertex3fv;
-#X obj 28 465 GEMglVertex3fv;
-#X obj 28 489 GEMglVertex3fv;
-#X obj 27 511 GEMglVertex3fv;
-#X obj 27 535 GEMglVertex3fv;
-#X obj 27 559 GEMglVertex3fv;
-#X obj 27 583 GEMglVertex3fv;
-#X obj 643 13 inlet;
-#X obj 683 13 inlet;
-#X obj 727 13 inlet;
-#X obj 768 13 inlet;
-#X obj 809 13 inlet;
-#X obj 848 12 inlet;
-#X obj 887 12 inlet;
-#X obj 927 12 inlet;
-#X obj 27 605 GEMglVertex3fv;
-#X obj 26 625 GEMglVertex3fv;
-#X obj 26 649 GEMglVertex3fv;
-#X obj 26 672 GEMglVertex3fv;
-#X obj 26 696 GEMglVertex3fv;
-#X obj 26 720 GEMglVertex3fv;
-#X obj 25 742 GEMglVertex3fv;
-#X obj 25 766 GEMglVertex3fv;
-#X obj 25 790 GEMglVertex3fv;
-#X obj 25 814 GEMglVertex3fv;
-#X obj 25 836 GEMglVertex3fv;
-#X obj 970 13 inlet;
-#X obj 1010 13 inlet;
-#X obj 1050 15 inlet;
-#X obj 1090 15 inlet;
-#X obj 1134 15 inlet;
-#X obj 1175 15 inlet;
-#X obj 1216 15 inlet;
-#X obj 1255 14 inlet;
-#X obj 1294 14 inlet;
-#X obj 1334 14 inlet;
#X connect 0 0 7 0;
#X connect 1 0 0 1;
#X connect 2 0 0 0;
@@ -73,61 +17,5 @@
#X connect 4 0 7 1;
#X connect 5 0 8 1;
#X connect 7 0 8 0;
-#X connect 8 0 11 0;
-#X connect 9 0 11 1;
-#X connect 10 0 12 1;
-#X connect 11 0 12 0;
-#X connect 12 0 16 0;
-#X connect 13 0 16 1;
-#X connect 14 0 17 1;
-#X connect 15 0 1 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 19 0;
-#X connect 19 0 20 0;
-#X connect 20 0 21 0;
-#X connect 21 0 22 0;
-#X connect 22 0 23 0;
-#X connect 23 0 30 0;
-#X connect 24 0 18 1;
-#X connect 25 0 19 1;
-#X connect 26 0 20 1;
-#X connect 27 0 21 1;
-#X connect 28 0 22 1;
-#X connect 29 0 23 1;
-#X connect 30 0 31 0;
-#X connect 31 0 32 0;
-#X connect 32 0 33 0;
-#X connect 33 0 34 0;
-#X connect 34 0 35 0;
-#X connect 35 0 36 0;
-#X connect 36 0 45 0;
-#X connect 37 0 30 1;
-#X connect 38 0 31 1;
-#X connect 39 0 32 1;
-#X connect 40 0 33 1;
-#X connect 41 0 34 1;
-#X connect 42 0 35 1;
-#X connect 43 0 36 1;
-#X connect 44 0 45 1;
-#X connect 45 0 46 0;
-#X connect 46 0 47 0;
-#X connect 47 0 48 0;
-#X connect 48 0 49 0;
-#X connect 49 0 50 0;
-#X connect 50 0 51 0;
-#X connect 51 0 52 0;
-#X connect 52 0 53 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 0;
-#X connect 55 0 6 0;
-#X connect 56 0 46 1;
-#X connect 57 0 47 1;
-#X connect 58 0 48 1;
-#X connect 59 0 49 1;
-#X connect 60 0 50 1;
-#X connect 61 0 51 1;
-#X connect 62 0 52 1;
-#X connect 63 0 53 1;
-#X connect 64 0 54 1;
-#X connect 65 0 55 1;
+#X connect 8 0 6 0;
+#X connect 9 0 1 0;
diff --git a/msd3D/help-msd3D.pd b/msd3D/help-msd3D.pd
index 14fd769..406396f 100644
--- a/msd3D/help-msd3D.pd
+++ b/msd3D/help-msd3D.pd
@@ -76,18 +76,41 @@ their;
#X connect 46 0 52 0;
#X connect 47 0 52 0;
#X restore 158 305 pd masses;
+#X text 12 305 HELP on masses --->;
+#X text 11 336 HELP on links --->;
+#X text -50 110 There are 4 types of messages for msd :;
+#X text -49 74 It is designed to implement particules physical model
+in PD.The model is based on two elements type : mass and link.;
+#X obj -50 125 cnv 15 420 30 empty empty empty 20 12 0 14 -262131 -66577
+0;
+#X obj -50 158 cnv 15 420 30 empty empty empty 20 12 0 14 -261689 -66577
+0;
+#X obj -50 191 cnv 15 420 30 empty empty empty 20 12 0 14 -262131 -66577
+0;
+#X obj -50 224 cnv 15 420 30 empty empty empty 20 12 0 14 -261689 -66577
+0;
+#X text -47 132 CREATION : To create the model masses and links.;
+#X text -47 197 DYNAMIC SETTING : To set the model parameters dynamically.
+;
+#X text -47 230 ATTRIBUTES : To get the model parameters.;
+#X text -47 159 COMPUTATION : To compute the new model state based
+on previous instant.;
+#X text 32 16 MSD3D : mass - spring - damper model;
+#X text -48 61 MSD3D is the 3D object of the msd objects collection.
+;
#N canvas 222 83 808 841 links 0;
-#X obj 62 250 cnv 15 610 305 empty empty CREATION 20 12 0 14 -262131
+#X obj 33 821 msd;
+#X obj 62 192 cnv 15 610 360 empty empty CREATION 20 12 0 14 -262131
-66577 0;
-#X msg 79 279 reset;
-#X text 338 308 \$1 : Id (symbol);
-#X text 250 308 Add a link;
-#X text 337 328 \$2 : creation No of mass1;
-#X text 337 346 \$3 : creation No of mass2;
-#X text 336 364 \$4 : rigidity;
-#X text 251 280 Delete all masses and links;
-#X text 336 382 \$5 : viscosity;
-#X text 336 399 \$6 : damping;
+#X msg 79 221 reset;
+#X text 402 247 \$1 : Id (symbol);
+#X text 314 247 Add a link;
+#X text 401 267 \$2 : creation No of mass1;
+#X text 401 285 \$3 : creation No of mass2;
+#X text 400 303 \$4 : rigidity;
+#X text 251 222 Delete all masses and links;
+#X text 400 321 \$5 : viscosity;
+#X text 400 338 \$6 : damping;
#X obj 61 561 cnv 15 610 82 empty empty DYNAMIC_SETTING 20 12 0 14
-262131 -66577 0;
#X msg 172 583 setD \$1 \$2;
@@ -103,29 +126,27 @@ their;
#X text 237 705 \$1 : Attribute type ( massesPos / massesSpeeds / massesForces
/ linksPos );
#X text 237 742 \$2 : Id (symbol or creations numbers);
-#X msg 78 308 link \$1 \$2 \$3 \$4 \$5 \$6;
-#X msg 74 532 deleteLink \$1;
-#X text 239 534 Delete a link;
-#X text 340 534 \$1 : Creation No of link;
+#X msg 74 533 deleteLink \$1;
+#X text 239 535 Delete a link;
+#X text 340 535 \$1 : Creation No of link;
#X msg 73 762 infosL;
#X text 236 762 Get infos on all masses and links on outlet No 2;
-#X msg 73 423 iLink \$1 \$2 \$3 \$4 \$5 \$6;
-#X text 338 308 \$1 : Id (symbol);
-#X text 250 308 Add a link;
-#X text 337 328 \$2 : creation No of mass1;
-#X text 337 346 \$3 : creation No of mass2;
-#X text 336 364 \$4 : rigidity;
-#X text 336 382 \$5 : viscosity;
-#X text 336 399 \$6 : damping;
-#X text 410 422 \$1 : Id (symbol);
-#X text 409 478 \$4 : rigidity;
-#X text 409 496 \$5 : viscosity;
-#X text 409 513 \$6 : damping;
-#X text 410 422 \$1 : Id (symbol);
-#X text 409 478 \$4 : rigidity;
-#X text 409 496 \$5 : viscosity;
-#X text 409 513 \$6 : damping;
-#X text 248 423 Add an interactor link;
+#X text 402 247 \$1 : Id (symbol);
+#X text 314 247 Add a link;
+#X text 401 267 \$2 : creation No of mass1;
+#X text 401 285 \$3 : creation No of mass2;
+#X text 400 303 \$4 : rigidity;
+#X text 400 321 \$5 : viscosity;
+#X text 400 338 \$6 : damping;
+#X text 463 392 \$1 : Id (symbol);
+#X text 462 448 \$4 : rigidity;
+#X text 462 466 \$5 : viscosity;
+#X text 462 483 \$6 : damping;
+#X text 463 392 \$1 : Id (symbol);
+#X text 462 448 \$4 : rigidity;
+#X text 462 466 \$5 : viscosity;
+#X text 462 483 \$6 : damping;
+#X text 301 393 Add an interactor link;
#X text 94 52 LINKS :;
#X text 71 91 parameters : length \, rigidity \, viscosity and damping.
;
@@ -134,43 +155,26 @@ their;
#X text 70 134 the two masses at the creation.;
#X text 71 120 message. The lenght is initialised to the distance between
;
-#X text 71 106 Rigidity \, viscosity and damping are defined by the
+#X text 71 107 Rigidity \, viscosity and damping are defined by the
creation;
-#X text 409 442 \$2 : Id (symbol) of masses type 1;
-#X text 409 460 \$3 : Id (symbol) of masses type 2;
#X text 70 148 Interactor links are links between mutiples masses \,
instead;
#X text 70 161 of creation number \, the masses linked are defined
with;
#X text 69 175 their Id.;
-#X obj 33 821 msd3D;
-#X connect 1 0 56 0;
-#X connect 14 0 56 0;
-#X connect 18 0 56 0;
-#X connect 22 0 56 0;
-#X connect 23 0 56 0;
-#X connect 26 0 56 0;
-#X connect 28 0 56 0;
+#X text 397 356 ($7) : minimum lenght of link;
+#X text 397 373 ($8) : maximum lenght of link;
+#X msg 78 247 link \$1 \$2 \$3 \$4 \$5 \$6 ($7 \$8);
+#X text 462 412 \$2 : Id (symbol) of masses 1;
+#X text 462 430 \$3 : Id (symbol) of masses 2;
+#X msg 73 393 iLink \$1 \$2 \$3 \$4 \$5 \$6 ($7 \$8);
+#X text 458 500 ($7) : minimum lenght of links;
+#X text 458 517 ($8) : maximum lenght of links;
+#X connect 2 0 0 0;
+#X connect 15 0 0 0;
+#X connect 19 0 0 0;
+#X connect 23 0 0 0;
+#X connect 26 0 0 0;
+#X connect 55 0 0 0;
+#X connect 58 0 0 0;
#X restore 160 335 pd links;
-#X text 12 305 HELP on masses --->;
-#X text 11 336 HELP on links --->;
-#X text -50 110 There are 4 types of messages for msd :;
-#X text -49 74 It is designed to implement particules physical model
-in PD.The model is based on two elements type : mass and link.;
-#X obj -50 125 cnv 15 420 30 empty empty empty 20 12 0 14 -262131 -66577
-0;
-#X obj -50 158 cnv 15 420 30 empty empty empty 20 12 0 14 -261689 -66577
-0;
-#X obj -50 191 cnv 15 420 30 empty empty empty 20 12 0 14 -262131 -66577
-0;
-#X obj -50 224 cnv 15 420 30 empty empty empty 20 12 0 14 -261689 -66577
-0;
-#X text -47 132 CREATION : To create the model masses and links.;
-#X text -47 197 DYNAMIC SETTING : To set the model parameters dynamically.
-;
-#X text -47 230 ATTRIBUTES : To get the model parameters.;
-#X text -47 159 COMPUTATION : To compute the new model state based
-on previous instant.;
-#X text 32 16 MSD3D : mass - spring - damper model;
-#X text -48 61 MSD3D is the 3D object of the msd objects collection.
-;
diff --git a/msd3D/main.cpp b/msd3D/main.cpp
index 428a86b..9d0c884 100755
--- a/msd3D/main.cpp
+++ b/msd3D/main.cpp
@@ -30,7 +30,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Version 0.02 -- 15.04.2005
+ Version 0.03 -- 21.04.2005
*/
// include flext header
@@ -38,7 +38,7 @@
#include <math.h>
// define constants
-#define MSD3D_VERSION 0.02
+#define MSD3D_VERSION 0.03
#define nb_max_link 4000
#define nb_max_mass 4000
#define Id_length 20
@@ -79,7 +79,7 @@ typedef struct _link {
t_mass *mass1;
t_mass *mass2;
t_float K1, D1, D2;
- t_float longx, longy, longz, longueur;
+ t_float longx, longy, longz, longueur, long_min, long_max;
t_float distance_old;
} t_link;
@@ -137,12 +137,19 @@ protected:
// compute link forces
distance = sqrt(pow(link[i]->mass1->posX-link[i]->mass2->posX,2) + pow(link[i]->mass1->posY
-link[i]->mass2->posY,2) + pow(link[i]->mass1->posZ-link[i]->mass2->posZ,2)); // L[n]
- F = link[i]->K1 * (distance - link[i]->longueur) ; // F = K1(L[n] - L[0])
- F += link[i]->D1 * (distance - link[i]->distance_old) ; // F = F + D1(L[n] - L[n-1])
- if (distance != 0) {
- Fx = F * (link[i]->mass1->posX - link[i]->mass2->posX)/distance; // Fx[n] = F * Lx[n]/L[n]
- Fy = F * (link[i]->mass1->posY - link[i]->mass2->posY)/distance; // Fy[n] = F * Ly[n]/L[n]
- Fz = F * (link[i]->mass1->posZ - link[i]->mass2->posZ)/distance; // Fy[n] = F * Lz[n]/L[n]
+ if (distance < link[i]->long_min || distance > link[i]->long_max) {
+ Fx = 0;
+ Fy = 0;
+ Fz = 0;
+ }
+ else {
+ F = link[i]->K1 * (distance - link[i]->longueur) ; // F = K1(L[n] - L[0])
+ F += link[i]->D1 * (distance - link[i]->distance_old) ; // F = F + D1(L[n] - L[n-1])
+ if (distance != 0) {
+ Fx = F * (link[i]->mass1->posX - link[i]->mass2->posX)/distance; // Fx[n] = F * Lx[n]/L[n]
+ Fy = F * (link[i]->mass1->posY - link[i]->mass2->posY)/distance; // Fy[n] = F * Ly[n]/L[n]
+ Fz = F * (link[i]->mass1->posZ - link[i]->mass2->posZ)/distance; // Fy[n] = F * Lz[n]/L[n]
+ }
}
link[i]->mass1->forceX -= Fx; // Fx1[n] = -Fx
link[i]->mass1->forceX -= link[i]->D2*link[i]->mass1->speedX; // Fx1[n] = Fx1[n] - D2 * vx1[n-1]
@@ -196,6 +203,9 @@ protected:
t_atom sortie[7], aux[2];
t_float M;
+ if (argc != 6)
+ error("mass : Id mobile mass X Y Z");
+
mass[nb_mass] = new t_mass; // new mass
mass[nb_mass]->Id = GetSymbol(argv[0]); // Id
mass[nb_mass]->mobile = GetInt(argv[1]); // mobile
@@ -235,6 +245,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("forceX : Idmass value");
+
for (i=0; i<nb_mass;i++)
{
if (sym == mass[i]->Id)
@@ -248,6 +261,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("forceY : Idmass value");
+
for (i=0; i<nb_mass;i++)
{
if (sym == mass[i]->Id)
@@ -261,6 +277,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("forceZ : Idmass value");
+
for (i=0; i<nb_mass;i++)
{
if (sym == mass[i]->Id)
@@ -274,11 +293,14 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("posX : Idmass value");
+
if (GetFloat(argv[1]) < Xmax && GetFloat(argv[1]) > Xmin)
for (i=0; i<nb_mass;i++)
{
if (sym == mass[i]->Id)
- mass[i]->posX = GetFloat(argv[1]);
+ mass[i]->posX = GetAFloat(argv[1]);
}
}
@@ -288,6 +310,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("posY : Idmass value");
+
if (GetFloat(argv[1]) < Ymax && GetFloat(argv[1]) > Ymin)
for (i=0; i<nb_mass;i++)
{
@@ -303,6 +328,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("posZ : Idmass value");
+
if (GetFloat(argv[1]) < Zmax && GetFloat(argv[1]) > Zmin)
for (i=0; i<nb_mass;i++)
{
@@ -316,6 +344,9 @@ protected:
{
// set mass No to mobile
t_int i,aux;
+
+ if (argc != 1)
+ error("setMobile : Idmass");
aux = GetInt(argv[0]);
for (i=0; i<nb_mass;i++)
@@ -331,7 +362,10 @@ protected:
// set mass No to fixed
t_int i,aux;
- aux = GetInt(argv[0]);
+ if (argc != 1)
+ error("setFixed : Idmass");
+
+ aux = GetAInt(argv[0]);
for (i=0; i<nb_mass;i++)
{
if (mass[i]->nbr == aux)
@@ -343,100 +377,131 @@ protected:
void m_delete_mass(int argc,t_atom *argv)
{
// Delete mass
- t_int i,nb_link_delete=0;
- t_atom sortie[7], aux[nb_link];
+ t_int i,nb_link_delete=0;
+ t_atom sortie[7], aux[nb_link];
+
+ if (argc != 1)
+ error("deleteMass : Nomass");
- // Delete associated links
- for (i=0; i<nb_link;i++) {
- if (link[i]->mass1->nbr == GetInt(argv[0]) || link[i]->mass2->nbr == GetInt(argv[0])) {
- SetFloat((aux[nb_link_delete]),link[i]->nbr);
- nb_link_delete++;
+ // Delete associated links
+ for (i=0; i<nb_link;i++) {
+ if (link[i]->mass1->nbr == GetInt(argv[0]) || link[i]->mass2->nbr == GetInt(argv[0])) {
+ SetFloat((aux[nb_link_delete]),link[i]->nbr);
+ nb_link_delete++;
+ }
}
- }
- for (i=0; i<nb_link_delete;i++)
- m_delete_link(1,&aux[i]);
+ for (i=0; i<nb_link_delete;i++)
+ m_delete_link(1,&aux[i]);
- // Delete mass
- for (i=0; i<nb_mass;i++)
- if (mass[i]->nbr == GetInt(argv[0])) {
- SetFloat((sortie[0]),mass[i]->nbr);
- SetSymbol((sortie[1]),mass[i]->Id);
- SetFloat((sortie[2]),mass[i]->mobile);
- SetFloat((sortie[3]),1/mass[i]->invM);
- SetFloat((sortie[4]),mass[i]->posX);
- SetFloat((sortie[5]),mass[i]->posY);
- SetFloat((sortie[6]),mass[i]->posZ);
- delete mass[i];
- mass[i] = mass[nb_mass-1]; // copy last mass indeed
- nb_mass--;
- ToOutAnything(1,S_Mass_deleted,7,sortie);
- break;
- }
+ // Delete mass
+ for (i=0; i<nb_mass;i++)
+ if (mass[i]->nbr == GetInt(argv[0])) {
+ SetFloat((sortie[0]),mass[i]->nbr);
+ SetSymbol((sortie[1]),mass[i]->Id);
+ SetFloat((sortie[2]),mass[i]->mobile);
+ SetFloat((sortie[3]),1/mass[i]->invM);
+ SetFloat((sortie[4]),mass[i]->posX);
+ SetFloat((sortie[5]),mass[i]->posY);
+ SetFloat((sortie[6]),mass[i]->posZ);
+ delete mass[i];
+ mass[i] = mass[nb_mass-1]; // copy last mass indeed
+ nb_mass--;
+ ToOutAnything(1,S_Mass_deleted,7,sortie);
+ break;
+ }
}
void m_Xmax(int argc,t_atom *argv)
{
- // set maximum X of all masses
- Xmax = GetFloat(argv[0]);
+ // set X max
+ if (argc != 1)
+ error("Xmax : Value");
+ Xmax = GetFloat(argv[0]);
}
- void m_Ymax(int argc,t_atom *argv)
+ void m_Xmin(int argc,t_atom *argv)
{
- // set maximum Y of all masses
- Ymax = GetFloat(argv[0]);
+ // set X min
+ if (argc != 1)
+ error("Xmin : Value");
+ Xmin = GetFloat(argv[0]);
}
-
- void m_Zmax(int argc,t_atom *argv)
+ void m_Ymax(int argc,t_atom *argv)
{
- // set maximum Z of all masses
- Zmax = GetFloat(argv[0]);
+ // set Y max
+ if (argc != 1)
+ error("Ymax : Value");
+ Ymax = GetFloat(argv[0]);
}
- void m_Xmin(int argc,t_atom *argv)
+ void m_Ymin(int argc,t_atom *argv)
{
- // set minimum X of all masses
- Xmin = GetFloat(argv[0]);
+ // set Y min
+ if (argc != 1)
+ error("Ymin : Value");
+ Ymin = GetFloat(argv[0]);
}
- void m_Ymin(int argc,t_atom *argv)
+ void m_Zmax(int argc,t_atom *argv)
{
- // set minimum Y of all masses
- Ymin = GetFloat(argv[0]);
+ // set maximum Z of all masses
+ if (argc != 1)
+ error("Zmax : Value");
+ Zmax = GetFloat(argv[0]);
}
void m_Zmin(int argc,t_atom *argv)
{
// set minimum Z of all masses
- Zmin = GetFloat(argv[0]);
+ if (argc != 1)
+ error("Zmin : Value");
+ Zmin = GetFloat(argv[0]);
}
// -------------------------------------------------------------- LINKS
// ---------------------------------------------------------------------
void m_link(int argc,t_atom *argv)
// add a link
- // Id, nbr, *mass1, *mass2, K1, D1
+ // Id, *mass1, *mass2, K1, D1, D2, (Lmin,Lmax)
{
t_atom sortie[7], aux[2];
t_int i;
- link[nb_link] = new t_link; // new link
+ if (argc < 6 || argc > 8)
+ error("link : Id Nomass1 Nomass2 K D1 D2 (Lmin Lmax)");
+ link[nb_link] = new t_link; // New pointer
link[nb_link]->Id = GetSymbol(argv[0]); // ID
for (i=0; i<nb_mass;i++)
- if (mass[i]->nbr==GetInt(argv[1])) // pointer on mass 1
+ if (mass[i]->nbr==GetAInt(argv[1])) // pointer to mass1
link[nb_link]->mass1 = mass[i];
- else if(mass[i]->nbr==GetInt(argv[2])) // pointer on mass 2
+ else if(mass[i]->nbr==GetAInt(argv[2])) // pointer to mass2
link[nb_link]->mass2 = mass[i];
link[nb_link]->K1 = GetFloat(argv[3]); // K1
link[nb_link]->D1 = GetFloat(argv[4]); // D1
link[nb_link]->D2 = GetFloat(argv[5]); // D2
- link[nb_link]->longx = link[nb_link]->mass1->posX - link[nb_link]->mass2->posX; // Lx[0]
- link[nb_link]->longy = link[nb_link]->mass1->posY - link[nb_link]->mass2->posY; // Ly[0]
- link[nb_link]->longz = link[nb_link]->mass1->posZ - link[nb_link]->mass2->posZ; // Lz[0]
- link[nb_link]->longueur = sqrt( pow(link[nb_link]->longx,2) + pow(link[nb_link]->longy,2) + pow(link[nb_link]->longz,2));
+ link[nb_link]->longx = link[nb_link]->mass1->posX - link[nb_link]->mass2->posX; // Lx[0]
+ if (link[nb_link]->longx < 0)
+ link[nb_link]->longueur = -link[nb_link]->longx;
+ else
+ link[nb_link]->longueur = link[nb_link]->longx ;// L[0]
link[nb_link]->nbr = id_link; // id number
- link[nb_link]->distance_old = link[nb_link]->longueur;
+ link[nb_link]->distance_old = link[nb_link]->longueur; // L[n-1]
+ switch (argc) {
+ case 6 :
+ link[nb_link]->long_max = 32768;
+ link[nb_link]->long_min = 0;
+ break;
+ case 7 :
+ link[nb_link]->long_min = GetFloat(argv[6]);
+ link[nb_link]->long_max = 32768;
+ break;
+ case 8 :
+ link[nb_link]->long_min = GetFloat(argv[6]);
+ link[nb_link]->long_max = GetFloat(argv[7]);
+ break;
+ }
nb_link++;
id_link++;
nb_link = min ( nb_max_link -1, nb_link );
@@ -447,22 +512,24 @@ protected:
SetFloat((sortie[4]),link[nb_link-1]->K1);
SetFloat((sortie[5]),link[nb_link-1]->D1);
SetFloat((sortie[6]),link[nb_link-1]->D2);
- ToOutAnything(1,S_Link ,7,sortie);
+ ToOutAnything(1,S_Link,7,sortie);
}
void m_ilink(int argc,t_atom *argv)
// add interactor link
- // Id, nbr, Id masses1, Id masses2, K1, D1
+ // Id, Id masses1, Id masses2, K1, D1, D2, (Lmin, Lmax)
{
- t_atom aux[2], arglist[6];
+ t_atom aux[2], arglist[8];
t_int i,j, imass1[nb_mass], nbmass1=0, imass2[nb_mass], nbmass2=0;
t_symbol *Id1, *Id2;
+ if (argc < 6 || argc > 8)
+ error("ilink : Id Idmass1 Idmass2 K D1 D2 (Lmin Lmax)");
+
Id1 = GetSymbol(argv[1]);
Id2 = GetSymbol(argv[2]);
ToOutAnything(1,S_iLink,0,aux);
-
for (i=0;i<nb_mass;i++) {
if (Id1 == mass[i]->Id) {
imass1[nbmass1]=i;
@@ -483,7 +550,16 @@ protected:
SetFloat((arglist[3]),GetFloat(argv[3]));
SetFloat((arglist[4]),GetFloat(argv[4]));
SetFloat((arglist[5]),GetFloat(argv[5]));
- m_link(6,arglist);
+ switch (argc) {
+ case 7 :
+ SetFloat(arglist[6],GetFloat(argv[6]));
+ break;
+ case 8 :
+ SetFloat(arglist[6],GetFloat(argv[6]));
+ SetFloat(arglist[7],GetFloat(argv[7]));
+ break;
+ }
+ m_link(argc,arglist);
}
}
@@ -493,6 +569,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("setK : IdLink Value");
+
for (i=0; i<nb_link;i++)
{
if (sym == link[i]->Id)
@@ -502,10 +581,13 @@ protected:
void m_setD(int argc,t_atom *argv)
{
- // set viscosity of link(s) named Id
+ // set damping of link(s) named Id
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("setD : IdLink Value");
+
for (i=0; i<nb_link;i++)
{
if (sym == link[i]->Id)
@@ -519,6 +601,9 @@ protected:
t_int i;
const t_symbol *sym = GetSymbol(argv[0]);
+ if (argc != 2)
+ error("setD2 : IdLink Value");
+
for (i=0; i<nb_link;i++)
{
if (sym == link[i]->Id)
@@ -529,26 +614,30 @@ protected:
void m_delete_link(int argc,t_atom *argv)
{
// Delete link
- t_int i;
- t_atom sortie[7];
+ t_int i;
+ t_atom sortie[7];
- for (i=0; i<nb_link;i++)
- if (link[i]->nbr == GetInt(argv[0])) {
- SetFloat((sortie[0]),link[i]->nbr);
- SetSymbol((sortie[1]),link[i]->Id);
- SetFloat((sortie[2]),link[i]->mass1->nbr);
- SetFloat((sortie[3]),link[i]->mass2->nbr);
- SetFloat((sortie[4]),link[i]->K1);
- SetFloat((sortie[5]),link[i]->D1);
- SetFloat((sortie[6]),link[i]->D2);
- delete link[i];
- link[i]=link[nb_link-1]; // copy last link
- nb_link--;
- ToOutAnything(1,S_Link_deleted,7,sortie);
- break;
+ if (argc != 1)
+ error("deleteLink : NoLink");
+
+ for (i=0; i<nb_link;i++)
+ if (link[i]->nbr == GetInt(argv[0])) {
+ SetFloat((sortie[0]),link[i]->nbr);
+ SetSymbol((sortie[1]),link[i]->Id);
+ SetFloat((sortie[2]),link[i]->mass1->nbr);
+ SetFloat((sortie[3]),link[i]->mass2->nbr);
+ SetFloat((sortie[4]),link[i]->K1);
+ SetFloat((sortie[5]),link[i]->D1);
+ SetFloat((sortie[6]),link[i]->D2);
+ delete link[i];
+ link[i]=link[nb_link-1]; // copy last link instead
+ nb_link--;
+ ToOutAnything(1,S_Link_deleted,7,sortie);
+ break;
}
}
+
// -------------------------------------------------------------- GET
// -------------------------------------------------------------------
void m_get(int argc,t_atom *argv)
diff --git a/msd3D/partiel.pd b/msd3D/partiel.pd
index 59f418e..99a6c7c 100644
--- a/msd3D/partiel.pd
+++ b/msd3D/partiel.pd
@@ -7,19 +7,19 @@
#X msg 172 61 \$3;
#X obj 260 170 mtof;
#X msg 174 167 \$1 50;
-#X obj 131 83 / 0.2;
#X msg 131 60 \$2;
-#X obj 172 104 * 9;
-#X obj 172 83 + 5;
-#X connect 0 0 9 0;
+#X obj 131 83 / 10;
+#X obj 172 84 * -10;
+#X obj 182 112 + 110;
+#X connect 0 0 8 0;
#X connect 0 0 5 0;
#X connect 2 0 3 1;
#X connect 3 0 1 0;
#X connect 4 0 3 0;
-#X connect 5 0 11 0;
+#X connect 5 0 10 0;
#X connect 6 0 4 0;
#X connect 7 0 2 0;
-#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 10 0 6 0;
-#X connect 11 0 10 0;
+#X connect 8 0 9 0;
+#X connect 9 0 7 0;
+#X connect 10 0 11 0;
+#X connect 11 0 6 0;