aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--msd2D/01_msd2Dtest.pd176
-rwxr-xr-xmsd2D/main.cpp6
-rwxr-xr-xmsd3D/main.cpp7
3 files changed, 91 insertions, 98 deletions
diff --git a/msd2D/01_msd2Dtest.pd b/msd2D/01_msd2Dtest.pd
index fc15b70..9871ee8 100644
--- a/msd2D/01_msd2Dtest.pd
+++ b/msd2D/01_msd2Dtest.pd
@@ -7,7 +7,17 @@
#X obj 553 732 world_light;
#X msg 633 562 reset \, create \, lighting 1 \, 1;
#X obj 53 499 msd2D --------------------------------;
-#X obj 122 15 cnv 15 500 270 empty empty empty 20 12 0 14 -262131 -66577
+#X text 309 594 WITH GEM;
+#X text 465 563 1 CREATE WINDOW -->;
+#X text 464 626 3 AND DESTROY IT! -->;
+#X text 464 594 2 DRAG THE STRUCTURE WITH THE MOUSE;
+#X obj 118 11 cnv 15 520 275 empty empty empty 20 12 0 14 -262131 -66577
+0;
+#X obj 43 291 cnv 15 595 80 empty empty empty 20 12 0 14 -261689 -66577
+0;
+#X obj 44 374 cnv 15 595 120 empty empty empty 20 12 0 14 -262131 -66577
+0;
+#X obj 47 556 cnv 15 400 200 empty empty empty 20 12 0 14 -261689 -66577
0;
#X obj 135 261 t a;
#X obj 135 20 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262131 -1
@@ -15,31 +25,22 @@
#X msg 207 71 reset;
#X text 173 21 reset;
#X obj 135 42 t b b b b b;
-#X msg 153 160 50 50;
-#X msg 135 235 link souple \$1 \$2 \$3 \$4 \$5;
-#X msg 170 140 mass mob 1 \$1 \$2 \$3;
-#X msg 189 91 mass fix 0 100 50 50;
-#X msg 171 116 100 20 10 \, 200 20 25;
+#X msg 135 226 link souple \$1 \$2 \$3 \$4 \$5;
#X msg 153 181 Xmax 100 \, Xmin 0 \, Ymax 100 \, Ymin 0;
-#X obj 50 292 cnv 15 572 80 empty empty empty 20 12 0 14 -261689 -66577
-0;
+#X text 413 87 CREATION : 3 MASSES \, 2 LINKS;
+#X msg 135 205 0 1 10 2.5 0.5 \, 1 2 5 0.5 0.9;
#X obj 53 300 gemhead;
#X obj 53 323 t b;
#X msg 53 345 bang \, get massesPos \, get linksPos;
-#X text 413 87 CREATION : 3 MASSES \, 2 LINKS;
#X text 292 313 COMPUTE AND GET ALL MASSES AND LINKS POSITIONS;
-#X obj 50 376 cnv 15 572 110 empty empty empty 20 12 0 14 -262131 -66577
-0;
-#X msg 82 442 forceX mob 100;
#X msg 85 383 setD souple 0.01;
#X msg 216 384 setK souple 1;
#X msg 85 403 setD souple 1;
#X msg 216 404 setK souple 2;
-#X msg 208 443 forceY mob 100;
-#X text 351 396 SET RIGIDITY AND VISCOSITY OF LINKS;
#X text 367 442 ADD FORCE ON ALL MOBILE MASSES;
-#X obj 47 547 cnv 15 400 200 empty empty empty 20 12 0 14 -261689 -66577
-0;
+#X text 351 396 SET RIGIDITY AND VISCOSITY OF LINKS;
+#X msg 82 442 forceX mob 100;
+#X msg 208 443 forceY mob 100;
#N canvas 643 123 605 590 massrender 0;
#X obj 127 22 inlet;
#X obj 48 203 translateXYZ;
@@ -67,56 +68,8 @@
#X connect 11 0 9 0;
#X connect 11 1 1 1;
#X restore 134 591 pd massrender;
-#N canvas 284 227 587 558 linkrender 0;
-#X obj 93 25 inlet;
-#X obj 93 117 / 12.5;
-#X obj 93 140 - 4;
-#X obj 147 118 / 12.5;
-#X obj 147 141 - 4;
-#X obj 35 134 gemhead;
-#X obj 44 222 separator;
-#X obj 44 192 any;
-#X obj 93 164 t b f;
-#X obj 93 69 unpack f f f f;
-#X obj 44 265 curve 2;
-#X obj 207 121 / 12.5;
-#X obj 207 144 - 4;
-#X obj 261 122 / 12.5;
-#X obj 261 145 - 4;
-#X obj 123 194 pack f f;
-#X msg 123 217 \$1 \$2 0;
-#X obj 207 193 pack f f;
-#X msg 207 216 \$1 \$2 0;
-#X connect 0 0 9 0;
-#X connect 1 0 2 0;
-#X connect 2 0 8 0;
-#X connect 3 0 4 0;
-#X connect 4 0 15 1;
-#X connect 5 0 7 1;
-#X connect 6 0 10 0;
-#X connect 7 0 6 0;
-#X connect 8 0 7 0;
-#X connect 8 1 15 0;
-#X connect 9 0 1 0;
-#X connect 9 1 3 0;
-#X connect 9 2 11 0;
-#X connect 9 3 13 0;
-#X connect 11 0 12 0;
-#X connect 12 0 17 0;
-#X connect 13 0 14 0;
-#X connect 14 0 17 1;
-#X connect 15 0 16 0;
-#X connect 16 0 10 1;
-#X connect 17 0 18 0;
-#X connect 18 0 10 2;
-#X restore 53 612 pd linkrender;
#X obj 53 562 route linksPos massesPos;
#X text 261 572 DISPLAY MASSES AND LINKS;
-#X text 309 594 WITH GEM;
-#X text 465 563 1 CREATE WINDOW -->;
-#X text 464 626 3 AND DESTROY IT! -->;
-#X text 464 594 2 DRAG THE STRUCTURE WITH THE MOUSE;
-#X msg 135 213 0 1 5 0.5 0.5 \, 1 2 1 0.5 0;
#N canvas 731 296 450 300 gemmouse 0;
#X obj 189 77 gemmouse;
#X obj 189 184 pack f f;
@@ -148,42 +101,85 @@
#X msg 53 695 posX fix \$1;
#X msg 53 716 posY fix \$2;
#X text 204 677 SET FIXED MASS TO MOUSE POSITION;
-#X connect 0 0 13 0;
+#X msg 171 134 mass mob 1 \$1 \$2 \$3;
+#X msg 171 113 100 50 90 \, 100 40 10;
+#N canvas 0 0 450 300 linkrender 0;
+#X obj 127 22 inlet;
+#X obj 127 86 / 12.5;
+#X obj 127 109 - 4;
+#X obj 187 87 / 12.5;
+#X obj 187 110 - 4;
+#X obj 64 114 gemhead;
+#X obj 48 177 separator;
+#X obj 48 153 any;
+#X obj 125 136 t b f;
+#X obj 127 57 unpack f f f f;
+#X obj 241 86 / 12.5;
+#X obj 241 109 - 4;
+#X obj 308 87 / 12.5;
+#X obj 308 110 - 4;
+#X obj 48 222 curve 2;
+#X obj 155 189 pack f f 0;
+#X obj 241 190 pack f f 0;
+#X connect 0 0 9 0;
+#X connect 1 0 2 0;
+#X connect 2 0 8 0;
+#X connect 3 0 4 0;
+#X connect 4 0 15 1;
+#X connect 5 0 7 1;
+#X connect 6 0 14 0;
+#X connect 7 0 6 0;
+#X connect 8 0 7 0;
+#X connect 8 1 15 0;
+#X connect 9 0 1 0;
+#X connect 9 1 3 0;
+#X connect 9 2 10 0;
+#X connect 9 3 12 0;
+#X connect 10 0 11 0;
+#X connect 11 0 16 0;
+#X connect 12 0 13 0;
+#X connect 13 0 16 1;
+#X connect 15 0 14 1;
+#X connect 16 0 14 2;
+#X restore 53 613 pd linkrender;
+#X msg 153 160 50 50;
+#X msg 189 91 mass fix 0 100 50 50;
+#X connect 0 0 20 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
#X connect 6 0 2 0;
#X connect 7 0 38 0;
#X connect 7 1 1 0;
-#X connect 9 0 7 0;
-#X connect 10 0 13 0;
-#X connect 11 0 9 0;
-#X connect 13 0 44 0;
-#X connect 13 1 14 0;
-#X connect 13 1 19 0;
-#X connect 13 2 18 0;
-#X connect 13 3 17 0;
-#X connect 13 4 11 0;
-#X connect 14 0 45 1;
-#X connect 15 0 9 0;
-#X connect 16 0 9 0;
-#X connect 17 0 9 0;
+#X connect 16 0 7 0;
+#X connect 17 0 20 0;
#X connect 18 0 16 0;
-#X connect 19 0 9 0;
-#X connect 21 0 22 0;
-#X connect 22 0 23 0;
-#X connect 23 0 7 0;
+#X connect 20 0 24 0;
+#X connect 20 1 48 0;
+#X connect 20 1 22 0;
+#X connect 20 2 46 0;
+#X connect 20 3 49 0;
+#X connect 20 4 18 0;
+#X connect 21 0 16 0;
+#X connect 22 0 16 0;
+#X connect 24 0 21 0;
+#X connect 25 0 26 0;
+#X connect 26 0 27 0;
#X connect 27 0 7 0;
-#X connect 28 0 7 0;
#X connect 29 0 7 0;
#X connect 30 0 7 0;
#X connect 31 0 7 0;
#X connect 32 0 7 0;
-#X connect 38 0 37 0;
-#X connect 38 1 36 0;
+#X connect 35 0 7 0;
+#X connect 36 0 7 0;
+#X connect 38 0 47 0;
+#X connect 38 1 37 0;
#X connect 38 2 1 0;
-#X connect 44 0 15 0;
-#X connect 45 0 47 0;
-#X connect 45 0 48 0;
+#X connect 40 0 42 0;
+#X connect 40 0 43 0;
+#X connect 41 0 40 0;
+#X connect 42 0 7 0;
+#X connect 43 0 7 0;
+#X connect 45 0 16 0;
#X connect 46 0 45 0;
-#X connect 47 0 7 0;
-#X connect 48 0 7 0;
+#X connect 48 0 40 1;
+#X connect 49 0 16 0;
diff --git a/msd2D/main.cpp b/msd2D/main.cpp
index f2ffb1d..37a7510 100755
--- a/msd2D/main.cpp
+++ b/msd2D/main.cpp
@@ -413,10 +413,8 @@ protected:
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]
- 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]->longy = link[nb_link]->mass1->posY - link[nb_link]->mass2->posY; // Ly[0]
+ link[nb_link]->longueur = sqrt(pow(link[nb_link]->longx,2)+pow(link[nb_link]->longy,2)); // L[0]
link[nb_link]->nbr = id_link; // id number
link[nb_link]->distance_old = link[nb_link]->longueur; // L[n-1]
switch (argc) {
diff --git a/msd3D/main.cpp b/msd3D/main.cpp
index 9d0c884..2deb80a 100755
--- a/msd3D/main.cpp
+++ b/msd3D/main.cpp
@@ -482,10 +482,9 @@ protected:
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]
- 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]->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));//L[0]
link[nb_link]->nbr = id_link; // id number
link[nb_link]->distance_old = link[nb_link]->longueur; // L[n-1]
switch (argc) {