aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Henry <nusmuk@users.sourceforge.net>2014-11-05 23:27:29 +0000
committerCyrille Henry <nusmuk@users.sourceforge.net>2014-11-05 23:27:29 +0000
commitcc47441c1922f219064c174f46b1fe50aa504fd0 (patch)
tree96b36aa51ed8963c043aa564e3e137f7f46c1b8f
parent81e8cc778c2bcf80d82c4fe8b40d88a39db968a2 (diff)
new test parametter (active for link and mobile for masses)
new testLinkNumber, or testMassNumber to get only number of link/masses that pass the test svn path=/trunk/externals/pmpd/; revision=17370
-rw-r--r--pmpd-help.pd70
-rw-r--r--pmpd.c221
-rw-r--r--pmpd2d-help.pd72
-rw-r--r--pmpd2d.c7
-rw-r--r--pmpd2d_test.c58
-rw-r--r--pmpd3d-help.pd67
-rw-r--r--pmpd3d.c39
-rw-r--r--pmpd3d_test.c58
-rw-r--r--pmpd_test.c58
9 files changed, 422 insertions, 228 deletions
diff --git a/pmpd-help.pd b/pmpd-help.pd
index 78af86a..80d17cf 100644
--- a/pmpd-help.pd
+++ b/pmpd-help.pd
@@ -1,4 +1,4 @@
-#N canvas 583 200 584 778 10;
+#N canvas 581 205 584 778 10;
#X obj 4 368 cnv 15 550 15 empty empty empty 20 12 0 14 -158509 -66577
0;
#X obj 5 728 cnv 15 550 40 empty empty empty 20 12 0 14 -158509 -66577
@@ -700,18 +700,18 @@ state based on previous time step.;
#X text 161 517 To get the model parameters (links).;
#X text 9 710 KEYWORDS: physical model \, mass \, spring \, damper
\, link;
-#N canvas 676 132 734 663 tests 0;
+#N canvas 828 197 734 704 tests 0;
#X obj 5 3 cnv 15 700 15 empty empty empty 20 12 0 14 -233017 -66577
0;
#X text 17 2 TESTS Messages;
-#X obj 5 45 cnv 15 330 180 empty empty empty 20 12 0 14 -233017 -66577
+#X obj 5 45 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
0;
#X msg 16 50 testMass testId filterId filter_parametter ...;
#X text 377 69 testMass testId mass_number;
#X text 380 130 testMassL filterID 0/1 0/1 0/1 ...;
#X msg 15 155 testMassT tab_name filterId filter_parametter ...;
#X msg 14 99 testMassL testId filterId filter_parametter ....;
-#X text 52 243 masses test can be :;
+#X text 52 280 masses test can be :;
#X text 339 47 output a message for every mass that passes all the
tests:;
#X text 344 99 output a list with 0 or 1 for every mass depending on
@@ -721,42 +721,48 @@ all tests;
#X obj 4 24 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
0;
#X text 17 24 masses :;
-#X obj 9 344 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
-0;
-#X text 22 344 links :;
-#X obj 10 365 cnv 15 330 180 empty empty empty 20 12 0 14 -233017 -66577
-0;
-#X msg 17 374 testLink testId filterId filter_parametter ...;
-#X msg 16 424 testLinkL testId filterId filter_parametter ....;
-#X msg 17 475 testLinkT tab_name filterId filter_parametter ...;
-#X text 377 394 testLink testId mass_number;
-#X text 377 459 testLinkL filterID 0/1 0/1 0/1 ...;
-#X text 58 583 links test can be :;
-#X text 200 583 Id \$1 / forceSup \$1 / forceInf \$1 / forceXSup \$1
-/ forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / lengthSup \$1 / lengthInf
-\$1 / lengthXSup \$1 / lengthXInf \$1 / lengthYSup \$1 / lengthYInf
-\$1 / connectedTo \$1 (symbol or float);
-#X text 345 374 output a message for every link that passes all the
+#X obj 9 374 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
+0;
+#X text 22 374 links :;
+#X obj 10 395 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
+0;
+#X msg 17 404 testLink testId filterId filter_parametter ...;
+#X msg 16 454 testLinkL testId filterId filter_parametter ....;
+#X msg 17 505 testLinkT tab_name filterId filter_parametter ...;
+#X text 377 424 testLink testId mass_number;
+#X text 377 489 testLinkL filterID 0/1 0/1 0/1 ...;
+#X text 58 633 links test can be :;
+#X text 345 404 output a message for every link that passes all the
tests:;
-#X text 346 427 output a list with 0 or 1 for every link depending
+#X text 346 457 output a list with 0 or 1 for every link depending
on whether it passes all tests or not;
-#X text 346 478 Put in a table 0 or 1 depending on whether links pass
+#X text 346 508 Put in a table 0 or 1 depending on whether links pass
all tests;
-#X text 196 241 Id \$1 / posXSup \$1 / posXInf \$1 / posYSup \$1 /
-posYInf \$1 / speedXSup \$1 / speedXInf \$1 / speedYSup \$1 / speedYInf
-\$1 / speedSup \$1 / speedInf \$1 / distanceCircleSup \$1 \$2 \$3 (centerX
-\, centerY \, distance) / distanceCircleInf \$1 \$2 \$3 (centerX \,
-centerY \, distance) / massSup \$1 / massInf \$1 / forceSup \$1 / forceInf
-\$1 / forceXSup \$1 / forceXInf \$1 / forceYSup \$1 / forceYInf \$1
-/ nbLinkInf \$1 / nbLinkSup \$1 / nbLinkEqual \$1 / nbLinkNameInf \$1
-\$2 / nbLinkNameSup \$1 \$2 / nbLinkNameEqual \$1 \$2, f 83;
#X msg 15 205 testMassN massnumber filterId filter_parametter ...;
#X text 346 207 output : testMassN \, mass_id \, mass_number \, 0 or
1 (test result);
-#X msg 17 525 testLinkT link_number filterId filter_parametter ...
+#X msg 17 555 testLinkT link_number filterId filter_parametter ...
;
-#X text 346 526 output : testLinkN \, link_id \, link_number \, 0 or
+#X text 346 556 output : testLinkN \, link_id \, link_number \, 0 or
1 (test result);
+#X text 196 278 Id \$1 / mobile \$1 / posXSup \$1 / posXInf \$1 / posYSup
+\$1 / posYInf \$1 / speedXSup \$1 / speedXInf \$1 / speedYSup \$1 /
+speedYInf \$1 / speedSup \$1 / speedInf \$1 / distanceCircleSup \$1
+\$2 \$3 (centerX \, centerY \, distance) / distanceCircleInf \$1 \$2
+\$3 (centerX \, centerY \, distance) / massSup \$1 / massInf \$1 /
+forceSup \$1 / forceInf \$1 / forceXSup \$1 / forceXInf \$1 / forceYSup
+\$1 / forceYInf \$1 / nbLinkInf \$1 / nbLinkSup \$1 / nbLinkEqual \$1
+/ nbLinkNameInf \$1 \$2 / nbLinkNameSup \$1 \$2 / nbLinkNameEqual \$1
+\$2, f 83;
+#X text 199 633 Id \$1 / active \$1 / forceSup \$1 / forceInf \$1 /
+forceXSup \$1 / forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / lengthSup
+\$1 / lengthInf \$1 / lengthXSup \$1 / lengthXInf \$1 / lengthYSup
+\$1 / lengthYInf \$1 / connectedTo \$1 (symbol or float);
+#X msg 15 245 testMassNumber testId filterId filter_parametter ...
+;
+#X text 347 247 output : testMassN \, testId \, float;
+#X text 347 597 output : testMassN \, testId \, float;
+#X msg 15 595 testLinkN testId filterId filter_parametter ...;
#X restore 12 556 pd tests ______________;
#X text 164 558 To test specific parameters;
#X obj 157 47 pmpd;
diff --git a/pmpd.c b/pmpd.c
index 8c8e6d9..942f190 100644
--- a/pmpd.c
+++ b/pmpd.c
@@ -55,43 +55,43 @@ void pmpd_setup(void)
Basic functions for creation of the structure
*/
class_addbang(pmpd_class, pmpd_bang);
- class_addmethod(pmpd_class, (t_method)pmpd_reset, gensym("reset"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_mass, gensym("mass"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_link, gensym("link"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_tabLink, gensym("tabLink"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_delLink, gensym("delLink"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_delMass, gensym("delMass"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_reset, gensym("reset"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_mass, gensym("mass"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_link, gensym("link"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_tabLink, gensym("tabLink"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_delLink, gensym("delLink"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_delMass, gensym("delMass"), A_GIMME, 0);
/*
pmpd_set
--
Functions to modify the internal state of the pmpd object
*/
- class_addmethod(pmpd_class, (t_method)pmpd_setK, gensym("setK"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setD, gensym("setD"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setPow, gensym("setPow"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setD2, gensym("setDEnv"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setL, gensym("setL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_addL, gensym("addL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setLCurrent, gensym("setLCurrent"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setLKTab, gensym("setLKTab"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setLDTab, gensym("setLDTab"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setLinkId, gensym("setLinkId"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setMassId, gensym("setMassId"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setFixed, gensym("setFixed"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setMobile, gensym("setMobile"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setSpeedX, gensym("setSpeed"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setSpeedX, gensym("setSpeedX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setForceX, gensym("setForce"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setForceX, gensym("setForceX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("pos"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("posX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("setPos"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("setPosX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_overdamp, gensym("setOverdamp"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setEnd1, gensym("setEnd1"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setEnd2, gensym("setEnd2"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_setEnd, gensym("setEnd"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setK, gensym("setK"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setD, gensym("setD"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setPow, gensym("setPow"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setD2, gensym("setDEnv"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setL, gensym("setL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_addL, gensym("addL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setLCurrent, gensym("setLCurrent"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setLKTab, gensym("setLKTab"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setLDTab, gensym("setLDTab"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setLinkId, gensym("setLinkId"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setMassId, gensym("setMassId"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setFixed, gensym("setFixed"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setMobile, gensym("setMobile"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setSpeedX, gensym("setSpeed"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setSpeedX, gensym("setSpeedX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setForceX, gensym("setForce"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setForceX, gensym("setForceX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("pos"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("posX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("setPos"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("setPosX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_overdamp, gensym("setOverdamp"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setEnd1, gensym("setEnd1"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setEnd2, gensym("setEnd2"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_setEnd, gensym("setEnd"), A_GIMME, 0);
/*
pmpd_get
@@ -99,13 +99,13 @@ void pmpd_setup(void)
Basic functions to output internal state of the object
Output syntax : 1 line by element (mass/link)
*/
- class_addmethod(pmpd_class, (t_method)pmpd_get, gensym("get"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massPos, gensym("massPos"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massSpeed, gensym("massSpeed"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massForce, gensym("massForce"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkPos, gensym("linkPos"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEnd, gensym("linkEnd"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkLength, gensym("linkLength"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_get, gensym("get"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massPos, gensym("massPos"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massSpeed, gensym("massSpeed"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massForce, gensym("massForce"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkPos, gensym("linkPos"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEnd, gensym("linkEnd"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkLength, gensym("linkLength"), A_GIMME, 0);
/*
pmpd_list
@@ -135,44 +135,44 @@ void pmpd_setup(void)
Functions to copy the internal state of the object in arrays
Output Syntax : none
*/
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massesPosT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massesSpeedsT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massesForcesT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massesPosXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massesSpeedsXT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massesForcesXT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massesPosT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massesSpeedsT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massesForcesT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massesPosXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massesSpeedsXT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massesForcesXT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massPosT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massSpeedT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massForceT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massPosXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massSpeedXT"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massForceXT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massPosT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massSpeedT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massForceT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosT, gensym("massPosXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsT, gensym("massSpeedXT"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesT, gensym("massForceXT"),A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosT, gensym("linksPosT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linksLengthT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linksPosSpeedT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linksLengthSpeedT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linksLengthT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linksPosSpeedT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linksLengthSpeedT"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosT, gensym("linksPosXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linksLengthXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linksPosSpeedXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linksLengthSpeedXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linksLengthXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linksPosSpeedXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linksLengthSpeedXT"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosT, gensym("linkPosT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linkLengthT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linkPosSpeedT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linkLengthSpeedT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linkLengthT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linkPosSpeedT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linkLengthSpeedT"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosT, gensym("linkPosXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linkLengthXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linkPosSpeedXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linkLengthSpeedXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthT, gensym("linkLengthXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedT, gensym("linkPosSpeedXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedT, gensym("linkLengthSpeedXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEndT, gensym("linksEndT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEnd1T, gensym("linkEnd1T"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEnd2T, gensym("linkEnd2T"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEndT, gensym("linkEndXT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEnd1T, gensym("linkEnd1XT"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkEnd2T, gensym("linkEnd2XT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEndT, gensym("linksEndT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEnd1T, gensym("linkEnd1T"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEnd2T, gensym("linkEnd2T"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEndT, gensym("linkEndXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEnd1T, gensym("linkEnd1XT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkEnd2T, gensym("linkEnd2XT"), A_GIMME, 0);
/*
pmpd_test
@@ -186,9 +186,10 @@ void pmpd_setup(void)
class_addmethod(pmpd_class, (t_method)pmpd_testLinkT, gensym("testLinkT"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_testMassL, gensym("testMassL"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_testLinkL, gensym("testLinkL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_testMassL, gensym("testMassN"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_testLinkL, gensym("testLinkN"), A_GIMME, 0);
-
+ class_addmethod(pmpd_class, (t_method)pmpd_testMassN, gensym("testMassN"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_testLinkN, gensym("testLinkN"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_testMassNumber, gensym("testMassNumber"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_testLinkNumber, gensym("testLinkNumber"), A_GIMME, 0);
/*
pmpd_stat
--
@@ -209,35 +210,35 @@ void pmpd_setup(void)
class_addmethod(pmpd_class, (t_method)pmpd_linkPosSpeedStd, gensym("linkPosSpeedStd"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linkLengthSpeedStd, gensym("linkLengthSpeedStd"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massInfo, gensym("massInfo"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkInfo, gensym("linkInfo"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massNumber, gensym("massNumber"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linkNumber, gensym("linkNumber"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massInfo, gensym("massInfo"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkInfo, gensym("linkInfo"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massNumber, gensym("massNumber"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linkNumber, gensym("linkNumber"), A_GIMME, 0);
/*
pmpd_various
--
Others
*/
- class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("infosL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("print"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX, gensym("force"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX, gensym("forceX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("Xmin"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("min"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("minX"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("Xmax"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("max"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("maxX"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("infosL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("print"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_forceX, gensym("force"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_forceX, gensym("forceX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("Xmin"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("min"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_minX, gensym("minX"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("Xmax"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("max"), A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_maxX, gensym("maxX"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_addPosX, gensym("addPos"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_addPosX, gensym("addPosX"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_addPosX, gensym("addPos"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_addPosX, gensym("addPosX"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_grabMass, gensym("grabMass"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_closestMass, gensym("closestMass"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_closestMassN, gensym("closestMassN"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massDistances, gensym("massDistance"), A_GIMME, 0);
-// class_addmethod(pmpd_class, (t_method)pmpd_forcesXT, gensym("forceXT"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_grabMass, gensym("grabMass"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_closestMass, gensym("closestMass"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_closestMassN, gensym("closestMassN"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massDistances, gensym("massDistance"), A_GIMME, 0);
+// class_addmethod(pmpd_class, (t_method)pmpd_forcesXT, gensym("forceXT"), A_GIMME, 0);
/*
pmpd_deprecated
@@ -245,27 +246,27 @@ void pmpd_setup(void)
Functions in which the output selector has been modified
It is now the same as the input slector : all singular
*/
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosL, gensym("massesPosL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsL, gensym("massesSpeedsL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesL, gensym("massesForcesL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosL, gensym("massesPosXL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsL, gensym("massesSpeedsXL"), 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesL, gensym("massesForcesXL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosL, gensym("massesPosL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsL, gensym("massesSpeedsL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesL, gensym("massesForcesL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosL, gensym("massesPosXL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsL, gensym("massesSpeedsXL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesL, gensym("massesForcesXL"), 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosL, gensym("linksPosL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthL, gensym("linksLengthL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedL, gensym("linksPosSpeedL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedL, gensym("linksLengthSpeedL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthL, gensym("linksLengthL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedL, gensym("linksPosSpeedL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedL, gensym("linksLengthSpeedL"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_linksPosL, gensym("linksPosXL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthL, gensym("linksLengthXL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedL, gensym("linksPosSpeedXL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedL, gensym("linksLengthSpeedXL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthL, gensym("linksLengthXL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksPosSpeedL, gensym("linksPosSpeedXL"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_linksLengthSpeedL, gensym("linksLengthSpeedXL"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosMean, gensym("massesPosMean"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesPosStd, gensym("massesPosStd"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesMean,gensym("massesForcesMean"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesForcesStd, gensym("massesForcesStd"),A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsMean,gensym("massesSpeedsMean"), A_GIMME, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsStd, gensym("massesSpeedsStd"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosMean, gensym("massesPosMean"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesPosStd, gensym("massesPosStd"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesMean, gensym("massesForcesMean"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesForcesStd, gensym("massesForcesStd"),A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsMean, gensym("massesSpeedsMean"), A_GIMME, 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_massesSpeedsStd, gensym("massesSpeedsStd"),A_GIMME, 0);
}
diff --git a/pmpd2d-help.pd b/pmpd2d-help.pd
index 4e89f06..d90b4a9 100644
--- a/pmpd2d-help.pd
+++ b/pmpd2d-help.pd
@@ -1,4 +1,4 @@
-#N canvas 265 229 572 750 10;
+#N canvas 263 234 572 750 10;
#X declare -lib Gem;
#X obj 4 309 cnv 15 550 15 empty empty empty 20 12 0 14 -158509 -66577
0;
@@ -822,18 +822,18 @@ a table;
#X text 794 523 \$3 : y position;
#X text 794 537 \$4 : none or Id;
#X restore 12 447 pd masses_attributes___;
-#N canvas 254 391 728 639 tests 0;
+#N canvas 252 263 751 772 tests 0;
#X obj 5 3 cnv 15 700 15 empty empty empty 20 12 0 14 -233017 -66577
0;
#X text 17 2 TESTS Messages;
-#X obj 5 45 cnv 15 330 200 empty empty empty 20 12 0 14 -233017 -66577
+#X obj 5 44 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
0;
#X msg 16 50 testMass testId filterId filter_parametter ...;
#X text 377 69 testMass testId mass_number;
#X text 380 130 testMassL filterID 0/1 0/1 0/1 ...;
#X msg 15 155 testMassT tab_name filterId filter_parametter ...;
#X msg 14 99 testMassL testId filterId filter_parametter ....;
-#X text 52 247 masses test can be :;
+#X text 52 277 masses test can be :;
#X text 339 47 output a message for every mass that passes all the
tests:;
#X text 344 99 output a list with 0 or 1 for every mass depending on
@@ -843,42 +843,48 @@ all tests;
#X obj 4 24 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
0;
#X text 17 24 masses :;
-#X obj 9 344 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
-0;
-#X text 22 344 links :;
-#X obj 10 365 cnv 15 330 200 empty empty empty 20 12 0 14 -233017 -66577
-0;
-#X msg 17 374 testLink testId filterId filter_parametter ...;
-#X msg 16 424 testLinkL testId filterId filter_parametter ....;
-#X msg 17 475 testLinkT tab_name filterId filter_parametter ...;
-#X text 377 394 testLink testId mass_number;
-#X text 377 459 testLinkL filterID 0/1 0/1 0/1 ...;
-#X text 58 573 links test can be :;
-#X text 200 573 Id \$1 / forceSup \$1 / forceInf \$1 / forceXSup \$1
-/ forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / lengthSup \$1 / lengthInf
-\$1 / lengthXSup \$1 / lengthXInf \$1 / lengthYSup \$1 / lengthYInf
-\$1 / connectedTo \$1 (symbol or float);
-#X text 345 374 output a message for every link that passes all the
+#X obj 9 374 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
+0;
+#X text 22 374 links :;
+#X obj 10 395 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
+0;
+#X msg 17 404 testLink testId filterId filter_parametter ...;
+#X msg 16 454 testLinkL testId filterId filter_parametter ....;
+#X msg 17 505 testLinkT tab_name filterId filter_parametter ...;
+#X text 377 424 testLink testId mass_number;
+#X text 377 489 testLinkL filterID 0/1 0/1 0/1 ...;
+#X text 58 633 links test can be :;
+#X text 345 404 output a message for every link that passes all the
tests:;
-#X text 346 427 output a list with 0 or 1 for every link depending
+#X text 346 457 output a list with 0 or 1 for every link depending
on whether it passes all tests or not;
-#X text 346 478 Put in a table 0 or 1 depending on whether links pass
+#X text 346 508 Put in a table 0 or 1 depending on whether links pass
all tests;
-#X text 196 247 Id \$1 / posXSup \$1 / posXInf \$1 / posYSup \$1 /
-posYInf \$1 / speedXSup \$1 / speedXInf \$1 / speedYSup \$1 / speedYInf
-\$1 / speedSup \$1 / speedInf \$1 / distanceCircleSup \$1 \$2 \$3 (centerX
-\, centerY \, distance) / distanceCircleInf \$1 \$2 \$3 (centerX \,
-centerY \, distance) / massSup \$1 / massInf \$1 / forceSup \$1 / forceInf
-\$1 / forceXSup \$1 / forceXInf \$1 / forceYSup \$1 / forceYInf \$1
-/ nbLinkInf \$1 / nbLinkSup \$1 / nbLinkEqual \$1 / nbLinkNameInf \$1
-\$2 / nbLinkNameSup \$1 \$2 / nbLinkNameEqual \$1 \$2, f 83;
#X msg 15 205 testMassN massnumber filterId filter_parametter ...;
-#X msg 17 525 testLinkT link_number filterId filter_parametter ...
-;
-#X text 346 526 output : testLinkN \, link_id \, link_number \, 0 or
+#X text 346 556 output : testLinkN \, link_id \, link_number \, 0 or
1 (test result);
#X text 346 207 output : testMassN \, mass_id \, mass_number \, 0 or
1 (test result);
+#X text 196 277 Id \$1 / mobile \$1 / posXSup \$1 / posXInf \$1 / posYSup
+\$1 / posYInf \$1 / speedXSup \$1 / speedXInf \$1 / speedYSup \$1 /
+speedYInf \$1 / speedSup \$1 / speedInf \$1 / distanceCircleSup \$1
+\$2 \$3 (centerX \, centerY \, distance) / distanceCircleInf \$1 \$2
+\$3 (centerX \, centerY \, distance) / massSup \$1 / massInf \$1 /
+forceSup \$1 / forceInf \$1 / forceXSup \$1 / forceXInf \$1 / forceYSup
+\$1 / forceYInf \$1 / nbLinkInf \$1 / nbLinkSup \$1 / nbLinkEqual \$1
+/ nbLinkNameInf \$1 \$2 / nbLinkNameSup \$1 \$2 / nbLinkNameEqual \$1
+\$2, f 83;
+#X text 200 633 Id \$1 / active \$1 / forceSup \$1 / forceInf \$1 /
+forceXSup \$1 / forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / lengthSup
+\$1 / lengthInf \$1 / lengthXSup \$1 / lengthXInf \$1 / lengthYSup
+\$1 / lengthYInf \$1 / connectedTo \$1 (symbol or float);
+#X msg 17 555 testLinkN link_number filterId filter_parametter ...
+;
+#X msg 15 245 testMassNumber testId filterId filter_parametter ...
+;
+#X text 347 247 output : testMassN \, testId \, float;
+#X text 347 597 output : testMassN \, testId \, float;
+#X msg 15 595 testLinkN testId filterId filter_parametter ...;
#X restore 12 486 pd tests ______________;
#N canvas 1081 499 709 556 interactors 0;
#X obj 30 11 cnv 15 600 15 empty empty empty 20 12 0 14 -233017 -66577
diff --git a/pmpd2d.c b/pmpd2d.c
index 9deac51..db61e8b 100644
--- a/pmpd2d.c
+++ b/pmpd2d.c
@@ -250,9 +250,10 @@ pmpd2d_class = class_new(gensym("pmpd2d"),
class_addmethod(pmpd2d_class, (t_method)pmpd2d_testLinkT, gensym("testLinkT"), A_GIMME, 0);
class_addmethod(pmpd2d_class, (t_method)pmpd2d_testMassL, gensym("testMassL"), A_GIMME, 0);
class_addmethod(pmpd2d_class, (t_method)pmpd2d_testLinkL, gensym("testLinkL"), A_GIMME, 0);
- class_addmethod(pmpd2d_class, (t_method)pmpd2d_testMassL, gensym("testMassN"), A_GIMME, 0);
- class_addmethod(pmpd2d_class, (t_method)pmpd2d_testLinkL, gensym("testLinkN"), A_GIMME, 0);
-
+ class_addmethod(pmpd2d_class, (t_method)pmpd2d_testMassN, gensym("testMassN"), A_GIMME, 0);
+ class_addmethod(pmpd2d_class, (t_method)pmpd2d_testLinkN, gensym("testLinkN"), A_GIMME, 0);
+ class_addmethod(pmpd2d_class, (t_method)pmpd2d_testMassNumber, gensym("testMassNumber"), A_GIMME, 0);
+ class_addmethod(pmpd2d_class, (t_method)pmpd2d_testLinkNumber, gensym("testLinkNumber"), A_GIMME, 0);
/*
pmpd2d_stat
--
diff --git a/pmpd2d_test.c b/pmpd2d_test.c
index 092dd31..74dd844 100644
--- a/pmpd2d_test.c
+++ b/pmpd2d_test.c
@@ -17,6 +17,11 @@ int test_2d_mass(int i, t_pmpd2d *x, int argc, t_atom *argv)
if ( x->mass[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
}
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("mobile") )
+ {
+ if ( x->mass[i].mobile != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
+ }
else if (atom_getsymbolarg(j,argc,argv) == gensym("posXSup") )
{
if ( x->mass[i].posX < atom_getfloatarg(j+1,argc,argv) ) { return(0); }
@@ -210,6 +215,11 @@ int test_2d_link(int i, t_pmpd2d *x, int argc, t_atom *argv)
if ( x->link[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
}
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("active") )
+ {
+ if ( x->link[i].active != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
+ }
else if (atom_getsymbolarg(j,argc,argv) == gensym("lengthSup") )
{
if ( x->link[i].distance < atom_getfloatarg(j+1,argc,argv) ) { return(0); }
@@ -503,3 +513,51 @@ void pmpd2d_testMassN(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv)
outlet_anything(x->main_outlet, gensym("testMassN"),3,std_out);
}
+
+void pmpd2d_testLinkNumber(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb=0;
+ for (i=0; i < x->nb_link; i++)
+ {
+ tmp=test_2d_link(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testLinkNumber"),2,std_out);
+}
+
+void pmpd2d_testMassNumber(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb = 0;
+ for (i=0; i < x->nb_mass; i++)
+ {
+ tmp=test_2d_mass(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testMassNumber"),2,std_out);
+}
diff --git a/pmpd3d-help.pd b/pmpd3d-help.pd
index f7e611e..db5dfba 100644
--- a/pmpd3d-help.pd
+++ b/pmpd3d-help.pd
@@ -1,4 +1,4 @@
-#N canvas 964 299 570 717 10;
+#N canvas 962 304 570 717 10;
#X declare -lib Gem;
#X obj 4 289 cnv 15 550 15 empty empty empty 20 12 0 14 -158509 -66577
0;
@@ -826,23 +826,18 @@ defining the characteristic step by step.;
#X text 416 133 1 Create window;
#X msg 318 211 forceZ 1 30;
#X msg 318 233 forceX mob 10;
-#N canvas 672 253 780 683 tests 0;
-#X text 183 612 Id \$1 / forceSup \$1 / forceInf \$1 / forceXSup \$1
-/ forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / forceZSup \$1 / forceZInf
-\$1 / lengthSup \$1 / lengthInf \$1 / lengthXSup \$1 / lengthXInf \$1
-/ lengthYSup \$1 / lengthYInf \$1 / lengthZSup \$1 / lengthZInf \$1
-/ connectedTo \$1 (symbol or float);
+#N canvas 670 205 787 736 tests 0;
#X obj 5 3 cnv 15 700 15 empty empty empty 20 12 0 14 -233017 -66577
0;
#X text 17 2 TESTS Messages;
-#X obj 5 45 cnv 15 330 200 empty empty empty 20 12 0 14 -233017 -66577
+#X obj 5 45 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
0;
#X msg 16 50 testMass testId filterId filter_parametter ...;
#X text 377 69 testMass testId mass_number;
#X text 380 130 testMassL filterID 0/1 0/1 0/1 ...;
#X msg 15 155 testMassT tab_name filterId filter_parametter ...;
#X msg 14 99 testMassL testId filterId filter_parametter ....;
-#X text 52 253 masses test can be :;
+#X text 52 283 masses test can be :;
#X text 339 47 output a message for every mass that passes all the
tests:;
#X text 344 99 output a list with 0 or 1 for every mass depending on
@@ -852,25 +847,32 @@ all tests;
#X obj 4 24 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
0;
#X text 17 24 masses :;
-#X obj 9 374 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
-0;
-#X text 22 374 links :;
-#X obj 10 395 cnv 15 330 200 empty empty empty 20 12 0 14 -233017 -66577
-0;
-#X msg 17 404 testLink testId filterId filter_parametter ...;
-#X msg 16 454 testLinkL testId filterId filter_parametter ....;
-#X msg 17 505 testLinkT tab_name filterId filter_parametter ...;
-#X text 377 424 testLink testId mass_number;
-#X text 377 489 testLinkL filterID 0/1 0/1 0/1 ...;
-#X text 58 613 links test can be :;
-#X text 345 404 output a message for every link that passes all the
+#X obj 9 404 cnv 15 700 15 empty empty empty 20 12 0 14 -158509 -66577
+0;
+#X text 22 404 links :;
+#X obj 10 425 cnv 15 330 230 empty empty empty 20 12 0 14 -233017 -66577
+0;
+#X msg 17 434 testLink testId filterId filter_parametter ...;
+#X msg 16 484 testLinkL testId filterId filter_parametter ....;
+#X msg 17 535 testLinkT tab_name filterId filter_parametter ...;
+#X text 377 454 testLink testId mass_number;
+#X text 377 519 testLinkL filterID 0/1 0/1 0/1 ...;
+#X text 58 673 links test can be :;
+#X text 345 434 output a message for every link that passes all the
tests:;
-#X text 346 457 output a list with 0 or 1 for every link depending
+#X text 346 487 output a list with 0 or 1 for every link depending
on whether it passes all tests or not;
-#X text 346 508 Put in a table 0 or 1 depending on whether links pass
+#X text 346 538 Put in a table 0 or 1 depending on whether links pass
all tests;
-#X text 182 254 Id \$1 / posXSup \$1 / posXInf \$1 / posYSup \$1 /
-posYInf \$1 / posZSup \$1 / posZInf \$1 / speedXSup \$1 / speedXInf
+#X msg 15 205 testMassN massnumber filterId filter_parametter ...;
+#X text 346 207 output : testMassN \, mass_id \, mass_number \, 0 or
+1 (test result);
+#X msg 17 585 testLinkT link_number filterId filter_parametter ...
+;
+#X text 346 586 output : testLinkN \, link_id \, link_number \, 0 or
+1 (test result);
+#X text 182 284 Id \$1 / mobile \$1 / posXSup \$1 / posXInf \$1 / posYSup
+\$1 / posYInf \$1 / posZSup \$1 / posZInf \$1 / speedXSup \$1 / speedXInf
\$1 / speedYSup \$1 / speedYInf \$1 / speedZSup \$1 / speedZInf \$1
/ speedSup \$1 / speedInf \$1 / distanceCircleSup \$1 \$2 \$3 \$4 (centerX
\, centerY \, centerZ \, distance) / distanceCircleInf \$1 \$2 \$3
@@ -879,13 +881,16 @@ posYInf \$1 / posZSup \$1 / posZInf \$1 / speedXSup \$1 / speedXInf
forceYSup \$1 / forceYInf \$1 / forceZSup \$1 / forceZInf \$1 / nbLinkInf
\$1 / nbLinkSup \$1 / nbLinkEqual \$1 / nbLinkNameInf \$1 \$2 / nbLinkNameSup
\$1 \$2 / nbLinkNameEqual \$1 \$2, f 86;
-#X msg 15 205 testMassN massnumber filterId filter_parametter ...;
-#X text 346 207 output : testMassN \, mass_id \, mass_number \, 0 or
-1 (test result);
-#X msg 17 555 testLinkT link_number filterId filter_parametter ...
+#X text 183 672 Id \$1 / active \$1 / forceSup \$1 / forceInf \$1 /
+forceXSup \$1 / forceXInf \$1 / forceYSup \$1 / forceYInf \$1 / forceZSup
+\$1 / forceZInf \$1 / lengthSup \$1 / lengthInf \$1 / lengthXSup \$1
+/ lengthXInf \$1 / lengthYSup \$1 / lengthYInf \$1 / lengthZSup \$1
+/ lengthZInf \$1 / connectedTo \$1 (symbol or float);
+#X msg 15 245 testMassNumber testId filterId filter_parametter ...
;
-#X text 346 556 output : testLinkN \, link_id \, link_number \, 0 or
-1 (test result);
+#X text 347 247 output : testMassN \, testId \, float;
+#X text 347 617 output : testMassN \, testId \, float;
+#X msg 15 615 testLinkN testId filterId filter_parametter ...;
#X restore 12 457 pd tests ______________;
#X text 158 458 To test specific parametters;
#N canvas 401 550 627 463 interactors 0;
diff --git a/pmpd3d.c b/pmpd3d.c
index 5be393e..5ff190a 100644
--- a/pmpd3d.c
+++ b/pmpd3d.c
@@ -163,10 +163,10 @@ void pmpd3d_setup(void)
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedZL, gensym("linkPosSpeedZL"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedZL, gensym("linkLengthSpeedZL"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormL, gensym("linkPosNormL"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormL, gensym("linkLengthNormL"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormL, gensym("linkPosSpeedNormL"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormL, gensym("linkLengthSpeedNormL"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormL, gensym("linkPosNormL"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormL, gensym("linkLengthNormL"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormL, gensym("linkPosSpeedNormL"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormL, gensym("linkLengthSpeedNormL"), A_GIMME, 0);
/*
pmpd3d_tab
@@ -243,15 +243,15 @@ void pmpd3d_setup(void)
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedZT, gensym("linkPosSpeedZT"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedZT, gensym("linkLengthSpeedZT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormT, gensym("linksPosNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormT, gensym("linksLengthNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormT, gensym("linksPosSpeedNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormT, gensym("linksLengthSpeedNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormT, gensym("linksPosNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormT, gensym("linksLengthNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormT, gensym("linksPosSpeedNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormT, gensym("linksLengthSpeedNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormT, gensym("linkPosNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormT, gensym("linkLengthNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormT, gensym("linkPosSpeedNormT"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormT, gensym("linkLengthSpeedNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosNormT, gensym("linkPosNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthNormT, gensym("linkLengthNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedNormT, gensym("linkPosSpeedNormT"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedNormT, gensym("linkLengthSpeedNormT"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkEndT, gensym("linkEndT"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkEnd1T, gensym("linkEnd1T"), A_GIMME, 0);
@@ -278,9 +278,10 @@ void pmpd3d_setup(void)
class_addmethod(pmpd3d_class, (t_method)pmpd3d_testLinkT, gensym("testLinkT"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_testMassL, gensym("testMassL"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_testLinkL, gensym("testLinkL"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_testMassL, gensym("testMassN"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_testLinkL, gensym("testLinkN"), A_GIMME, 0);
-
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_testMassN, gensym("testMassN"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_testLinkN, gensym("testLinkN"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_testMassNumber, gensym("testMassNumber"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_testLinkNumber, gensym("testLinkNumber"), A_GIMME, 0);
/*
pmpd3d_stat
--
@@ -303,10 +304,10 @@ void pmpd3d_setup(void)
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkPosSpeedStd, gensym("linkPosSpeedStd"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkLengthSpeedStd, gensym("linkLengthSpeedStd"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_massInfo, gensym("massInfo"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkInfo, gensym("linkInfo"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_massNumber, gensym("massNumber"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkNumber, gensym("linkNumber"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_massInfo, gensym("massInfo"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkInfo, gensym("linkInfo"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_massNumber, gensym("massNumber"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_linkNumber, gensym("linkNumber"), A_GIMME, 0);
/*
pmpd3d_interactor
--
diff --git a/pmpd3d_test.c b/pmpd3d_test.c
index 7d2c116..d5ddf4c 100644
--- a/pmpd3d_test.c
+++ b/pmpd3d_test.c
@@ -15,6 +15,11 @@ int test_3d_mass(int i, t_pmpd3d *x, int argc, t_atom *argv)
if ( x->mass[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
}
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("mobile") )
+ {
+ if ( x->mass[i].mobile != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
+ }
else if (atom_getsymbolarg(j,argc,argv) == gensym("posXSup") )
{
if ( x->mass[i].posX < atom_getfloatarg(j+1,argc,argv) ) { return(0); }
@@ -237,6 +242,11 @@ int test_3d_link(int i, t_pmpd3d *x, int argc, t_atom *argv)
{
if ( x->link[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
+ }
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("active") )
+ {
+ if ( x->link[i].active != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
}
else if (atom_getsymbolarg(j,argc,argv) == gensym("forceXSup") )
{
@@ -553,3 +563,51 @@ void pmpd3d_testMassN(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
outlet_anything(x->main_outlet, gensym("testMassN"),3,std_out);
}
+
+void pmpd3d_testLinkNumber(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb=0;
+ for (i=0; i < x->nb_link; i++)
+ {
+ tmp=test_3d_link(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testLinkNumber"),2,std_out);
+}
+
+void pmpd3d_testMassNumber(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb = 0;
+ for (i=0; i < x->nb_mass; i++)
+ {
+ tmp=test_3d_mass(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testMassNumber"),2,std_out);
+}
diff --git a/pmpd_test.c b/pmpd_test.c
index f5b49f8..1fb50a3 100644
--- a/pmpd_test.c
+++ b/pmpd_test.c
@@ -15,6 +15,11 @@ int test_1d_mass(int i, t_pmpd *x, int argc, t_atom *argv)
if ( x->mass[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
}
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("mobile") )
+ {
+ if ( x->mass[i].mobile != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
+ }
else if (atom_getsymbolarg(j,argc,argv) == gensym("posXSup") )
{
if ( x->mass[i].posX < atom_getfloatarg(j+1,argc,argv) ) { return(0); }
@@ -175,6 +180,11 @@ int test_1d_link(int i, t_pmpd *x, int argc, t_atom *argv)
{
if ( x->link[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { return(0); }
j+=2;
+ }
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("active") )
+ {
+ if ( x->link[i].active != atom_getfloatarg(j+1,argc,argv) ) { return(0); }
+ j+=2;
}
else if (atom_getsymbolarg(j,argc,argv) == gensym("forceXSup") )
{
@@ -443,3 +453,51 @@ void pmpd_testMassN(t_pmpd *x, t_symbol *s, int argc, t_atom *argv)
outlet_anything(x->main_outlet, gensym("testMassN"),3,std_out);
}
+
+void pmpd_testLinkNumber(t_pmpd *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb=0;
+ for (i=0; i < x->nb_link; i++)
+ {
+ tmp=test_link(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testLinkNumber"),2,std_out);
+}
+
+void pmpd_testMassNumber(t_pmpd *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_int i, tmp, nb;
+ t_atom std_out[2];
+
+ SETSYMBOL(&(std_out[0]),atom_getsymbolarg(0,argc,argv));
+
+ nb = 0;
+ for (i=0; i < x->nb_mass; i++)
+ {
+ tmp=test_mass(i,x,argc,argv);
+ if (tmp == -1)
+ {
+ break;
+ }
+ else if (tmp)
+ {
+ nb++;
+ }
+ }
+ SETFLOAT(&(std_out[1]),nb);
+ outlet_anything(x->main_outlet, gensym("testMassNumber"),2,std_out);
+}