aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <nimon@users.sourceforge.net>2005-04-26 16:10:08 +0000
committerN.N. <nimon@users.sourceforge.net>2005-04-26 16:10:08 +0000
commit2d390319a45282ffa6fcc5da41bbac81eb26fb3c (patch)
tree52905a8f94ff4ee05ed30ae6412f13944c7deacd
parent3d7f8e6f9f4c708c6130ea0a63c2eb139f34327a (diff)
MSD Version 0.04
svn path=/trunk/externals/nusmuk/; revision=2826
-rw-r--r--msd/02_imsdtest.pd73
-rw-r--r--msd/03_msdwave.pd124
-rwxr-xr-xmsd/main.cpp188
-rw-r--r--msd2D/02_msd2Dadd.pd468
-rw-r--r--msd2D/03_imsd2Dtest.pd109
-rw-r--r--msd2D/04_msd2Dperf.pd158
-rw-r--r--msd2D/help-msd2D.pd26
-rwxr-xr-xmsd2D/main.cpp249
-rw-r--r--msd3D/01_msd3Dtest.pd56
-rw-r--r--msd3D/02_msd3Dperf.pd122
-rw-r--r--msd3D/03_msd3Dmemb.pd48
-rw-r--r--msd3D/04_msd3Dfilet.pd114
-rw-r--r--msd3D/05_msd3Dvline.pd428
-rw-r--r--msd3D/help-msd3D.pd26
-rwxr-xr-xmsd3D/main.cpp234
-rw-r--r--msd3D/partiel.pd10
16 files changed, 1206 insertions, 1227 deletions
diff --git a/msd/02_imsdtest.pd b/msd/02_imsdtest.pd
index 280efc7..901b7a2 100644
--- a/msd/02_imsdtest.pd
+++ b/msd/02_imsdtest.pd
@@ -21,26 +21,22 @@
#X msg 218 129 100 65 \, 100 50 \, 100 35 \, 100 20;
#X obj 46 380 cnv 15 700 90 empty empty empty 20 12 0 14 -262131 -66577
0;
-#X msg 176 385 setD souple 0.01;
-#X msg 66 384 setK souple 1;
-#X msg 176 407 setD souple 1;
-#X msg 66 406 setK souple 2;
#X text 455 399 SET RIGIDITY AND VISCOSITY OF LINKS;
#X text 455 438 ADD FORCE ON ALL MOBILE MASSES;
#X msg 184 153 0;
#X obj 45 576 cnv 15 300 200 empty empty empty 20 12 0 14 -261689 -66577
0;
#X obj 88 590 vsl 15 128 0 100 0 0 empty empty empty 0 -8 0 8 -261689
--1 -1 6249 1;
+-1 -1 12166 1;
#X obj 111 590 vsl 15 128 0 100 0 0 empty empty empty 0 -8 0 8 -261689
--1 -1 0 1;
+-1 -1 7166 1;
#X obj 66 590 vsl 15 128 0 100 0 0 empty empty empty 0 -8 0 8 -261689
--1 -1 6860 1;
+-1 -1 9960 1;
#X msg 52 736 posX fix \$1;
#X obj 156 590 vsl 15 128 0 100 0 0 empty empty empty 0 -8 0 8 -261689
--1 -1 0 1;
+-1 -1 2370 1;
#X obj 134 590 vsl 15 128 0 100 0 0 empty empty empty 0 -8 0 8 -261689
--1 -1 0 1;
+-1 -1 12700 1;
#X text 199 638 MOVE FIRST SLIDER;
#X text 182 662 TO MOVE THE FIXED MASS;
#X msg 66 438 forceX mob 300;
@@ -51,42 +47,45 @@
#X msg 52 335 bang \, massesPosL;
#X obj 52 545 unpack f f f f f;
#X text 490 126 CREATION : 5 MASSES \, 1 iLINK;
-#X msg 184 223 iLink inter fix mob 10 2.5 0.5 5 20;
-#X connect 0 0 35 0;
-#X connect 2 0 37 0;
+#X msg 66 384 setK inter 1;
+#X msg 66 406 setK inter 2;
+#X msg 176 385 setD inter 0.01;
+#X msg 176 407 setD inter 1;
+#X msg 184 223 iLink inter fix mob 10 2.5 0.5 5;
+#X connect 0 0 31 0;
+#X connect 2 0 33 0;
#X connect 2 1 1 0;
#X connect 3 0 6 0;
-#X connect 6 0 38 0;
+#X connect 6 0 34 0;
#X connect 9 0 2 0;
-#X connect 10 0 35 0;
+#X connect 10 0 31 0;
#X connect 11 0 9 0;
#X connect 12 0 9 0;
#X connect 13 0 9 0;
#X connect 14 0 9 0;
#X connect 15 0 12 0;
-#X connect 17 0 2 0;
-#X connect 18 0 2 0;
-#X connect 19 0 2 0;
-#X connect 20 0 2 0;
-#X connect 23 0 3 0;
-#X connect 27 0 28 0;
-#X connect 28 0 2 0;
-#X connect 33 0 2 0;
+#X connect 19 0 3 0;
+#X connect 23 0 24 0;
+#X connect 24 0 2 0;
+#X connect 29 0 2 0;
+#X connect 30 0 2 0;
+#X connect 31 0 3 0;
+#X connect 31 1 19 0;
+#X connect 31 1 41 0;
+#X connect 31 2 13 0;
+#X connect 31 3 15 0;
+#X connect 31 4 14 0;
+#X connect 31 5 11 0;
+#X connect 33 0 35 0;
+#X connect 33 1 1 0;
#X connect 34 0 2 0;
-#X connect 35 0 33 0;
-#X connect 35 0 3 0;
-#X connect 35 1 23 0;
-#X connect 35 1 41 0;
-#X connect 35 2 13 0;
-#X connect 35 3 15 0;
-#X connect 35 4 14 0;
-#X connect 35 5 11 0;
-#X connect 37 0 39 0;
-#X connect 37 1 1 0;
+#X connect 35 0 23 0;
+#X connect 35 1 21 0;
+#X connect 35 2 22 0;
+#X connect 35 3 26 0;
+#X connect 35 4 25 0;
+#X connect 37 0 2 0;
#X connect 38 0 2 0;
-#X connect 39 0 27 0;
-#X connect 39 1 25 0;
-#X connect 39 2 26 0;
-#X connect 39 3 30 0;
-#X connect 39 4 29 0;
+#X connect 39 0 2 0;
+#X connect 40 0 2 0;
#X connect 41 0 9 0;
diff --git a/msd/03_msdwave.pd b/msd/03_msdwave.pd
index e09102f..e69ae1b 100644
--- a/msd/03_msdwave.pd
+++ b/msd/03_msdwave.pd
@@ -17,7 +17,7 @@
#X obj 48 153 any;
#X obj 127 136 t b f;
#X obj 127 57 unpack f f f;
-#X obj 45 283 cuboid 0.065 0.065 0.07;
+#X obj 48 283 cuboid 0.065 0.065 0.07;
#X connect 0 0 6 0;
#X connect 1 0 7 0;
#X connect 2 0 4 1;
@@ -34,19 +34,15 @@
#X obj 145 38 t b b b b;
#X text 418 114 Filet abstraction : x0 y0 stepx stepy ny nx;
#X obj 454 464 msd -------------;
-#X obj 568 488 print msd;
#X obj 33 497 msd2D --------------------------------;
-#X obj 294 522 print msd2D;
#X obj 305 254 route mass;
#X msg 305 275 mass msd1 \$1 \$2 \$5;
#X obj 145 253 route mass;
#X msg 145 274 mass msd2 \$1 \$2 \$3 \$4;
-#X obj 33 539 route massesPos;
+#X obj 33 517 route massesPos;
#X msg 33 343 bang \, get massesPos;
#X obj 33 321 t b b;
#X obj 265 600 pack f f f;
-#X obj 33 561 unpack f f;
-#X obj 33 583 t f b;
#N canvas 0 0 450 300 getmasses 0;
#X obj 84 33 inlet;
#X obj 91 71 t b b b;
@@ -66,8 +62,8 @@
#X connect 5 0 6 0;
#X connect 6 0 2 1;
#X connect 8 0 2 1;
-#X restore 63 698 pd getmasses;
-#X obj 454 507 route massesPosNo;
+#X restore 72 657 pd getmasses;
+#X obj 454 488 route massesPosNo;
#X msg 63 718 get massesPos \$1;
#X obj 602 334 rotateXYZ;
#X obj 651 450 vsl 15 128 0 4 0 0 empty empty empty 0 -8 0 8 -262131
@@ -94,7 +90,7 @@
#X msg 603 204 view 0 5 0 0 0 0 0 0 1;
#X msg 670 605 posX 39 \$1;
#X msg 689 625 posX 799 \$1;
-#X msg 708 645 posX 760 \$1;
+#X msg 707 645 posX 760 \$1;
#X text 734 508 Move corners to send a wave!;
#X text 194 703 Each time a mass2D position is send \, the corresponding
z is asked to the 1D model.;
@@ -106,64 +102,68 @@ z is asked to the 1D model.;
#X text 304 228 800 masses / 1540 links for each model;
#X text 31 455 The 2D model is just here to help display masses and
test synchronization between msd objects;
+#X obj 33 537 unpack f f f;
+#X obj 443 546 unpack f f;
+#X obj 173 598 f;
+#X obj 33 574 t b f;
#X connect 0 0 12 0;
#X connect 2 0 1 0;
-#X connect 3 0 31 0;
+#X connect 3 0 27 0;
+#X connect 5 0 16 0;
#X connect 5 0 18 0;
-#X connect 5 0 20 0;
#X connect 6 0 12 0;
#X connect 7 0 5 0;
-#X connect 8 0 24 0;
-#X connect 10 0 28 1;
-#X connect 10 0 45 1;
-#X connect 12 0 42 0;
-#X connect 12 0 43 0;
-#X connect 12 1 46 0;
-#X connect 12 2 45 0;
+#X connect 8 0 22 0;
+#X connect 10 0 24 1;
+#X connect 10 0 41 1;
+#X connect 12 0 38 0;
+#X connect 12 0 39 0;
+#X connect 12 1 42 0;
+#X connect 12 2 41 0;
#X connect 12 3 7 0;
#X connect 12 3 10 0;
-#X connect 14 0 29 0;
-#X connect 14 1 15 0;
-#X connect 16 0 22 0;
-#X connect 16 1 17 0;
+#X connect 14 0 25 0;
+#X connect 15 0 20 0;
+#X connect 16 0 17 0;
+#X connect 16 1 14 0;
+#X connect 17 0 14 0;
#X connect 18 0 19 0;
-#X connect 18 1 14 0;
-#X connect 19 0 14 0;
-#X connect 20 0 21 0;
-#X connect 20 1 16 0;
-#X connect 21 0 16 0;
-#X connect 22 0 26 0;
-#X connect 23 0 16 0;
-#X connect 24 0 23 0;
-#X connect 24 1 14 0;
-#X connect 25 0 9 0;
-#X connect 26 0 27 0;
-#X connect 26 1 25 1;
-#X connect 27 0 25 0;
-#X connect 27 1 28 0;
-#X connect 28 0 30 0;
-#X connect 29 0 25 2;
-#X connect 30 0 14 0;
-#X connect 31 0 4 0;
-#X connect 32 0 36 0;
-#X connect 33 0 48 0;
-#X connect 34 0 49 0;
-#X connect 35 0 50 0;
-#X connect 36 0 14 0;
-#X connect 37 0 31 1;
-#X connect 38 0 1 0;
-#X connect 39 0 1 0;
-#X connect 40 0 31 2;
-#X connect 41 0 1 0;
-#X connect 41 0 44 0;
-#X connect 42 0 16 0;
-#X connect 43 0 14 0;
-#X connect 44 0 39 0;
-#X connect 44 0 40 0;
-#X connect 44 0 37 0;
-#X connect 45 0 5 0;
-#X connect 46 0 5 0;
-#X connect 47 0 1 0;
-#X connect 48 0 14 0;
-#X connect 49 0 14 0;
-#X connect 50 0 14 0;
+#X connect 18 1 15 0;
+#X connect 19 0 15 0;
+#X connect 20 0 55 0;
+#X connect 21 0 15 0;
+#X connect 22 0 21 0;
+#X connect 22 1 14 0;
+#X connect 23 0 9 0;
+#X connect 25 0 56 0;
+#X connect 26 0 14 0;
+#X connect 27 0 4 0;
+#X connect 28 0 32 0;
+#X connect 29 0 44 0;
+#X connect 30 0 45 0;
+#X connect 31 0 46 0;
+#X connect 32 0 14 0;
+#X connect 33 0 27 1;
+#X connect 34 0 1 0;
+#X connect 35 0 1 0;
+#X connect 36 0 27 2;
+#X connect 37 0 1 0;
+#X connect 37 0 40 0;
+#X connect 38 0 15 0;
+#X connect 39 0 14 0;
+#X connect 40 0 35 0;
+#X connect 40 0 36 0;
+#X connect 40 0 33 0;
+#X connect 41 0 5 0;
+#X connect 42 0 5 0;
+#X connect 43 0 1 0;
+#X connect 44 0 14 0;
+#X connect 45 0 14 0;
+#X connect 46 0 14 0;
+#X connect 55 0 58 0;
+#X connect 55 1 57 1;
+#X connect 55 2 23 1;
+#X connect 56 1 23 2;
+#X connect 57 0 23 0;
+#X connect 58 0 57 0;
+#X connect 58 1 26 0;
diff --git a/msd/main.cpp b/msd/main.cpp
index 69dfbd5..f74ba3d 100755
--- a/msd/main.cpp
+++ b/msd/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.03 -- 21.04.2005
+ Version 0.04 -- 26.04.2005
*/
// include flext header
@@ -38,7 +38,7 @@
#include <math.h>
// define constants
-#define MSD_VERSION 0.03
+#define MSD_VERSION 0.04
#define nb_max_link 4000
#define nb_max_mass 4000
#define Id_length 20
@@ -135,7 +135,9 @@ protected:
t_float F=0,Fx=0,distance,vitesse, X_new;
t_int i;
struct _mass mass_1, mass_2;
-
+
+
+
for (i=0; i<nb_link; i++) {
// compute link forces
distance = link[i]->mass1->posX-link[i]->mass2->posX; // L[n] = x1 - x2
@@ -154,10 +156,10 @@ protected:
link[i]->mass2->forceX += Fx; // Fx2[n] = Fx
link[i]->mass2->forceX -= link[i]->D2*link[i]->mass2->speedX; // Fx2[n] = Fx2[n] - D2 * vx2[n-1]
link[i]->distance_old = distance; // L[n-1] = L[n]
-
-
}
+
+
for (i=0; i<nb_mass; i++)
// compute new masses position only if mobile = 1
if (mass[i]->mobile == 1) {
@@ -198,7 +200,7 @@ protected:
mass[nb_mass]->posX2 = GetFloat(argv[3]); // x[n-1]
mass[nb_mass]->forceX = 0; // Fx[n]
mass[nb_mass]->nbr = id_mass; // id number
- nb_mass++ ;
+ nb_mass++;
id_mass++;
nb_mass = min ( nb_max_mass -1, nb_mass );
SetFloat((sortie[0]),id_mass-1);
@@ -350,51 +352,65 @@ protected:
{
t_atom sortie[7], aux[2];
t_int i;
-
- 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==GetAInt(argv[1])) // pointer to mass1
- link[nb_link]->mass1 = mass[i];
- 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]
- 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; // 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 );
- SetFloat((sortie[0]),id_link-1);
- SetSymbol((sortie[1]),link[nb_link-1]->Id);
- SetFloat((sortie[2]),GetInt(argv[1]));
- SetFloat((sortie[3]),GetInt(argv[2]));
- 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);
+ t_mass *mass1 = NULL;
+ t_mass *mass2 = NULL;
+
+ if (argc < 6 || argc > 8)
+ error("link : Id Nomass1 Nomass2 K D1 D2 (Lmin Lmax)");
+
+ // check for existence of link masses:
+ for (i=0; i<nb_mass;i++)
+ if (mass[i]->nbr==GetInt(argv[1])) // pointer to mass1
+ // we found mass1
+ mass1 = mass[i];
+ else if (mass[i]->nbr==GetInt(argv[2])) // pointer to mass2
+ // ... and mass2
+ mass2 = mass[i];
+
+ if (mass1 and mass2)
+ {
+ link[nb_link] = new t_link; // New pointer
+ link[nb_link]->Id = GetSymbol(argv[0]); // ID
+ link[nb_link]->mass1 = mass1; // pointer to mass1
+ link[nb_link]->mass2 = mass2; // pointer to mass2
+ 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]
+ 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; // 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 );
+ SetFloat((sortie[0]),id_link-1);
+ SetSymbol((sortie[1]),link[nb_link-1]->Id);
+ SetFloat((sortie[2]),GetInt(argv[1]));
+ SetFloat((sortie[3]),GetInt(argv[2]));
+ 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);
+ }
+ else
+ error("link : Cannot create link: Not all masses for this link have been created yet.");
}
void m_ilink(int argc,t_atom *argv)
@@ -533,35 +549,39 @@ protected:
{
t_int i,j;
t_symbol *auxarg,*auxarg2, *auxtype;
- t_atom sortie[4];
+ t_atom sortie[3];
auxtype = GetSymbol(argv[0]);
auxarg = GetASymbol(argv[1]); //auxarg : & symbol, 0 else
if (argc == 1)
{
if (auxtype == S_massesPos) // get all masses positions
for (i=0; i<nb_mass; i++)
- {
- SetFloat(sortie[0],mass[i]->posX);
- ToOutAnything(0,S_massesPos,1,sortie);
+ {
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ ToOutAnything(0,S_massesPos,2,sortie);
}
else if (auxtype == S_massesForces) // get all masses forces
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- ToOutAnything(0,S_massesForces,1,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ ToOutAnything(0,S_massesForces,2,sortie);
}
else if (auxtype == S_linksPos) // get all links positions
for (i=0; i<nb_link; i++)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass2->posX);
- ToOutAnything(0,S_linksPos,2,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass2->posX);
+ ToOutAnything(0,S_linksPos,3,sortie);
}
else // get all masses speeds
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->speedX);
- ToOutAnything(0,S_massesSpeeds,1,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ ToOutAnything(0,S_massesSpeeds,2,sortie);
}
}
else if (auxtype == S_massesPos) // get mass positions
@@ -572,8 +592,9 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->posX);
- ToOutAnything(0,S_massesPosNo,1,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ ToOutAnything(0,S_massesPosNo,2,sortie);
}
}
else //symbol
@@ -585,8 +606,9 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->posX);
- ToOutAnything(0,S_massesPosId,1,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->posX);
+ ToOutAnything(0,S_massesPosId,2,sortie);
}
}
}
@@ -600,8 +622,9 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- ToOutAnything(0,S_massesForcesNo,1,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ ToOutAnything(0,S_massesForcesNo,2,sortie);
}
}
else //string
@@ -613,8 +636,9 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- ToOutAnything(0,S_massesForcesId,1,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ ToOutAnything(0,S_massesForcesId,2,sortie);
}
}
}
@@ -628,9 +652,10 @@ protected:
for (i=0;i<nb_link;i++)
if (link[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass2->posX);
- ToOutAnything(0,S_linksPosNo,2,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass2->posX);
+ ToOutAnything(0,S_linksPosNo,3,sortie);
}
}
else //symbol
@@ -642,9 +667,10 @@ protected:
{
if (auxarg2==link[i]->Id)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass2->posX);
- ToOutAnything(0,S_linksPosId,2,sortie);
+ SetSymbol(sortie[0],link[i]->Id);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass2->posX);
+ ToOutAnything(0,S_linksPosId,3,sortie);
}
}
}
@@ -658,8 +684,9 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->speedX);
- ToOutAnything(0,S_massesSpeedsNo,1,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ ToOutAnything(0,S_massesSpeedsNo,2,sortie);
}
}
else //symbol
@@ -671,8 +698,9 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->speedX);
- ToOutAnything(0,S_massesSpeedsId,1,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->speedX);
+ ToOutAnything(0,S_massesSpeedsId,2,sortie);
}
}
}
diff --git a/msd2D/02_msd2Dadd.pd b/msd2D/02_msd2Dadd.pd
index 56a3e4b..cf564d9 100644
--- a/msd2D/02_msd2Dadd.pd
+++ b/msd2D/02_msd2Dadd.pd
@@ -12,229 +12,213 @@
#X obj 481 343 world_light;
#X msg 191 106 mass fix 0 100 50 50;
#N canvas 177 95 946 729 synthese 0;
-#X obj 140 66 t b f;
-#X obj 55 219 print x1;
-#X obj 180 139 + 1;
-#X obj 160 107 f 0;
-#X obj 236 45 inlet;
-#X msg 214 315 \$1 50;
-#X obj 214 337 line~;
-#X obj 174 341 *~;
-#X msg 309 315 \$1 50;
-#X obj 309 337 line~;
-#X obj 269 341 *~;
-#X msg 402 317 \$1 50;
-#X obj 402 339 line~;
-#X obj 362 343 *~;
-#X msg 494 315 \$1 50;
-#X obj 494 337 line~;
-#X obj 454 341 *~;
-#X obj 311 389 dac~;
-#X obj 185 255 / 200;
-#X obj 311 261 / 200;
-#X obj 402 263 / 200;
-#X obj 499 261 / 500;
-#X msg 595 318 \$1 50;
-#X obj 595 340 line~;
-#X obj 555 344 *~;
-#X msg 690 318 \$1 50;
-#X obj 690 340 line~;
-#X obj 650 344 *~;
-#X msg 783 320 \$1 50;
-#X obj 783 342 line~;
-#X obj 743 346 *~;
-#X msg 875 318 \$1 50;
-#X obj 875 340 line~;
-#X obj 835 344 *~;
-#X obj 692 392 dac~;
-#X obj 172 285 osc~ 55;
-#X obj 268 285 osc~ 110;
-#X obj 453 286 osc~ 222;
-#X obj 566 258 / 500;
-#X obj 693 264 / 500;
-#X obj 240 161 pack f f f;
-#X obj 231 72 unpack f f;
-#X obj 236 219 unpack f f;
-#X obj 425 225 unpack f f;
-#X obj 611 222 unpack f f;
-#X obj 802 229 unpack f f;
-#X obj 880 264 / 1000;
-#X obj 783 266 / 1000;
-#X obj 180 164 mod 8;
-#X obj 517 190 route 0 2 1 3 4 5 6 7;
-#X msg 204 519 \$1 50;
-#X obj 204 541 line~;
-#X obj 164 545 *~;
-#X msg 299 519 \$1 50;
-#X obj 299 541 line~;
-#X obj 259 545 *~;
-#X msg 392 521 \$1 50;
-#X obj 392 543 line~;
-#X obj 352 547 *~;
-#X msg 484 519 \$1 50;
-#X obj 484 541 line~;
-#X obj 444 545 *~;
-#X obj 301 593 dac~;
-#X obj 175 459 / 200;
-#X obj 301 465 / 200;
-#X obj 392 467 / 200;
-#X obj 489 465 / 500;
-#X msg 585 522 \$1 50;
-#X obj 585 544 line~;
-#X obj 545 548 *~;
-#X msg 680 522 \$1 50;
-#X obj 680 544 line~;
-#X obj 640 548 *~;
-#X msg 773 524 \$1 50;
-#X obj 773 546 line~;
-#X obj 733 550 *~;
-#X msg 865 522 \$1 50;
-#X obj 865 544 line~;
-#X obj 825 548 *~;
-#X obj 682 596 dac~;
-#X obj 162 489 osc~ 55;
-#X obj 258 489 osc~ 110;
-#X obj 351 491 osc~ 166;
-#X obj 443 489 osc~ 222;
-#X obj 544 492 osc~ 444;
-#X obj 639 492 osc~ 890;
-#X obj 732 494 osc~ 1113;
-#X obj 824 492 osc~ 2229;
-#X obj 556 462 / 500;
-#X obj 683 468 / 500;
-#X obj 226 423 unpack f f;
-#X obj 415 429 unpack f f;
-#X obj 601 426 unpack f f;
-#X obj 792 433 unpack f f;
-#X obj 870 468 / 1000;
-#X obj 773 470 / 1000;
-#X obj 361 287 osc~ 165;
-#X obj 554 288 osc~ 267;
-#X obj 649 288 osc~ 311;
-#X obj 742 290 osc~ 444;
-#X obj 834 288 osc~ 509;
-#X connect 0 0 3 0;
-#X connect 0 1 40 1;
-#X connect 2 0 48 0;
-#X connect 3 0 2 0;
-#X connect 4 0 41 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 1;
-#X connect 7 0 17 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 1;
-#X connect 10 0 17 0;
-#X connect 10 0 17 1;
-#X connect 11 0 12 0;
+#X obj 268 68 inlet;
+#X msg -35 224 \$1 50;
+#X obj -35 246 line~;
+#X obj -75 250 *~;
+#X msg 60 224 \$1 50;
+#X obj 60 246 line~;
+#X obj 20 250 *~;
+#X msg 153 226 \$1 50;
+#X obj 153 248 line~;
+#X obj 113 252 *~;
+#X msg 245 224 \$1 50;
+#X obj 245 246 line~;
+#X obj 205 250 *~;
+#X obj 62 298 dac~;
+#X obj -64 164 / 200;
+#X obj 62 170 / 200;
+#X obj 153 172 / 200;
+#X obj 250 170 / 500;
+#X msg 346 227 \$1 50;
+#X obj 346 249 line~;
+#X obj 306 253 *~;
+#X msg 441 227 \$1 50;
+#X obj 441 249 line~;
+#X obj 401 253 *~;
+#X msg 534 229 \$1 50;
+#X obj 534 251 line~;
+#X obj 494 255 *~;
+#X msg 626 227 \$1 50;
+#X obj 626 249 line~;
+#X obj 586 253 *~;
+#X obj 443 301 dac~;
+#X obj -77 194 osc~ 55;
+#X obj 19 194 osc~ 110;
+#X obj 204 195 osc~ 222;
+#X obj 317 167 / 500;
+#X obj 444 173 / 500;
+#X obj -13 128 unpack f f;
+#X obj 176 134 unpack f f;
+#X obj 362 131 unpack f f;
+#X obj 553 138 unpack f f;
+#X obj 631 173 / 1000;
+#X obj 534 175 / 1000;
+#X msg -45 428 \$1 50;
+#X obj -45 450 line~;
+#X obj -85 454 *~;
+#X msg 50 428 \$1 50;
+#X obj 50 450 line~;
+#X obj 10 454 *~;
+#X msg 143 430 \$1 50;
+#X obj 143 452 line~;
+#X obj 103 456 *~;
+#X msg 235 428 \$1 50;
+#X obj 235 450 line~;
+#X obj 195 454 *~;
+#X obj 52 502 dac~;
+#X obj -74 368 / 200;
+#X obj 52 374 / 200;
+#X obj 143 376 / 200;
+#X obj 240 374 / 500;
+#X msg 336 431 \$1 50;
+#X obj 336 453 line~;
+#X obj 296 457 *~;
+#X msg 431 431 \$1 50;
+#X obj 431 453 line~;
+#X obj 391 457 *~;
+#X msg 524 433 \$1 50;
+#X obj 524 455 line~;
+#X obj 484 459 *~;
+#X msg 616 431 \$1 50;
+#X obj 616 453 line~;
+#X obj 576 457 *~;
+#X obj 433 505 dac~;
+#X obj -87 398 osc~ 55;
+#X obj 9 398 osc~ 110;
+#X obj 102 400 osc~ 166;
+#X obj 194 398 osc~ 222;
+#X obj 295 401 osc~ 444;
+#X obj 390 401 osc~ 890;
+#X obj 483 403 osc~ 1113;
+#X obj 575 401 osc~ 2229;
+#X obj 307 371 / 500;
+#X obj 434 377 / 500;
+#X obj -23 332 unpack f f;
+#X obj 166 338 unpack f f;
+#X obj 352 335 unpack f f;
+#X obj 543 342 unpack f f;
+#X obj 621 377 / 1000;
+#X obj 524 379 / 1000;
+#X obj 112 196 osc~ 165;
+#X obj 305 197 osc~ 267;
+#X obj 400 197 osc~ 311;
+#X obj 493 199 osc~ 444;
+#X obj 585 197 osc~ 509;
+#X obj 268 99 route 1 5 9 13 17 21 25 29;
+#X connect 0 0 93 0;
+#X connect 1 0 2 0;
+#X connect 2 0 3 1;
+#X connect 3 0 13 0;
+#X connect 4 0 5 0;
+#X connect 5 0 6 1;
+#X connect 6 0 13 0;
+#X connect 6 0 13 1;
+#X connect 7 0 8 0;
+#X connect 8 0 9 1;
+#X connect 9 0 13 0;
+#X connect 9 0 13 1;
+#X connect 10 0 11 0;
+#X connect 11 0 12 1;
#X connect 12 0 13 1;
-#X connect 13 0 17 0;
-#X connect 13 0 17 1;
-#X connect 14 0 15 0;
-#X connect 15 0 16 1;
-#X connect 16 0 17 1;
-#X connect 18 0 5 0;
-#X connect 19 0 8 0;
-#X connect 20 0 11 0;
-#X connect 21 0 14 0;
-#X connect 22 0 23 0;
-#X connect 23 0 24 1;
-#X connect 24 0 34 0;
-#X connect 25 0 26 0;
-#X connect 26 0 27 1;
-#X connect 27 0 34 0;
-#X connect 27 0 34 1;
-#X connect 28 0 29 0;
+#X connect 14 0 1 0;
+#X connect 15 0 4 0;
+#X connect 16 0 7 0;
+#X connect 17 0 10 0;
+#X connect 18 0 19 0;
+#X connect 19 0 20 1;
+#X connect 20 0 30 0;
+#X connect 21 0 22 0;
+#X connect 22 0 23 1;
+#X connect 23 0 30 0;
+#X connect 23 0 30 1;
+#X connect 24 0 25 0;
+#X connect 25 0 26 1;
+#X connect 26 0 30 0;
+#X connect 26 0 30 1;
+#X connect 27 0 28 0;
+#X connect 28 0 29 1;
#X connect 29 0 30 1;
-#X connect 30 0 34 0;
-#X connect 30 0 34 1;
-#X connect 31 0 32 0;
-#X connect 32 0 33 1;
-#X connect 33 0 34 1;
-#X connect 35 0 7 0;
-#X connect 36 0 10 0;
+#X connect 31 0 3 0;
+#X connect 32 0 6 0;
+#X connect 33 0 12 0;
+#X connect 34 0 18 0;
+#X connect 35 0 21 0;
+#X connect 36 0 14 0;
+#X connect 36 1 15 0;
#X connect 37 0 16 0;
-#X connect 38 0 22 0;
-#X connect 39 0 25 0;
-#X connect 40 0 49 0;
-#X connect 41 0 0 0;
-#X connect 41 1 40 2;
-#X connect 42 0 18 0;
-#X connect 42 1 19 0;
-#X connect 43 0 20 0;
-#X connect 43 1 21 0;
-#X connect 44 0 38 0;
-#X connect 44 1 39 0;
-#X connect 45 0 47 0;
-#X connect 45 1 46 0;
-#X connect 46 0 31 0;
-#X connect 47 0 28 0;
-#X connect 48 0 3 1;
-#X connect 48 0 40 0;
-#X connect 49 0 42 0;
-#X connect 49 1 43 0;
-#X connect 49 2 44 0;
-#X connect 49 3 45 0;
-#X connect 49 4 90 0;
-#X connect 49 5 91 0;
-#X connect 49 6 92 0;
-#X connect 49 7 93 0;
-#X connect 50 0 51 0;
-#X connect 51 0 52 1;
-#X connect 52 0 62 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 1;
-#X connect 55 0 62 0;
-#X connect 55 0 62 1;
-#X connect 56 0 57 0;
-#X connect 57 0 58 1;
-#X connect 58 0 62 0;
-#X connect 58 0 62 1;
+#X connect 37 1 17 0;
+#X connect 38 0 34 0;
+#X connect 38 1 35 0;
+#X connect 39 0 41 0;
+#X connect 39 1 40 0;
+#X connect 40 0 27 0;
+#X connect 41 0 24 0;
+#X connect 42 0 43 0;
+#X connect 43 0 44 1;
+#X connect 44 0 54 0;
+#X connect 45 0 46 0;
+#X connect 46 0 47 1;
+#X connect 47 0 54 0;
+#X connect 47 0 54 1;
+#X connect 48 0 49 0;
+#X connect 49 0 50 1;
+#X connect 50 0 54 0;
+#X connect 50 0 54 1;
+#X connect 51 0 52 0;
+#X connect 52 0 53 1;
+#X connect 53 0 54 1;
+#X connect 55 0 42 0;
+#X connect 56 0 45 0;
+#X connect 57 0 48 0;
+#X connect 58 0 51 0;
#X connect 59 0 60 0;
#X connect 60 0 61 1;
-#X connect 61 0 62 1;
-#X connect 63 0 50 0;
-#X connect 64 0 53 0;
-#X connect 65 0 56 0;
-#X connect 66 0 59 0;
-#X connect 67 0 68 0;
-#X connect 68 0 69 1;
-#X connect 69 0 79 0;
-#X connect 70 0 71 0;
-#X connect 71 0 72 1;
-#X connect 72 0 79 0;
-#X connect 72 0 79 1;
-#X connect 73 0 74 0;
-#X connect 74 0 75 1;
-#X connect 75 0 79 0;
-#X connect 75 0 79 1;
-#X connect 76 0 77 0;
-#X connect 77 0 78 1;
-#X connect 78 0 79 1;
-#X connect 80 0 52 0;
-#X connect 81 0 55 0;
-#X connect 82 0 58 0;
-#X connect 83 0 61 0;
-#X connect 84 0 69 0;
-#X connect 85 0 72 0;
-#X connect 86 0 75 0;
-#X connect 87 0 78 0;
-#X connect 88 0 67 0;
-#X connect 89 0 70 0;
-#X connect 90 0 63 0;
-#X connect 90 1 64 0;
-#X connect 91 0 65 0;
-#X connect 91 1 66 0;
-#X connect 92 0 88 0;
-#X connect 92 1 89 0;
-#X connect 93 0 95 0;
-#X connect 93 1 94 0;
-#X connect 94 0 76 0;
-#X connect 95 0 73 0;
-#X connect 96 0 13 0;
-#X connect 97 0 24 0;
-#X connect 98 0 27 0;
-#X connect 99 0 30 0;
-#X connect 100 0 33 0;
+#X connect 61 0 71 0;
+#X connect 62 0 63 0;
+#X connect 63 0 64 1;
+#X connect 64 0 71 0;
+#X connect 64 0 71 1;
+#X connect 65 0 66 0;
+#X connect 66 0 67 1;
+#X connect 67 0 71 0;
+#X connect 67 0 71 1;
+#X connect 68 0 69 0;
+#X connect 69 0 70 1;
+#X connect 70 0 71 1;
+#X connect 72 0 44 0;
+#X connect 73 0 47 0;
+#X connect 74 0 50 0;
+#X connect 75 0 53 0;
+#X connect 76 0 61 0;
+#X connect 77 0 64 0;
+#X connect 78 0 67 0;
+#X connect 79 0 70 0;
+#X connect 80 0 59 0;
+#X connect 81 0 62 0;
+#X connect 82 0 55 0;
+#X connect 82 1 56 0;
+#X connect 83 0 57 0;
+#X connect 83 1 58 0;
+#X connect 84 0 80 0;
+#X connect 84 1 81 0;
+#X connect 85 0 87 0;
+#X connect 85 1 86 0;
+#X connect 86 0 68 0;
+#X connect 87 0 65 0;
+#X connect 88 0 9 0;
+#X connect 89 0 20 0;
+#X connect 90 0 23 0;
+#X connect 91 0 26 0;
+#X connect 92 0 29 0;
+#X connect 93 0 36 0;
+#X connect 93 1 37 0;
+#X connect 93 2 38 0;
+#X connect 93 3 39 0;
+#X connect 93 4 82 0;
+#X connect 93 5 83 0;
+#X connect 93 6 84 0;
+#X connect 93 7 85 0;
#X restore 230 679 pd synthese;
#N canvas 311 224 316 299 gemmouse 0;
#X obj 114 29 gemmouse;
@@ -279,21 +263,21 @@
#X obj 64 114 gemhead;
#X obj 48 177 separator;
#X obj 48 153 any;
-#X obj 127 57 unpack f f;
#X obj 125 136 t b f;
-#X connect 0 0 10 0;
+#X obj 127 57 unpack f f f;
+#X connect 0 0 11 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
-#X connect 4 0 11 0;
+#X connect 4 0 10 0;
#X connect 5 0 6 0;
#X connect 6 0 1 2;
#X connect 7 0 9 1;
#X connect 8 0 1 0;
#X connect 9 0 8 0;
-#X connect 10 0 3 0;
-#X connect 10 1 5 0;
-#X connect 11 0 9 0;
-#X connect 11 1 1 1;
+#X connect 10 0 9 0;
+#X connect 10 1 1 1;
+#X connect 11 1 3 0;
+#X connect 11 2 5 0;
#X restore 141 657 pd massrender;
#N canvas 284 227 587 558 linkrender 0;
#X obj 93 25 inlet;
@@ -305,7 +289,6 @@
#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;
@@ -315,28 +298,29 @@
#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 obj 93 69 unpack f f f f f;
+#X connect 0 0 18 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 4 0 14 1;
#X connect 5 0 7 1;
-#X connect 6 0 10 0;
+#X connect 6 0 9 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 connect 8 1 14 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 14 0 15 0;
+#X connect 15 0 9 1;
+#X connect 16 0 17 0;
+#X connect 17 0 9 2;
+#X connect 18 1 1 0;
+#X connect 18 2 3 0;
+#X connect 18 3 10 0;
+#X connect 18 4 12 0;
#X restore 52 678 pd linkrender;
#X msg 221 231 mass mob 1 \$1 \$2 \$3;
#X obj 393 181 random 100;
diff --git a/msd2D/03_imsd2Dtest.pd b/msd2D/03_imsd2Dtest.pd
index 69c2d74..74fbbbb 100644
--- a/msd2D/03_imsd2Dtest.pd
+++ b/msd2D/03_imsd2Dtest.pd
@@ -29,33 +29,6 @@
#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;
-#N canvas 643 123 605 590 massrender 0;
-#X obj 127 22 inlet;
-#X obj 48 203 translateXYZ;
-#X obj 127 86 / 12.5;
-#X obj 127 109 - 4;
-#X obj 192 87 / 12.5;
-#X obj 192 110 - 4;
-#X obj 64 114 gemhead;
-#X obj 48 177 separator;
-#X obj 48 153 any;
-#X obj 127 57 unpack f f;
-#X obj 125 136 t b f;
-#X obj 48 229 sphere 0.2;
-#X connect 0 0 9 0;
-#X connect 1 0 11 0;
-#X connect 2 0 3 0;
-#X connect 3 0 10 0;
-#X connect 4 0 5 0;
-#X connect 5 0 1 2;
-#X connect 6 0 8 1;
-#X connect 7 0 1 0;
-#X connect 8 0 7 0;
-#X connect 9 0 2 0;
-#X connect 9 1 4 0;
-#X connect 10 0 8 0;
-#X connect 10 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;
@@ -66,7 +39,6 @@
#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;
@@ -76,28 +48,29 @@
#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 obj 93 69 unpack f f f f f;
+#X connect 0 0 18 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 4 0 14 1;
#X connect 5 0 7 1;
-#X connect 6 0 10 0;
+#X connect 6 0 9 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 connect 8 1 14 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 14 0 15 0;
+#X connect 15 0 9 1;
+#X connect 16 0 17 0;
+#X connect 17 0 9 2;
+#X connect 18 1 1 0;
+#X connect 18 2 3 0;
+#X connect 18 3 10 0;
+#X connect 18 4 12 0;
#X restore 53 614 pd linkrender;
#X text 465 563 1 CREATE WINDOW -->;
#X text 464 626 3 AND DESTROY IT! -->;
@@ -150,42 +123,42 @@
#X msg 84 403 setD2 inter 0;
#X msg 216 384 setK inter 1;
#X msg 216 404 setK inter 2;
-#X connect 0 0 36 0;
+#X connect 0 0 35 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
#X connect 6 0 2 0;
-#X connect 7 0 42 0;
+#X connect 7 0 41 0;
#X connect 7 1 1 0;
#X connect 9 0 7 0;
-#X connect 10 0 36 0;
+#X connect 10 0 35 0;
#X connect 11 0 9 0;
-#X connect 13 0 30 1;
+#X connect 13 0 29 1;
#X connect 14 0 9 0;
#X connect 15 0 9 0;
#X connect 17 0 18 0;
-#X connect 18 0 43 0;
+#X connect 18 0 42 0;
#X connect 20 0 7 0;
#X connect 21 0 7 0;
-#X connect 30 0 32 0;
-#X connect 30 0 33 0;
-#X connect 31 0 30 0;
+#X connect 29 0 31 0;
+#X connect 29 0 32 0;
+#X connect 30 0 29 0;
+#X connect 31 0 7 0;
#X connect 32 0 7 0;
-#X connect 33 0 7 0;
-#X connect 35 0 9 0;
-#X connect 36 0 37 0;
-#X connect 36 1 40 0;
-#X connect 36 2 13 0;
-#X connect 36 2 15 0;
-#X connect 36 3 38 0;
-#X connect 36 4 14 0;
-#X connect 36 5 11 0;
-#X connect 37 0 9 0;
-#X connect 38 0 35 0;
-#X connect 40 0 9 0;
-#X connect 41 0 5 1;
-#X connect 42 0 26 0;
-#X connect 43 0 7 0;
+#X connect 34 0 9 0;
+#X connect 35 0 36 0;
+#X connect 35 1 39 0;
+#X connect 35 2 13 0;
+#X connect 35 2 15 0;
+#X connect 35 3 37 0;
+#X connect 35 4 14 0;
+#X connect 35 5 11 0;
+#X connect 36 0 9 0;
+#X connect 37 0 34 0;
+#X connect 39 0 9 0;
+#X connect 40 0 5 1;
+#X connect 41 0 25 0;
+#X connect 42 0 7 0;
+#X connect 45 0 7 0;
#X connect 46 0 7 0;
#X connect 47 0 7 0;
#X connect 48 0 7 0;
-#X connect 49 0 7 0;
diff --git a/msd2D/04_msd2Dperf.pd b/msd2D/04_msd2Dperf.pd
index 8f90db2..b149184 100644
--- a/msd2D/04_msd2Dperf.pd
+++ b/msd2D/04_msd2Dperf.pd
@@ -7,9 +7,8 @@
#X text 205 34 reset;
#X msg 281 402 forceX mob 100;
#X obj 167 55 t b b b b b;
-#X obj 313 658 print msd;
#X obj 52 583 msd2D --------------------------------;
-#X msg 461 409 0 \, destroy;
+#X msg 460 409 0 \, destroy;
#X obj 481 320 gemhead;
#X obj 481 343 world_light;
#X msg 221 104 mass fix 0 100 50 50;
@@ -52,21 +51,21 @@
#X obj 64 114 gemhead;
#X obj 48 177 separator;
#X obj 48 153 any;
-#X obj 127 57 unpack f f;
#X obj 125 136 t b f;
-#X connect 0 0 10 0;
+#X obj 127 57 unpack f f f;
+#X connect 0 0 11 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
-#X connect 4 0 11 0;
+#X connect 4 0 10 0;
#X connect 5 0 6 0;
#X connect 6 0 1 2;
#X connect 7 0 9 1;
#X connect 8 0 1 0;
#X connect 9 0 8 0;
-#X connect 10 0 3 0;
-#X connect 10 1 5 0;
-#X connect 11 0 9 0;
-#X connect 11 1 1 1;
+#X connect 10 0 9 0;
+#X connect 10 1 1 1;
+#X connect 11 1 3 0;
+#X connect 11 2 5 0;
#X restore 133 635 pd massrender;
#N canvas 284 227 587 558 linkrender 0;
#X obj 93 25 inlet;
@@ -78,8 +77,6 @@
#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;
@@ -88,28 +85,30 @@
#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 obj 44 265 curve 2;
+#X obj 94 70 unpack f f f f f;
+#X connect 0 0 18 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 4 0 13 1;
#X connect 5 0 7 1;
-#X connect 6 0 10 0;
+#X connect 6 0 17 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 8 1 13 0;
+#X connect 9 0 10 0;
+#X connect 10 0 15 0;
#X connect 11 0 12 0;
-#X connect 12 0 17 0;
+#X connect 12 0 15 1;
#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 connect 16 0 17 2;
+#X connect 18 1 1 0;
+#X connect 18 2 3 0;
+#X connect 18 3 9 0;
+#X connect 18 4 11 0;
#X restore 52 656 pd linkrender;
#X msg 211 170 mass mob 1 \$1 \$2 \$3;
#X obj 379 180 random 100;
@@ -131,77 +130,76 @@
#X obj 380 134 t b b b;
#X msg 167 284 link souple \$1 \$2 100 0.5 0.5;
#X obj 52 278 gemhead;
-#X obj 413 432 gemwin;
+#X obj 460 458 gemwin;
#X msg 52 335 bang \, get massesPos \, get linksPos;
#X obj 52 606 route linksPos massesPos;
-#X msg 465 433 view 0 0 4 0 0 0 0 1 0;
+#X msg 460 433 view 0 0 4 0 0 0 0 1 0;
#X msg 281 425 forceX mob -100;
#X obj 380 109 repeat 500;
#X obj 592 105 repeat 500;
#X msg 445 53 500;
#X text 478 52 change number of mass to test performance;
-#X connect 0 0 8 0;
+#X connect 0 0 7 0;
#X connect 1 0 6 0;
#X connect 2 0 0 0;
#X connect 3 0 6 0;
-#X connect 5 0 8 0;
-#X connect 6 0 51 0;
+#X connect 5 0 7 0;
+#X connect 6 0 50 0;
+#X connect 6 1 18 0;
#X connect 6 1 19 0;
-#X connect 6 1 20 0;
-#X connect 6 2 50 0;
-#X connect 6 3 12 0;
+#X connect 6 2 49 0;
+#X connect 6 3 11 0;
#X connect 6 4 2 0;
-#X connect 6 4 39 0;
-#X connect 6 4 31 0;
-#X connect 6 4 27 0;
+#X connect 6 4 38 0;
#X connect 6 4 30 0;
-#X connect 8 0 47 0;
-#X connect 8 1 7 0;
-#X connect 9 0 45 0;
-#X connect 10 0 11 0;
-#X connect 12 0 0 0;
-#X connect 13 0 15 1;
+#X connect 6 4 26 0;
+#X connect 6 4 29 0;
+#X connect 7 0 46 0;
+#X connect 8 0 44 0;
+#X connect 9 0 10 0;
+#X connect 11 0 0 0;
+#X connect 12 0 14 1;
+#X connect 13 0 15 0;
#X connect 14 0 16 0;
-#X connect 15 0 17 0;
-#X connect 15 0 18 0;
-#X connect 16 0 15 0;
-#X connect 17 0 8 0;
-#X connect 18 0 8 0;
-#X connect 19 0 15 0;
-#X connect 20 0 0 0;
+#X connect 14 0 17 0;
+#X connect 15 0 14 0;
+#X connect 16 0 7 0;
+#X connect 17 0 7 0;
+#X connect 18 0 14 0;
+#X connect 19 0 0 0;
+#X connect 20 0 44 0;
#X connect 21 0 45 0;
-#X connect 22 0 46 0;
-#X connect 25 0 0 0;
-#X connect 26 0 33 2;
-#X connect 27 0 26 0;
-#X connect 28 0 33 1;
-#X connect 29 0 32 0;
+#X connect 24 0 0 0;
+#X connect 25 0 32 2;
+#X connect 26 0 25 0;
+#X connect 27 0 32 1;
+#X connect 28 0 31 0;
+#X connect 29 0 27 0;
#X connect 30 0 28 0;
-#X connect 31 0 29 0;
-#X connect 32 0 33 0;
-#X connect 33 0 25 0;
-#X connect 34 0 40 0;
-#X connect 35 0 37 0;
-#X connect 35 0 38 0;
+#X connect 31 0 32 0;
+#X connect 32 0 24 0;
+#X connect 33 0 39 0;
+#X connect 34 0 36 0;
+#X connect 34 0 37 0;
+#X connect 34 0 39 1;
#X connect 35 0 40 1;
-#X connect 36 0 41 1;
-#X connect 37 0 36 1;
-#X connect 38 0 41 0;
-#X connect 38 1 36 0;
-#X connect 39 0 40 1;
-#X connect 40 0 35 0;
-#X connect 41 0 43 0;
-#X connect 42 0 29 0;
-#X connect 42 1 28 0;
-#X connect 42 2 26 0;
-#X connect 43 0 0 0;
-#X connect 44 0 22 0;
-#X connect 46 0 8 0;
-#X connect 47 0 24 0;
-#X connect 47 1 23 0;
-#X connect 48 0 45 0;
-#X connect 49 0 8 0;
-#X connect 50 0 42 0;
-#X connect 51 0 34 0;
-#X connect 52 0 50 1;
-#X connect 52 0 51 1;
+#X connect 36 0 35 1;
+#X connect 37 0 40 0;
+#X connect 37 1 35 0;
+#X connect 38 0 39 1;
+#X connect 39 0 34 0;
+#X connect 40 0 42 0;
+#X connect 41 0 28 0;
+#X connect 41 1 27 0;
+#X connect 41 2 25 0;
+#X connect 42 0 0 0;
+#X connect 43 0 21 0;
+#X connect 45 0 7 0;
+#X connect 46 0 23 0;
+#X connect 46 1 22 0;
+#X connect 47 0 44 0;
+#X connect 48 0 7 0;
+#X connect 49 0 41 0;
+#X connect 50 0 33 0;
+#X connect 51 0 49 1;
+#X connect 51 0 50 1;
diff --git a/msd2D/help-msd2D.pd b/msd2D/help-msd2D.pd
index 37bc116..40623a6 100644
--- a/msd2D/help-msd2D.pd
+++ b/msd2D/help-msd2D.pd
@@ -14,7 +14,6 @@
#X text 235 367 Compute new masses positions;
#X obj 61 403 cnv 15 610 210 empty empty DYNAMIC_SETTING 20 12 0 14
-262131 -66577 0;
-#X text 350 449 \$1 : Id (symbol);
#X text 350 467 \$2 : New value;
#X text 348 503 \$1 : Id (symbol);
#X text 348 521 \$2 : New value;
@@ -60,18 +59,19 @@ their;
#X text 347 538 Set minimimum and maximum X \, Y of masses;
#X msg 84 538 Xmin \$1 \, Xmax \$1 \, Ymin \$1 \, Ymax \$1;
#X text 334 271 \$4 \, \$5 : initial position;
-#X connect 1 0 46 0;
-#X connect 8 0 46 0;
-#X connect 15 0 46 0;
-#X connect 18 0 46 0;
-#X connect 20 0 46 0;
-#X connect 21 0 46 0;
-#X connect 24 0 46 0;
-#X connect 28 0 46 0;
-#X connect 31 0 46 0;
-#X connect 40 0 46 0;
-#X connect 43 0 46 0;
-#X connect 48 0 46 0;
+#X text 350 449 \$1 : Id (symbol) or No;
+#X connect 1 0 45 0;
+#X connect 8 0 45 0;
+#X connect 14 0 45 0;
+#X connect 17 0 45 0;
+#X connect 19 0 45 0;
+#X connect 20 0 45 0;
+#X connect 23 0 45 0;
+#X connect 27 0 45 0;
+#X connect 30 0 45 0;
+#X connect 39 0 45 0;
+#X connect 42 0 45 0;
+#X connect 47 0 45 0;
#X restore 221 312 pd masses;
#X text 75 312 HELP on masses --->;
#X text 74 343 HELP on links --->;
diff --git a/msd2D/main.cpp b/msd2D/main.cpp
index 4ab0dff..ccefdc6 100755
--- a/msd2D/main.cpp
+++ b/msd2D/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.03 -- 21.04.2005
+ Version 0.04 -- 26.04.2005
*/
// include flext header
@@ -38,7 +38,7 @@
#include <math.h>
// define constants
-#define MSD2D_VERSION 0.03
+#define MSD2D_VERSION 0.04
#define nb_max_link 4000
#define nb_max_mass 4000
#define Id_length 20
@@ -265,35 +265,52 @@ protected:
{
// displace mass(es) named Id to a certain position
t_int i;
- const t_symbol *sym = GetSymbol(argv[0]);
+ const t_symbol *sym = GetASymbol(argv[0]);
if (argc != 2)
- error("posX : Idmass value");
+ error("posX : Id/Nomass 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 = GetAFloat(argv[1]);
- }
+ if (sym ==0)
+ for (i=0; i<nb_mass;i++)
+ {
+ if (GetInt(argv[0]) == mass[i]->nbr) {
+ mass[i]->posX = GetFloat(argv[1]);
+ break;
+ }
+ }
+ else
+ for (i=0; i<nb_mass;i++)
+ {
+ if (sym == mass[i]->Id)
+ mass[i]->posX = GetFloat(argv[1]);
+ }
}
void m_posY(int argc,t_atom *argv)
{
// displace mass(es) named Id to a certain position
t_int i;
- const t_symbol *sym = GetSymbol(argv[0]);
+ const t_symbol *sym = GetASymbol(argv[0]);
if (argc != 2)
- error("posY : Idmass value");
+ error("posY : Id/Nomass value");
if (GetFloat(argv[1]) < Ymax && GetFloat(argv[1]) > Ymin)
- for (i=0; i<nb_mass;i++)
- {
- if (sym == mass[i]->Id)
- mass[i]->posY = GetFloat(argv[1]);
- }
-
+ if (sym ==0)
+ for (i=0; i<nb_mass;i++)
+ {
+ if (GetInt(argv[0]) == mass[i]->nbr) {
+ mass[i]->posY = GetFloat(argv[1]);
+ break;
+ }
+ }
+ else
+ for (i=0; i<nb_mass;i++)
+ {
+ if (sym == mass[i]->Id)
+ mass[i]->posY = GetFloat(argv[1]);
+ }
}
void m_set_mobile(int argc,t_atom *argv)
@@ -410,49 +427,63 @@ protected:
{
t_atom sortie[7], aux[2];
t_int i;
-
- 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==GetAInt(argv[1])) // pointer to mass1
- link[nb_link]->mass1 = mass[i];
- 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]->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) {
- 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 );
- SetFloat((sortie[0]),id_link-1);
- SetSymbol((sortie[1]),link[nb_link-1]->Id);
- SetFloat((sortie[2]),GetInt(argv[1]));
- SetFloat((sortie[3]),GetInt(argv[2]));
- 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);
+ t_mass *mass1 = NULL;
+ t_mass *mass2 = NULL;
+
+ if (argc < 6 || argc > 8)
+ error("link : Id Nomass1 Nomass2 K D1 D2 (Lmin Lmax)");
+
+ // check for existence of link masses:
+ for (i=0; i<nb_mass;i++)
+ if (mass[i]->nbr==GetInt(argv[1])) // pointer to mass1
+ // we found mass1
+ mass1 = mass[i];
+ else if (mass[i]->nbr==GetInt(argv[2])) // pointer to mass2
+ // ... and mass2
+ mass2 = mass[i];
+
+ if (mass1 and mass2)
+ {
+ link[nb_link] = new t_link; // New pointer
+ link[nb_link]->Id = GetSymbol(argv[0]); // ID
+ link[nb_link]->mass1 = mass1; // pointer to mass1
+ link[nb_link]->mass2 = mass2; // pointer to mass2
+ 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]->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) {
+ 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 );
+ SetFloat((sortie[0]),id_link-1);
+ SetSymbol((sortie[1]),link[nb_link-1]->Id);
+ SetFloat((sortie[2]),GetInt(argv[1]));
+ SetFloat((sortie[3]),GetInt(argv[2]));
+ 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);
+ }
+ else
+ error("link : Cannot create link: Not all masses for this link have been created yet.");
}
void m_ilink(int argc,t_atom *argv)
@@ -589,7 +620,7 @@ protected:
{
t_int i,j;
t_symbol *auxarg,*auxarg2, *auxtype;
- t_atom sortie[4];
+ t_atom sortie[5];
auxtype = GetSymbol(argv[0]);
auxarg = GetASymbol(argv[1]); //auxarg : & symbol, 0 else
@@ -598,32 +629,36 @@ protected:
if (auxtype == S_massesPos) // get all masses positions
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- ToOutAnything(0,S_massesPos,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ ToOutAnything(0,S_massesPos,3,sortie);
}
else if (auxtype == S_massesForces) // get all masses forces
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- ToOutAnything(0,S_massesForces,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ ToOutAnything(0,S_massesForces,3,sortie);
}
else if (auxtype == S_linksPos) // get all links positions
for (i=0; i<nb_link; i++)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass2->posX);
- SetFloat(sortie[3],link[i]->mass2->posY);
- ToOutAnything(0,S_linksPos,4,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass2->posX);
+ SetFloat(sortie[4],link[i]->mass2->posY);
+ ToOutAnything(0,S_linksPos,5,sortie);
}
else // get all masses speeds
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- ToOutAnything(0,S_massesSpeeds,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ ToOutAnything(0,S_massesSpeeds,3,sortie);
}
}
else if (auxtype == S_massesPos) // get mass positions
@@ -634,9 +669,10 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- ToOutAnything(0,S_massesPosNo,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ ToOutAnything(0,S_massesPosNo,3,sortie);
}
}
else //symbol
@@ -648,9 +684,10 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- ToOutAnything(0,S_massesPosId,2,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ ToOutAnything(0,S_massesPosId,3,sortie);
}
}
}
@@ -664,9 +701,10 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- ToOutAnything(0,S_massesForcesNo,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ ToOutAnything(0,S_massesForcesNo,3,sortie);
}
}
else //symbol
@@ -678,9 +716,10 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- ToOutAnything(0,S_massesForcesId,2,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ ToOutAnything(0,S_massesForcesId,3,sortie);
}
}
}
@@ -694,11 +733,12 @@ protected:
for (i=0;i<nb_link;i++)
if (link[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass2->posX);
- SetFloat(sortie[3],link[i]->mass2->posY);
- ToOutAnything(0,S_linksPosNo,4,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass2->posX);
+ SetFloat(sortie[4],link[i]->mass2->posY);
+ ToOutAnything(0,S_linksPosNo,5,sortie);
}
}
else //symbol
@@ -710,11 +750,12 @@ protected:
{
if (auxarg2==link[i]->Id)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass2->posX);
- SetFloat(sortie[3],link[i]->mass2->posY);
- ToOutAnything(0,S_linksPosId,4,sortie);
+ SetSymbol(sortie[0],link[i]->Id);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass2->posX);
+ SetFloat(sortie[4],link[i]->mass2->posY);
+ ToOutAnything(0,S_linksPosId,5,sortie);
}
}
}
@@ -728,9 +769,10 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- ToOutAnything(0,S_massesSpeedsNo,2,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ ToOutAnything(0,S_massesSpeedsNo,3,sortie);
}
}
else //symbol
@@ -742,9 +784,10 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- ToOutAnything(0,S_massesSpeedsId,2,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ ToOutAnything(0,S_massesSpeedsId,3,sortie);
}
}
}
diff --git a/msd3D/01_msd3Dtest.pd b/msd3D/01_msd3Dtest.pd
index 7666bad..7213efb 100644
--- a/msd3D/01_msd3Dtest.pd
+++ b/msd3D/01_msd3Dtest.pd
@@ -33,7 +33,7 @@
#X text 347 440 ADD FORCE ON ALL MOBILE MASSES;
#X obj 27 545 cnv 15 400 200 empty empty empty 20 12 0 14 -261689 -66577
0;
-#N canvas 643 123 605 590 massrender 0;
+#N canvas 643 123 605 590 massrender 1;
#X obj 127 22 inlet;
#X obj 48 203 translateXYZ;
#X obj 48 229 sphere 0.1;
@@ -45,10 +45,10 @@
#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;
#X obj 244 87 / 12.5;
#X obj 244 110 - 4;
-#X connect 0 0 11 0;
+#X obj 127 57 unpack f f f f;
+#X connect 0 0 13 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
#X connect 4 0 10 0;
@@ -59,11 +59,11 @@
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 10 1 1 1;
-#X connect 11 0 3 0;
-#X connect 11 1 5 0;
-#X connect 11 2 12 0;
-#X connect 12 0 13 0;
-#X connect 13 0 1 3;
+#X connect 11 0 12 0;
+#X connect 12 0 1 3;
+#X connect 13 1 3 0;
+#X connect 13 2 5 0;
+#X connect 13 3 11 0;
#X restore 114 589 pd massrender;
#N canvas 284 227 587 558 linkrender 0;
#X obj 93 25 inlet;
@@ -80,7 +80,6 @@
#X obj 266 140 - 4;
#X obj 320 118 / 12.5;
#X obj 320 141 - 4;
-#X obj 93 69 unpack f f f f f f;
#X obj 197 117 / 12.5;
#X obj 197 142 - 4;
#X obj 123 194 pack f f f;
@@ -89,34 +88,35 @@
#X obj 371 141 - 4;
#X obj 266 189 pack f f f;
#X msg 266 212 \$1 \$2 \$3;
-#X connect 0 0 14 0;
+#X obj 93 69 unpack f f f f f f f;
+#X connect 0 0 22 0;
#X connect 1 0 2 0;
#X connect 2 0 8 0;
#X connect 3 0 4 0;
-#X connect 4 0 17 1;
+#X connect 4 0 16 1;
#X connect 5 0 7 1;
#X connect 6 0 9 0;
#X connect 7 0 6 0;
#X connect 8 0 7 0;
-#X connect 8 1 17 0;
+#X connect 8 1 16 0;
#X connect 10 0 11 0;
-#X connect 11 0 21 0;
+#X connect 11 0 20 0;
#X connect 12 0 13 0;
-#X connect 13 0 21 1;
-#X connect 14 0 1 0;
-#X connect 14 1 3 0;
-#X connect 14 2 15 0;
-#X connect 14 3 10 0;
-#X connect 14 4 12 0;
-#X connect 14 5 19 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 2;
-#X connect 17 0 18 0;
-#X connect 18 0 9 1;
-#X connect 19 0 20 0;
-#X connect 20 0 21 2;
-#X connect 21 0 22 0;
-#X connect 22 0 9 2;
+#X connect 13 0 20 1;
+#X connect 14 0 15 0;
+#X connect 15 0 16 2;
+#X connect 16 0 17 0;
+#X connect 17 0 9 1;
+#X connect 18 0 19 0;
+#X connect 19 0 20 2;
+#X connect 20 0 21 0;
+#X connect 21 0 9 2;
+#X connect 22 1 1 0;
+#X connect 22 2 3 0;
+#X connect 22 3 14 0;
+#X connect 22 4 10 0;
+#X connect 22 5 12 0;
+#X connect 22 6 18 0;
#X restore 33 610 pd linkrender;
#X obj 33 560 route linksPos massesPos;
#X text 241 570 DISPLAY MASSES AND LINKS;
diff --git a/msd3D/02_msd3Dperf.pd b/msd3D/02_msd3Dperf.pd
index 097974b..cd1d59c 100644
--- a/msd3D/02_msd3Dperf.pd
+++ b/msd3D/02_msd3Dperf.pd
@@ -6,7 +6,6 @@
#X obj 37 10 loadbang;
#X text 197 96 reset;
#X obj 159 27 t b b b b b;
-#X obj 313 605 print msd;
#X msg 456 528 0 \, destroy;
#X obj 456 583 gemhead;
#X obj 456 606 world_light;
@@ -24,12 +23,12 @@
#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;
#X obj 247 86 / 12.5;
#X obj 247 109 - 4;
#X obj 48 229 sphere 0.07;
-#X connect 0 0 10 0;
-#X connect 1 0 13 0;
+#X obj 127 57 unpack f f f f;
+#X connect 0 0 13 0;
+#X connect 1 0 12 0;
#X connect 2 0 3 0;
#X connect 3 0 9 0;
#X connect 4 0 5 0;
@@ -39,11 +38,11 @@
#X connect 8 0 7 0;
#X connect 9 0 8 0;
#X connect 9 1 1 1;
-#X connect 10 0 2 0;
-#X connect 10 1 4 0;
-#X connect 10 2 11 0;
-#X connect 11 0 12 0;
-#X connect 12 0 1 3;
+#X connect 10 0 11 0;
+#X connect 11 0 1 3;
+#X connect 13 1 2 0;
+#X connect 13 2 4 0;
+#X connect 13 3 10 0;
#X restore 52 625 pd massrender;
#X obj 425 254 random 100;
#X msg 425 233 seed 1;
@@ -82,64 +81,63 @@
#X msg 143 479 forceX mob 100;
#X msg 143 503 forceX mob -100;
#X msg 459 20 900;
-#X connect 0 0 32 0;
+#X connect 0 0 31 0;
#X connect 1 0 5 0;
#X connect 2 0 0 0;
#X connect 3 0 5 0;
-#X connect 5 0 41 0;
-#X connect 5 1 38 0;
-#X connect 5 2 40 0;
-#X connect 5 3 10 0;
+#X connect 5 0 40 0;
+#X connect 5 1 37 0;
+#X connect 5 2 39 0;
+#X connect 5 3 9 0;
#X connect 5 4 2 0;
-#X connect 5 4 26 0;
-#X connect 5 4 19 0;
-#X connect 5 4 15 0;
+#X connect 5 4 25 0;
#X connect 5 4 18 0;
-#X connect 5 4 35 0;
-#X connect 7 0 31 0;
-#X connect 8 0 9 0;
-#X connect 10 0 0 0;
-#X connect 11 0 31 0;
-#X connect 11 0 43 0;
-#X connect 12 0 45 0;
-#X connect 14 0 36 2;
-#X connect 15 0 14 0;
-#X connect 16 0 36 1;
-#X connect 17 0 20 0;
+#X connect 5 4 14 0;
+#X connect 5 4 17 0;
+#X connect 5 4 34 0;
+#X connect 6 0 30 0;
+#X connect 7 0 8 0;
+#X connect 9 0 0 0;
+#X connect 10 0 30 0;
+#X connect 10 0 42 0;
+#X connect 11 0 44 0;
+#X connect 13 0 35 2;
+#X connect 14 0 13 0;
+#X connect 15 0 35 1;
+#X connect 16 0 19 0;
+#X connect 17 0 15 0;
#X connect 18 0 16 0;
-#X connect 19 0 17 0;
-#X connect 20 0 36 0;
-#X connect 21 0 27 0;
-#X connect 22 0 24 0;
-#X connect 22 0 25 0;
+#X connect 19 0 35 0;
+#X connect 20 0 26 0;
+#X connect 21 0 23 0;
+#X connect 21 0 24 0;
+#X connect 21 0 26 1;
#X connect 22 0 27 1;
-#X connect 23 0 28 1;
-#X connect 24 0 23 1;
-#X connect 25 0 28 0;
-#X connect 25 1 23 0;
-#X connect 26 0 27 1;
-#X connect 27 0 22 0;
-#X connect 28 0 29 0;
-#X connect 29 0 0 0;
-#X connect 30 0 12 0;
-#X connect 32 0 44 0;
-#X connect 32 1 6 0;
-#X connect 33 0 17 0;
-#X connect 33 1 16 0;
-#X connect 33 1 34 0;
-#X connect 33 2 14 0;
-#X connect 34 0 36 3;
-#X connect 35 0 34 0;
-#X connect 36 0 37 0;
+#X connect 23 0 22 1;
+#X connect 24 0 27 0;
+#X connect 24 1 22 0;
+#X connect 25 0 26 1;
+#X connect 26 0 21 0;
+#X connect 27 0 28 0;
+#X connect 28 0 0 0;
+#X connect 29 0 11 0;
+#X connect 31 0 43 0;
+#X connect 32 0 16 0;
+#X connect 32 1 15 0;
+#X connect 32 1 33 0;
+#X connect 32 2 13 0;
+#X connect 33 0 35 3;
+#X connect 34 0 33 0;
+#X connect 35 0 36 0;
+#X connect 36 0 0 0;
#X connect 37 0 0 0;
-#X connect 38 0 0 0;
-#X connect 39 0 31 0;
-#X connect 40 0 33 0;
-#X connect 41 0 21 0;
-#X connect 43 0 39 0;
-#X connect 44 0 13 0;
-#X connect 45 0 32 0;
-#X connect 47 0 32 0;
-#X connect 48 0 32 0;
-#X connect 49 0 40 1;
-#X connect 49 0 41 1;
+#X connect 38 0 30 0;
+#X connect 39 0 32 0;
+#X connect 40 0 20 0;
+#X connect 42 0 38 0;
+#X connect 43 0 12 0;
+#X connect 44 0 31 0;
+#X connect 46 0 31 0;
+#X connect 47 0 31 0;
+#X connect 48 0 39 1;
+#X connect 48 0 40 1;
diff --git a/msd3D/03_msd3Dmemb.pd b/msd3D/03_msd3Dmemb.pd
index ad45d13..766c86b 100644
--- a/msd3D/03_msd3Dmemb.pd
+++ b/msd3D/03_msd3Dmemb.pd
@@ -31,7 +31,6 @@
#X obj 266 140 - 4;
#X obj 320 118 / 12.5;
#X obj 320 141 - 4;
-#X obj 93 69 unpack f f f f f f;
#X obj 197 117 / 12.5;
#X obj 197 142 - 4;
#X obj 123 194 pack f f f;
@@ -40,34 +39,35 @@
#X obj 371 141 - 4;
#X obj 266 189 pack f f f;
#X msg 266 212 \$1 \$2 \$3;
-#X connect 0 0 14 0;
+#X obj 93 69 unpack f f f f f f f;
+#X connect 0 0 22 0;
#X connect 1 0 2 0;
#X connect 2 0 8 0;
#X connect 3 0 4 0;
-#X connect 4 0 17 1;
+#X connect 4 0 16 1;
#X connect 5 0 7 1;
#X connect 6 0 9 0;
#X connect 7 0 6 0;
#X connect 8 0 7 0;
-#X connect 8 1 17 0;
+#X connect 8 1 16 0;
#X connect 10 0 11 0;
-#X connect 11 0 21 0;
+#X connect 11 0 20 0;
#X connect 12 0 13 0;
-#X connect 13 0 21 1;
-#X connect 14 0 1 0;
-#X connect 14 1 3 0;
-#X connect 14 2 15 0;
-#X connect 14 3 10 0;
-#X connect 14 4 12 0;
-#X connect 14 5 19 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 2;
-#X connect 17 0 18 0;
-#X connect 18 0 9 1;
-#X connect 19 0 20 0;
-#X connect 20 0 21 2;
-#X connect 21 0 22 0;
-#X connect 22 0 9 2;
+#X connect 13 0 20 1;
+#X connect 14 0 15 0;
+#X connect 15 0 16 2;
+#X connect 16 0 17 0;
+#X connect 17 0 9 1;
+#X connect 18 0 19 0;
+#X connect 19 0 20 2;
+#X connect 20 0 21 0;
+#X connect 21 0 9 2;
+#X connect 22 1 1 0;
+#X connect 22 2 3 0;
+#X connect 22 3 14 0;
+#X connect 22 4 10 0;
+#X connect 22 5 12 0;
+#X connect 22 6 18 0;
#X restore 33 666 pd linkrender;
#X obj 33 616 msd3D --------------------------------;
#X msg 62 559 forceZ mob 200;
@@ -90,7 +90,7 @@
#X msg 466 646 view 4 0 0.5 0 0 0 0 0 1;
#X obj 312 479 f;
#X floatatom 333 456 5 0 0 0 - - -;
-#X obj 312 403 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+#X obj 312 403 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X msg 312 504 forceZ mob \$1;
#X obj 312 423 metro 65;
@@ -101,9 +101,9 @@
#X msg 184 82 mass fix 0 100 30 30 40 \, mass fix 0 100 30 70 40 \,
mass fix 0 100 70 30 40 \, mass fix 0 100 70 70 40;
#X msg 527 543 posZ fix \$1;
-#X obj 527 402 vsl 15 128 0 70 0 0 empty empty empty 0 -8 0 8 -262144
--1 -1 3000 1;
-#X text 573 463 Change altitude of corners;
+#X obj 527 402 vsl 15 128 0 70 0 0 empty empty empty 0 -8 0 8 -262131
+-1 -1 0 1;
+#X text 559 457 Change altitude of corners;
#X obj 33 427 t b b b;
#X text 385 455 Amplitude;
#X text 362 619 Create window;
diff --git a/msd3D/04_msd3Dfilet.pd b/msd3D/04_msd3Dfilet.pd
index 69d801b..a233122 100644
--- a/msd3D/04_msd3Dfilet.pd
+++ b/msd3D/04_msd3Dfilet.pd
@@ -1,6 +1,5 @@
#N canvas 482 80 863 802 10;
#X obj 32 13 loadbang;
-#X obj 294 522 print msd;
#X obj 458 439 gemwin;
#X msg 458 417 0 \, destroy;
#X obj 457 469 gemhead;
@@ -14,7 +13,7 @@
#X obj 33 298 gemhead;
#X obj 33 321 t b;
#X msg 33 343 bang \, get massesPos \, get linksPos;
-#N canvas 643 123 605 590 massrender 0;
+#N canvas 643 123 605 590 massrender 1;
#X obj 127 22 inlet;
#X obj 48 203 translateXYZ;
#X obj 48 229 sphere 0.1;
@@ -26,10 +25,10 @@
#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;
#X obj 246 88 / 12.5;
#X obj 246 111 - 4;
-#X connect 0 0 11 0;
+#X obj 127 57 unpack f f f f;
+#X connect 0 0 13 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
#X connect 4 0 10 0;
@@ -40,11 +39,11 @@
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 10 1 1 1;
-#X connect 11 0 3 0;
-#X connect 11 1 5 0;
-#X connect 11 2 12 0;
-#X connect 12 0 13 0;
-#X connect 13 0 1 3;
+#X connect 11 0 12 0;
+#X connect 12 0 1 3;
+#X connect 13 1 3 0;
+#X connect 13 2 5 0;
+#X connect 13 3 11 0;
#X restore 114 589 pd massrender;
#N canvas 284 227 587 558 linkrender 0;
#X obj 93 25 inlet;
@@ -56,12 +55,10 @@
#X obj 44 222 separator;
#X obj 44 192 any;
#X obj 93 164 t b f;
-#X obj 44 265 curve 2;
#X obj 266 117 / 12.5;
#X obj 266 140 - 4;
#X obj 320 118 / 12.5;
#X obj 320 141 - 4;
-#X obj 93 69 unpack f f f f f f;
#X obj 197 117 / 12.5;
#X obj 197 142 - 4;
#X obj 123 194 pack f f f;
@@ -70,77 +67,78 @@
#X obj 371 141 - 4;
#X obj 266 189 pack f f f;
#X msg 266 212 \$1 \$2 \$3;
-#X connect 0 0 14 0;
+#X obj 44 265 curve 2;
+#X obj 93 69 unpack f f f f f f f;
+#X connect 0 0 22 0;
#X connect 1 0 2 0;
#X connect 2 0 8 0;
#X connect 3 0 4 0;
-#X connect 4 0 17 1;
+#X connect 4 0 15 1;
#X connect 5 0 7 1;
-#X connect 6 0 9 0;
+#X connect 6 0 21 0;
#X connect 7 0 6 0;
#X connect 8 0 7 0;
-#X connect 8 1 17 0;
-#X connect 10 0 11 0;
-#X connect 11 0 21 0;
-#X connect 12 0 13 0;
-#X connect 13 0 21 1;
-#X connect 14 0 1 0;
-#X connect 14 1 3 0;
-#X connect 14 2 15 0;
-#X connect 14 3 10 0;
-#X connect 14 4 12 0;
-#X connect 14 5 19 0;
+#X connect 8 1 15 0;
+#X connect 9 0 10 0;
+#X connect 10 0 19 0;
+#X connect 11 0 12 0;
+#X connect 12 0 19 1;
+#X connect 13 0 14 0;
+#X connect 14 0 15 2;
#X connect 15 0 16 0;
-#X connect 16 0 17 2;
+#X connect 16 0 21 1;
#X connect 17 0 18 0;
-#X connect 18 0 9 1;
+#X connect 18 0 19 2;
#X connect 19 0 20 0;
#X connect 20 0 21 2;
-#X connect 21 0 22 0;
-#X connect 22 0 9 2;
+#X connect 22 1 1 0;
+#X connect 22 2 3 0;
+#X connect 22 3 13 0;
+#X connect 22 4 9 0;
+#X connect 22 5 11 0;
+#X connect 22 6 17 0;
#X restore 33 610 pd linkrender;
#X obj 33 539 route linksPos massesPos;
#X msg 458 392 view 0 4 0 0 0 0 0 0 1;
#X msg 203 83 symbol reset;
#X obj 33 497 msd3D --------------------------------;
-#X msg 32 410 forceZ filet -0.2;
+#X msg 107 430 forceZ filet -0.2;
#X msg 145 173 Xmax 100 \, Xmin 0 \, Ymax 100 \, Ymin 0 \, Zmax 70
\, Zmin -40;
#X msg 164 140 setFixed 62 \, setFixed 87 \, setFixed 512 \, setFixed
537;
-#X msg 458 371 view 0 0 4 0 0 0 0 1 0;
#X obj 183 113 filet 20 30 2 2 20 30;
#X msg 458 349 view 4 0 0.5 0 0 0 0 0 1;
#X text 187 408 Ambient force;
#X text 648 380 Select view;
#X obj 145 38 t b b b b;
-#X text 383 114 Filet abstraction : x0 y0 stepx stepy nx ny;
#X text 244 587 Connect mass or link to be viewed \, or both with good
computer!;
-#X connect 0 0 28 0;
-#X connect 3 0 2 0;
-#X connect 4 0 5 0;
-#X connect 6 0 2 0;
-#X connect 7 0 19 0;
-#X connect 8 0 28 0;
-#X connect 9 0 7 0;
+#X text 383 114 Filet abstraction : x0 y0 stepx stepy ny nx;
+#X msg 458 371 view 0 0 2 0 0 0 0 1 0;
+#X connect 0 0 26 0;
+#X connect 2 0 1 0;
+#X connect 3 0 4 0;
+#X connect 5 0 1 0;
+#X connect 6 0 18 0;
+#X connect 7 0 26 0;
+#X connect 8 0 6 0;
+#X connect 10 0 11 0;
#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X connect 13 0 19 0;
-#X connect 13 0 20 0;
-#X connect 16 1 14 0;
-#X connect 17 0 2 0;
-#X connect 18 0 24 1;
-#X connect 19 0 16 0;
-#X connect 19 1 1 0;
-#X connect 20 0 19 0;
-#X connect 21 0 7 0;
-#X connect 22 0 7 0;
-#X connect 23 0 2 0;
-#X connect 24 0 7 0;
-#X connect 25 0 2 0;
-#X connect 28 0 21 0;
-#X connect 28 1 22 0;
-#X connect 28 2 24 0;
-#X connect 28 3 9 0;
-#X connect 28 3 18 0;
+#X connect 12 0 19 0;
+#X connect 12 0 18 0;
+#X connect 15 1 13 0;
+#X connect 16 0 1 0;
+#X connect 17 0 22 1;
+#X connect 18 0 15 0;
+#X connect 19 0 18 0;
+#X connect 20 0 6 0;
+#X connect 21 0 6 0;
+#X connect 22 0 6 0;
+#X connect 23 0 1 0;
+#X connect 26 0 20 0;
+#X connect 26 1 21 0;
+#X connect 26 2 22 0;
+#X connect 26 3 8 0;
+#X connect 26 3 17 0;
+#X connect 29 0 1 0;
diff --git a/msd3D/05_msd3Dvline.pd b/msd3D/05_msd3Dvline.pd
index 97f038d..9300589 100644
--- a/msd3D/05_msd3Dvline.pd
+++ b/msd3D/05_msd3Dvline.pd
@@ -1,6 +1,5 @@
#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;
@@ -15,20 +14,19 @@
#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 0
+#X obj 444 207 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 1
1;
#X obj 444 258 f;
#X obj 444 234 metro 65;
#X msg 326 468 setD fil 1;
-#X obj 33 257 t b b b b b;
#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 0 1;
+-1 -1 11000 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 0
+#X obj 206 204 tgl 20 0 empty empty empty 0 -6 0 8 -262131 -1 -1 1
1;
#X obj 206 275 / 3.6;
#X obj 206 295 * 6.28319;
@@ -55,7 +53,6 @@
#X restore 33 359 pd getmmasses;
#N canvas 224 164 901 724 synthese 0;
#X obj 232 66 inlet;
-#X obj 232 88 unpack f f f;
#X obj 232 176 pack f f f f;
#X obj 231 316 partiel;
#N canvas 582 426 450 300 drone 0;
@@ -87,69 +84,19 @@
#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 restore 627 480 pd drone;
#X obj 232 154 t f f;
#X msg 143 113 reset;
#X obj 87 64 loadbang;
#X obj 173 49 r resban;
#X obj 232 110 t b f;
-#N canvas 669 177 562 569 noise 0;
-#X obj 176 62 inlet;
-#X obj 285 493 outlet~;
-#X msg 176 84 \$1;
-#X obj 176 105 abs;
-#X obj 302 190 line~;
-#X obj 285 472 *~;
-#X obj 176 149 t b;
-#X obj 248 149 t b;
-#X obj 147 425 noise~;
-#X msg 162 197 \$3;
-#X obj 162 218 abs;
-#X obj 162 239 * 50;
-#X obj 148 445 moog~;
-#X obj 179 404 sig~;
-#X obj 162 260 + 0;
-#X obj 162 351 sig~;
-#X obj 177 126 moses 0.008;
-#X msg 179 379 1;
-#X obj 162 282 max 0.5;
-#X obj 162 304 min 2.5;
-#X floatatom 245 389 5 0 0 0 - - -;
-#X msg 302 166 0.5 5;
-#X obj 162 330 * 900;
-#X msg 176 173 0 20;
-#X connect 0 0 2 0;
-#X connect 0 0 9 0;
-#X connect 2 0 3 0;
-#X connect 3 0 16 0;
-#X connect 4 0 5 1;
-#X connect 5 0 1 0;
-#X connect 6 0 23 0;
-#X connect 7 0 21 0;
-#X connect 8 0 12 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 0;
-#X connect 11 0 14 0;
-#X connect 12 0 5 0;
-#X connect 13 0 12 2;
-#X connect 14 0 18 0;
-#X connect 15 0 12 1;
-#X connect 16 0 6 0;
-#X connect 16 1 7 0;
-#X connect 17 0 13 0;
-#X connect 18 0 19 0;
-#X connect 19 0 22 0;
-#X connect 20 0 13 0;
-#X connect 21 0 4 0;
-#X connect 22 0 15 0;
-#X connect 23 0 4 0;
-#X restore 479 643 pd noise;
-#X obj 521 497 hip~ 20;
+#X obj 521 498 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 232 88 unpack f f f f;
#X obj 288 385 partiel;
#X obj 250 339 partiel;
#X obj 269 362 partiel;
@@ -179,156 +126,143 @@
#X obj 708 383 partiel;
#X obj 710 313 partiel;
#X obj 729 336 partiel;
-#X connect 0 0 1 0;
-#X connect 1 0 9 0;
-#X connect 1 1 2 2;
-#X connect 1 2 2 3;
-#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 14 0;
-#X connect 7 0 6 0;
-#X connect 8 0 6 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 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;
-#X connect 22 0 12 0;
-#X connect 23 0 11 0;
-#X connect 24 0 12 0;
-#X connect 25 0 11 0;
-#X connect 26 0 12 0;
-#X connect 27 0 11 0;
-#X connect 28 0 12 0;
-#X connect 29 0 11 0;
-#X connect 30 0 12 0;
-#X connect 31 0 11 0;
-#X connect 32 0 12 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;
-#X connect 38 0 12 0;
-#X connect 39 0 11 0;
-#X connect 40 0 12 0;
-#X connect 41 0 11 0;
-#X connect 42 0 12 0;
-#X connect 43 0 11 0;
-#X connect 44 0 12 0;
+#X connect 0 0 14 0;
+#X connect 1 0 13 0;
+#X connect 2 0 9 0;
+#X connect 3 0 10 0;
+#X connect 3 0 9 0;
+#X connect 4 0 1 0;
+#X connect 5 0 12 0;
+#X connect 6 0 5 0;
+#X connect 7 0 5 0;
+#X connect 8 0 12 0;
+#X connect 8 1 1 1;
+#X connect 9 0 11 1;
+#X connect 10 0 11 0;
+#X connect 12 0 4 0;
+#X connect 13 0 2 0;
+#X connect 13 1 16 0;
+#X connect 13 2 17 0;
+#X connect 13 3 15 0;
+#X connect 13 4 18 0;
+#X connect 13 5 19 0;
+#X connect 13 6 20 0;
+#X connect 13 7 21 0;
+#X connect 13 8 22 0;
+#X connect 13 9 23 0;
+#X connect 13 10 24 0;
+#X connect 13 11 25 0;
+#X connect 13 12 26 0;
+#X connect 13 13 27 0;
+#X connect 13 14 28 0;
+#X connect 13 15 29 0;
+#X connect 13 16 30 0;
+#X connect 13 17 31 0;
+#X connect 13 18 32 0;
+#X connect 13 19 33 0;
+#X connect 13 20 34 0;
+#X connect 13 21 35 0;
+#X connect 13 22 36 0;
+#X connect 13 23 37 0;
+#X connect 13 24 38 0;
+#X connect 13 25 39 0;
+#X connect 13 26 40 0;
+#X connect 13 27 41 0;
+#X connect 13 28 42 0;
+#X connect 13 29 43 0;
+#X connect 14 1 8 0;
+#X connect 14 2 1 2;
+#X connect 14 3 1 3;
+#X connect 15 0 10 0;
+#X connect 16 0 10 0;
+#X connect 17 0 9 0;
+#X connect 18 0 9 0;
+#X connect 19 0 10 0;
+#X connect 20 0 9 0;
+#X connect 21 0 10 0;
+#X connect 22 0 9 0;
+#X connect 23 0 10 0;
+#X connect 24 0 9 0;
+#X connect 25 0 10 0;
+#X connect 26 0 9 0;
+#X connect 27 0 10 0;
+#X connect 28 0 9 0;
+#X connect 29 0 10 0;
+#X connect 30 0 9 0;
+#X connect 31 0 10 0;
+#X connect 32 0 9 0;
+#X connect 33 0 10 0;
+#X connect 34 0 9 0;
+#X connect 35 0 10 0;
+#X connect 36 0 9 0;
+#X connect 37 0 10 0;
+#X connect 38 0 9 0;
+#X connect 39 0 10 0;
+#X connect 40 0 9 0;
+#X connect 41 0 10 0;
+#X connect 42 0 9 0;
+#X connect 43 0 10 0;
#X restore 33 572 pd synthese;
#X obj 183 219 vsl 15 128 0 30 0 0 empty empty empty 0 -8 0 8 -262131
--1 -1 0 1;
+-1 -1 10100 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 382 3 inlet;
-#X obj 304 88 f 0;
-#X obj 304 129 + 1;
-#X obj 443 184 pack f f f f;
-#X obj 461 153 unpack f f f;
-#X obj 282 24 t b b a;
-#X msg 383 68 0;
-#X obj 304 108 t f f;
-#X obj 303 152 % 30;
+#X obj 306 144 pack f f f f;
+#X obj 306 99 % 30;
#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 obj 306 119 sel 0;
#X obj 44 288 curve16 ---------------------------------------------
;
+#X obj 306 74 unpack f f f f;
#X connect 0 0 8 0;
#X connect 1 0 2 1;
-#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 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 connect 2 0 7 0;
+#X connect 3 0 5 0;
+#X connect 4 0 6 0;
+#X connect 4 0 3 0;
+#X connect 5 0 7 1;
+#X connect 5 1 7 2;
+#X connect 5 2 7 3;
+#X connect 5 3 7 4;
+#X connect 5 4 7 5;
+#X connect 5 5 7 6;
+#X connect 5 6 7 7;
+#X connect 5 7 7 8;
+#X connect 5 8 7 9;
+#X connect 5 9 7 10;
+#X connect 5 10 7 11;
+#X connect 5 11 7 12;
+#X connect 5 12 7 13;
+#X connect 5 13 7 14;
+#X connect 5 14 7 15;
+#X connect 5 15 7 16;
+#X connect 5 16 7 17;
+#X connect 5 17 7 18;
+#X connect 5 18 7 19;
+#X connect 5 19 7 20;
+#X connect 5 20 7 21;
+#X connect 5 21 7 22;
+#X connect 5 22 7 23;
+#X connect 5 23 7 24;
+#X connect 5 24 7 25;
+#X connect 5 25 7 26;
+#X connect 5 26 7 27;
+#X connect 5 27 7 28;
+#X connect 5 28 7 29;
+#X connect 5 29 7 30;
+#X connect 6 0 2 0;
+#X connect 8 0 4 0;
+#X connect 8 1 3 1;
+#X connect 8 2 3 2;
+#X connect 8 3 3 3;
#X restore 135 573 pd massrender;
#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 text 484 206 <-- Add constant force;
+#X text 483 206 <-- Add constant force;
#X text 240 204 <-- Add sinus force;
#X text 136 360 Get middles masses;
#X obj 457 348 t b;
@@ -348,58 +282,56 @@ 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;
-#X connect 6 0 11 0;
-#X connect 7 0 13 0;
-#X connect 8 0 6 0;
-#X connect 9 0 19 0;
-#X connect 10 0 40 1;
-#X connect 11 0 53 0;
-#X connect 11 1 1 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;
-#X connect 15 0 17 0;
-#X connect 16 0 14 0;
-#X connect 17 0 16 0;
-#X connect 18 0 11 0;
-#X connect 19 0 11 0;
-#X connect 19 0 29 0;
-#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 52 0;
-#X connect 19 3 32 1;
-#X connect 20 0 2 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;
-#X connect 24 0 26 0;
-#X connect 25 0 28 0;
-#X connect 26 0 27 0;
-#X connect 27 0 22 0;
-#X connect 28 0 24 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 52 0 11 0;
-#X connect 53 0 30 0;
-#X connect 53 1 32 0;
+#X obj 33 257 t b b;
+#X connect 0 0 12 0;
+#X connect 2 0 1 0;
+#X connect 3 0 4 0;
+#X connect 5 0 10 0;
+#X connect 6 0 12 0;
+#X connect 7 0 5 0;
+#X connect 8 0 52 0;
+#X connect 9 0 38 1;
+#X connect 10 0 51 0;
+#X connect 12 0 48 0;
+#X connect 12 0 40 0;
+#X connect 12 1 31 0;
+#X connect 12 2 38 0;
+#X connect 12 3 7 0;
+#X connect 12 3 9 0;
+#X connect 13 0 10 0;
+#X connect 14 0 16 0;
+#X connect 15 0 13 0;
+#X connect 16 0 15 0;
+#X connect 17 0 10 0;
+#X connect 18 0 1 0;
+#X connect 18 0 36 0;
+#X connect 19 0 15 1;
+#X connect 20 0 21 0;
+#X connect 21 0 13 0;
+#X connect 22 0 24 0;
+#X connect 23 0 26 0;
+#X connect 24 0 25 0;
+#X connect 25 0 20 0;
+#X connect 26 0 22 0;
+#X connect 27 0 47 0;
+#X connect 29 0 21 1;
+#X connect 31 0 5 0;
+#X connect 36 0 49 0;
+#X connect 38 0 5 0;
+#X connect 39 0 10 0;
+#X connect 41 0 10 0;
+#X connect 42 0 10 0;
+#X connect 44 0 1 0;
+#X connect 46 0 10 0;
+#X connect 47 0 10 0;
+#X connect 48 0 5 0;
+#X connect 49 0 1 0;
+#X connect 50 0 10 0;
+#X connect 51 0 28 0;
+#X connect 51 1 30 0;
+#X connect 52 0 10 0;
+#X connect 52 0 27 0;
+#X connect 52 0 50 0;
+#X connect 52 0 46 0;
+#X connect 52 1 27 0;
+#X connect 52 1 10 0;
diff --git a/msd3D/help-msd3D.pd b/msd3D/help-msd3D.pd
index 406396f..53382b5 100644
--- a/msd3D/help-msd3D.pd
+++ b/msd3D/help-msd3D.pd
@@ -14,7 +14,6 @@
#X text 235 367 Compute new masses positions;
#X obj 61 403 cnv 15 610 210 empty empty DYNAMIC_SETTING 20 12 0 14
-262131 -66577 0;
-#X text 350 449 \$1 : Id (symbol);
#X text 350 467 \$2 : New value;
#X text 348 503 \$1 : Id (symbol);
#X text 348 521 \$2 : New value;
@@ -63,18 +62,19 @@ their;
#X msg 83 503 forceZ \$1 \$2;
#X msg 83 548 Zmin \$1 \, Zmax \$1;
#X obj 33 821 msd3D;
-#X connect 1 0 52 0;
-#X connect 8 0 52 0;
-#X connect 15 0 52 0;
-#X connect 18 0 52 0;
-#X connect 20 0 52 0;
-#X connect 21 0 52 0;
-#X connect 24 0 52 0;
-#X connect 28 0 52 0;
-#X connect 31 0 52 0;
-#X connect 40 0 52 0;
-#X connect 46 0 52 0;
-#X connect 47 0 52 0;
+#X text 350 449 \$1 : Id (symbol) or No;
+#X connect 1 0 51 0;
+#X connect 8 0 51 0;
+#X connect 14 0 51 0;
+#X connect 17 0 51 0;
+#X connect 19 0 51 0;
+#X connect 20 0 51 0;
+#X connect 23 0 51 0;
+#X connect 27 0 51 0;
+#X connect 30 0 51 0;
+#X connect 39 0 51 0;
+#X connect 45 0 51 0;
+#X connect 46 0 51 0;
#X restore 158 305 pd masses;
#X text 12 305 HELP on masses --->;
#X text 11 336 HELP on links --->;
diff --git a/msd3D/main.cpp b/msd3D/main.cpp
index c235776..7b0d2f4 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.03 -- 21.04.2005
+ Version 0.04 -- 26.04.2005
*/
// include flext header
@@ -38,7 +38,7 @@
#include <math.h>
// define constants
-#define MSD3D_VERSION 0.03
+#define MSD3D_VERSION 0.04
#define nb_max_link 4000
#define nb_max_mass 4000
#define Id_length 20
@@ -480,50 +480,64 @@ protected:
{
t_atom sortie[7], aux[2];
t_int i;
-
- 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==GetAInt(argv[1])) // pointer to mass1
- link[nb_link]->mass1 = mass[i];
- 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));//L[0]
- link[nb_link]->nbr = id_link; // id number
- 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 );
- SetFloat((sortie[0]),id_link-1);
- SetSymbol((sortie[1]),link[nb_link-1]->Id);
- SetFloat((sortie[2]),GetInt(argv[1]));
- SetFloat((sortie[3]),GetInt(argv[2]));
- 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);
+ t_mass *mass1 = NULL;
+ t_mass *mass2 = NULL;
+
+ if (argc < 6 || argc > 8)
+ error("link : Id Nomass1 Nomass2 K D1 D2 (Lmin Lmax)");
+
+ // check for existence of link masses:
+ for (i=0; i<nb_mass;i++)
+ if (mass[i]->nbr==GetInt(argv[1])) // pointer to mass1
+ // we found mass1
+ mass1 = mass[i];
+ else if (mass[i]->nbr==GetInt(argv[2])) // pointer to mass2
+ // ... and mass2
+ mass2 = mass[i];
+
+ if (mass1 and mass2)
+ {
+ link[nb_link] = new t_link; // New pointer
+ link[nb_link]->Id = GetSymbol(argv[0]); // ID
+ link[nb_link]->mass1 = mass1; // pointer to mass1
+ link[nb_link]->mass2 = mass2; // pointer to mass2
+ 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));//L[0]
+ link[nb_link]->nbr = id_link; // id number
+ 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 );
+ SetFloat((sortie[0]),id_link-1);
+ SetSymbol((sortie[1]),link[nb_link-1]->Id);
+ SetFloat((sortie[2]),GetInt(argv[1]));
+ SetFloat((sortie[3]),GetInt(argv[2]));
+ 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);
+ }
+ else
+ error("link : Cannot create link: Not all masses for this link have been created yet.");
}
void m_ilink(int argc,t_atom *argv)
@@ -660,7 +674,7 @@ protected:
{
t_int i,j;
t_symbol *auxarg,*auxarg2, *auxtype;
- t_atom sortie[6];
+ t_atom sortie[7];
auxtype = GetSymbol(argv[0]);
auxarg = GetASymbol(argv[1]); //auxarg : & symbol, 0 else
@@ -669,37 +683,41 @@ protected:
if (auxtype == S_massesPos)// get all masses positions
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- SetFloat(sortie[2],mass[i]->posZ);
- ToOutAnything(0,S_massesPos,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ SetFloat(sortie[3],mass[i]->posZ);
+ ToOutAnything(0,S_massesPos,4,sortie);
}
else if (auxtype == S_massesForces)// get all masses forces
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- SetFloat(sortie[2],mass[i]->out_forceZ);
- ToOutAnything(0,S_massesForces,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ SetFloat(sortie[3],mass[i]->out_forceZ);
+ ToOutAnything(0,S_massesForces,4,sortie);
}
else if (auxtype == S_linksPos)// get all links positions
for (i=0; i<nb_link; i++)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass1->posZ);
- SetFloat(sortie[3],link[i]->mass2->posX);
- SetFloat(sortie[4],link[i]->mass2->posY);
- SetFloat(sortie[5],link[i]->mass2->posZ);
- ToOutAnything(0,S_linksPos,6,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass1->posZ);
+ SetFloat(sortie[4],link[i]->mass2->posX);
+ SetFloat(sortie[5],link[i]->mass2->posY);
+ SetFloat(sortie[6],link[i]->mass2->posZ);
+ ToOutAnything(0,S_linksPos,7,sortie);
}
else // get all masses speeds
for (i=0; i<nb_mass; i++)
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- SetFloat(sortie[2],mass[i]->speedZ);
- ToOutAnything(0,S_massesSpeeds,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ SetFloat(sortie[3],mass[i]->speedZ);
+ ToOutAnything(0,S_massesSpeeds,4,sortie);
}
}
else if (auxtype == S_massesPos) // get mass positions
@@ -710,10 +728,11 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- SetFloat(sortie[2],mass[i]->posZ);
- ToOutAnything(0,S_massesPosNo,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ SetFloat(sortie[3],mass[i]->posZ);
+ ToOutAnything(0,S_massesPosNo,4,sortie);
}
}
else //symbol
@@ -725,10 +744,11 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->posX);
- SetFloat(sortie[1],mass[i]->posY);
- SetFloat(sortie[2],mass[i]->posZ);
- ToOutAnything(0,S_massesPosId,3,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->posX);
+ SetFloat(sortie[2],mass[i]->posY);
+ SetFloat(sortie[3],mass[i]->posZ);
+ ToOutAnything(0,S_massesPosId,4,sortie);
}
}
}
@@ -742,10 +762,11 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- SetFloat(sortie[2],mass[i]->out_forceZ);
- ToOutAnything(0,S_massesForcesNo,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ SetFloat(sortie[3],mass[i]->out_forceZ);
+ ToOutAnything(0,S_massesForcesNo,4,sortie);
}
}
else //symbol
@@ -757,10 +778,11 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->out_forceX);
- SetFloat(sortie[1],mass[i]->out_forceY);
- SetFloat(sortie[2],mass[i]->out_forceZ);
- ToOutAnything(0,S_massesForcesId,3,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->out_forceX);
+ SetFloat(sortie[2],mass[i]->out_forceY);
+ SetFloat(sortie[3],mass[i]->out_forceZ);
+ ToOutAnything(0,S_massesForcesId,4,sortie);
}
}
}
@@ -774,13 +796,14 @@ protected:
for (i=0;i<nb_link;i++)
if (link[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass1->posZ);
- SetFloat(sortie[3],link[i]->mass2->posX);
- SetFloat(sortie[4],link[i]->mass2->posY);
- SetFloat(sortie[5],link[i]->mass2->posZ);
- ToOutAnything(0,S_linksPosNo,6,sortie);
+ SetFloat(sortie[0],link[i]->nbr);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass1->posZ);
+ SetFloat(sortie[4],link[i]->mass2->posX);
+ SetFloat(sortie[5],link[i]->mass2->posY);
+ SetFloat(sortie[6],link[i]->mass2->posZ);
+ ToOutAnything(0,S_linksPosNo,7,sortie);
}
}
else //symbol
@@ -792,13 +815,14 @@ protected:
{
if (auxarg2==link[i]->Id)
{
- SetFloat(sortie[0],link[i]->mass1->posX);
- SetFloat(sortie[1],link[i]->mass1->posY);
- SetFloat(sortie[2],link[i]->mass1->posZ);
- SetFloat(sortie[3],link[i]->mass2->posX);
- SetFloat(sortie[4],link[i]->mass2->posY);
- SetFloat(sortie[5],link[i]->mass2->posZ);
- ToOutAnything(0,S_linksPosId,6,sortie);
+ SetSymbol(sortie[0],link[i]->Id);
+ SetFloat(sortie[1],link[i]->mass1->posX);
+ SetFloat(sortie[2],link[i]->mass1->posY);
+ SetFloat(sortie[3],link[i]->mass1->posZ);
+ SetFloat(sortie[4],link[i]->mass2->posX);
+ SetFloat(sortie[5],link[i]->mass2->posY);
+ SetFloat(sortie[6],link[i]->mass2->posZ);
+ ToOutAnything(0,S_linksPosId,7,sortie);
}
}
}
@@ -812,10 +836,11 @@ protected:
for (i=0;i<nb_mass;i++)
if (mass[i]->nbr==GetInt(argv[j]))
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- SetFloat(sortie[2],mass[i]->speedZ);
- ToOutAnything(0,S_massesSpeedsNo,3,sortie);
+ SetFloat(sortie[0],mass[i]->nbr);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ SetFloat(sortie[3],mass[i]->speedZ);
+ ToOutAnything(0,S_massesSpeedsNo,4,sortie);
}
}
else //symbol
@@ -827,10 +852,11 @@ protected:
{
if (auxarg2==mass[i]->Id)
{
- SetFloat(sortie[0],mass[i]->speedX);
- SetFloat(sortie[1],mass[i]->speedY);
- SetFloat(sortie[2],mass[i]->speedZ);
- ToOutAnything(0,S_massesSpeedsId,3,sortie);
+ SetSymbol(sortie[0],mass[i]->Id);
+ SetFloat(sortie[1],mass[i]->speedX);
+ SetFloat(sortie[2],mass[i]->speedY);
+ SetFloat(sortie[3],mass[i]->speedZ);
+ ToOutAnything(0,S_massesSpeedsId,4,sortie);
}
}
}
diff --git a/msd3D/partiel.pd b/msd3D/partiel.pd
index 99a6c7c..1ae82de 100644
--- a/msd3D/partiel.pd
+++ b/msd3D/partiel.pd
@@ -9,17 +9,17 @@
#X msg 174 167 \$1 50;
#X msg 131 60 \$2;
#X obj 131 83 / 10;
-#X obj 172 84 * -10;
-#X obj 182 112 + 110;
+#X obj 182 112 + 10;
+#X obj 172 84 * 5;
#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 10 0;
+#X connect 5 0 11 0;
#X connect 6 0 4 0;
#X connect 7 0 2 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;
+#X connect 10 0 6 0;
+#X connect 11 0 10 0;