diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-02-13 15:07:32 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-02-13 15:07:32 +0000 |
commit | b874731a80644ddbec3e47def44bfb7ce2a65e45 (patch) | |
tree | c8151a2045ca022124e2b219c726a595401e5aeb | |
parent | 7f927c2f4a64c883eaab73472291c8aed2d769a8 (diff) |
bugfix
svn path=/trunk/externals/pmpd/; revision=17032
-rw-r--r-- | TODO.txt | 41 | ||||
-rw-r--r-- | pmpd3d_get.c | 20 | ||||
-rw-r--r-- | pmpd3d_list.c | 326 | ||||
-rw-r--r-- | pmpd3d_set.c | 116 |
4 files changed, 283 insertions, 220 deletions
@@ -17,36 +17,37 @@ DONE : - new statistics messages for links - interactors messages +messages mass list : mette la sortie au synguler + TODO : -setLFactor [Id] multiplication factor +setLFactor [Id] multiplication_factor closestNeighbor linkEndL add creation parametter to fix maximum number of link and mass messages a tester : - class_addmethod(pmpd3d_class, (t_method)pmpd3d_setLCurrent, gensym("setLCurrent"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_setFixed, gensym("setActive"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_setMobile, gensym("setInactive"), A_GIMME, 0); - +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_setLCurrent, gensym("setLCurrent"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_setActive, gensym("setActive"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_setInactive, gensym("setInactive"), A_GIMME, 0); # class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPos, gensym("massPos"), A_GIMME, 0); # class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeeds, gensym("massSpeed"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForces, gensym("massForce"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_linksPos, gensym("linkPos"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_linksEnds, gensym("linkEnd"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForces, gensym("massForce"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_linksPos, gensym("linkPos"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_linksEnds, gensym("linkEnd"), A_GIMME, 0); //pmpd3d_list - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosL, gensym("massPosL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsL, gensym("massSpeedL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesL, gensym("massForceL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosXL, gensym("massPosXL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsXL, gensym("massSpeedXL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesXL, gensym("massForceXL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosYL, gensym("massPosYL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsYL, gensym("massSpeedYL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesYL, gensym("massForceYL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosZL, gensym("massPosZL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsZL, gensym("massSpeedZL"), A_GIMME, 0); - class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesZL, gensym("massForceZL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosL, gensym("massPosL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsL, gensym("massSpeedL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesL, gensym("massForceL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosXL, gensym("massPosXL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsXL, gensym("massSpeedXL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesXL, gensym("massForceXL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosYL, gensym("massPosYL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsYL, gensym("massSpeedYL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesYL, gensym("massForceYL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosZL, gensym("massPosZL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsZL, gensym("massSpeedZL"), A_GIMME, 0); +# class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesZL, gensym("massForceZL"), A_GIMME, 0); class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPosNormL, gensym("massPosNormL"), A_GIMME, 0); class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesSpeedsNormL, gensym("massSpeedNormL"), A_GIMME, 0); class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesForcesNormL, gensym("massForceNormL"), A_GIMME, 0); diff --git a/pmpd3d_get.c b/pmpd3d_get.c index dba3915..ce00e05 100644 --- a/pmpd3d_get.c +++ b/pmpd3d_get.c @@ -503,7 +503,7 @@ void pmpd3d_linksEnds(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) i = atom_getfloatarg(0, argc, argv); if ( (i>=0) && (i<x->nb_mass) ) { - SETSYMBOL(&(toout[0]), x->mass[i].Id); + SETSYMBOL(&(toout[0]), x->link[i].Id); SETFLOAT(&(toout[1]), i); SETFLOAT(&(toout[2]), x->link[i].mass1->posX); SETFLOAT(&(toout[3]), x->link[i].mass1->posY); @@ -517,9 +517,9 @@ void pmpd3d_linksEnds(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) else if ((argc>0)&&(argv[0].a_type == A_SYMBOL)) { + SETSYMBOL(&(toout[0]), atom_getsymbolarg(0,argc,argv)); for (i=0; i< x->nb_link; i++) { - SETSYMBOL(&(toout[0]), atom_getsymbolarg(0,argc,argv)); if ( atom_getsymbolarg(0,argc,argv) == x->link[i].Id) { SETFLOAT(&(toout[1]), i); @@ -538,7 +538,7 @@ void pmpd3d_linksEnds(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { for (i=0; i< x->nb_link; i++) { - SETSYMBOL(&(toout[0]), x->mass[i].Id); + SETSYMBOL(&(toout[0]), x->link[i].Id); SETFLOAT(&(toout[1]), i); SETFLOAT(&(toout[2]), x->link[i].mass1->posX); SETFLOAT(&(toout[3]), x->link[i].mass1->posY); @@ -559,29 +559,29 @@ void pmpd3d_linksPos(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) if ((argc>0)&&(argv[0].a_type == A_FLOAT)) { i = atom_getfloatarg(0, argc, argv); - if ( (i>=0) && (i<x->nb_mass) ) + if ( (i>=0) && (i<x->nb_link) ) { - SETSYMBOL(&(toout[0]), x->mass[i].Id); + SETSYMBOL(&(toout[0]), x->link[i].Id); SETFLOAT(&(toout[1]), i); SETFLOAT(&(toout[2]), (x->link[i].mass1->posX+x->link[i].mass2->posX)/2); SETFLOAT(&(toout[3]), (x->link[i].mass1->posY+x->link[i].mass2->posY)/2); SETFLOAT(&(toout[4]), (x->link[i].mass1->posZ+x->link[i].mass2->posZ)/2); - outlet_anything(x->main_outlet, gensym("linkEnd"), 5, toout); + outlet_anything(x->main_outlet, gensym("linkPos"), 5, toout); } } else if ((argc>0)&&(argv[0].a_type == A_SYMBOL)) { + SETSYMBOL(&(toout[0]), atom_getsymbolarg(0,argc,argv)); for (i=0; i< x->nb_link; i++) { - SETSYMBOL(&(toout[0]), atom_getsymbolarg(0,argc,argv)); if ( atom_getsymbolarg(0,argc,argv) == x->link[i].Id) { SETFLOAT(&(toout[1]), i); SETFLOAT(&(toout[2]), (x->link[i].mass1->posX+x->link[i].mass2->posX)/2); SETFLOAT(&(toout[3]), (x->link[i].mass1->posY+x->link[i].mass2->posY)/2); SETFLOAT(&(toout[4]), (x->link[i].mass1->posZ+x->link[i].mass2->posZ)/2); - outlet_anything(x->main_outlet, gensym("linkEnd"), 5, toout); + outlet_anything(x->main_outlet, gensym("linkPos"), 5, toout); } } } @@ -590,12 +590,12 @@ void pmpd3d_linksPos(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { for (i=0; i< x->nb_link; i++) { - SETSYMBOL(&(toout[0]), x->mass[i].Id); + SETSYMBOL(&(toout[0]), x->link[i].Id); SETFLOAT(&(toout[1]), i); SETFLOAT(&(toout[2]), (x->link[i].mass1->posX+x->link[i].mass2->posX)/2); SETFLOAT(&(toout[3]), (x->link[i].mass1->posY+x->link[i].mass2->posY)/2); SETFLOAT(&(toout[4]), (x->link[i].mass1->posZ+x->link[i].mass2->posZ)/2); - outlet_anything(x->main_outlet, gensym("linkEnd"), 5, toout); + outlet_anything(x->main_outlet, gensym("linkPos"), 5, toout); } } } diff --git a/pmpd3d_list.c b/pmpd3d_list.c index e527480..d212107 100644 --- a/pmpd3d_list.c +++ b/pmpd3d_list.c @@ -3,7 +3,8 @@ void pmpd3d_massesPosL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[3*x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i < x->nb_mass; i++) { SETFLOAT(&(pos_list[3*i] ),x->mass[i].posX); @@ -12,27 +13,30 @@ void pmpd3d_massesPosL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } outlet_anything(x->main_outlet, gensym("massesPosL"),3*x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[3*i] ),x->mass[i].posX); - SETFLOAT(&(pos_list[3*i+1]),x->mass[i].posY); - SETFLOAT(&(pos_list[3*i+2]),x->mass[i].posZ); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[3*i] ),x->mass[j].posX); + SETFLOAT(&(pos_list[3*i+1]),x->mass[j].posY); + SETFLOAT(&(pos_list[3*i+2]),x->mass[j].posZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesPosL"),3*i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posX); SETFLOAT(&(pos_list[1]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posY); SETFLOAT(&(pos_list[2]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posZ); - outlet_anything(x->main_outlet, gensym("massesPosL"),1 , pos_list); + outlet_anything(x->main_outlet, gensym("massesPosL"),3 , pos_list); } } @@ -41,7 +45,8 @@ void pmpd3d_massesForcesL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[3*x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[3*i] ),x->mass[i].forceX); SETFLOAT(&(pos_list[3*i+1]),x->mass[i].forceY); @@ -49,27 +54,30 @@ void pmpd3d_massesForcesL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } outlet_anything(x->main_outlet, gensym("massesForcesL"),3*x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[3*i] ),x->mass[i].forceX); - SETFLOAT(&(pos_list[3*i+1]),x->mass[i].forceY); - SETFLOAT(&(pos_list[3*i+2]),x->mass[i].forceZ); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[3*i] ),x->mass[j].forceX); + SETFLOAT(&(pos_list[3*i+1]),x->mass[j].forceY); + SETFLOAT(&(pos_list[3*i+2]),x->mass[j].forceZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesForcesL"),3*i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceX); SETFLOAT(&(pos_list[1]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceY); SETFLOAT(&(pos_list[2]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceZ); - outlet_anything(x->main_outlet, gensym("massesForcesZL"),3 , pos_list); + outlet_anything(x->main_outlet, gensym("massesForcesL"),3 , pos_list); } } @@ -78,7 +86,8 @@ void pmpd3d_massesSpeedsL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[3*x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[3*i] ),x->mass[i].speedX); SETFLOAT(&(pos_list[3*i+1]),x->mass[i].speedY); @@ -86,22 +95,25 @@ void pmpd3d_massesSpeedsL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } outlet_anything(x->main_outlet, gensym("massesSpeedsL"),3*x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[3*i] ),x->mass[i].speedX); - SETFLOAT(&(pos_list[3*i+1]),x->mass[i].speedY); - SETFLOAT(&(pos_list[3*i+2]),x->mass[i].speedZ); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[3*i] ),x->mass[j].speedX); + SETFLOAT(&(pos_list[3*i+1]),x->mass[j].speedY); + SETFLOAT(&(pos_list[3*i+2]),x->mass[j].speedZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesSpeedsL"),3*i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedX); SETFLOAT(&(pos_list[1]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedY); SETFLOAT(&(pos_list[2]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedZ); @@ -115,27 +127,31 @@ void pmpd3d_massesPosXL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i < x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].posX); } outlet_anything(x->main_outlet, gensym("massesPosXL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { SETFLOAT(&(pos_list[i]),x->mass[i].posX); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesPosXL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posX); outlet_anything(x->main_outlet, gensym("massesPosXL"),1 , pos_list); } @@ -146,27 +162,31 @@ void pmpd3d_massesForcesXL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].forceX); } outlet_anything(x->main_outlet, gensym("massesForcesXL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].forceX); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].forceX); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesForcesXL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceX); outlet_anything(x->main_outlet, gensym("massesForcesXL"),1 , pos_list); } @@ -177,27 +197,31 @@ void pmpd3d_massesSpeedsXL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].speedX); } outlet_anything(x->main_outlet, gensym("massesSpeedsXL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].speedX); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].speedX); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesSpeedsXL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedX); outlet_anything(x->main_outlet, gensym("massesSpeedsXL"),1 , pos_list); } @@ -208,27 +232,31 @@ void pmpd3d_massesPosYL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i < x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].posY); } outlet_anything(x->main_outlet, gensym("massesPosYL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].posY); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].posY); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesPosYL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posY); outlet_anything(x->main_outlet, gensym("massesPosYL"),1 , pos_list); } @@ -239,27 +267,31 @@ void pmpd3d_massesForcesYL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].forceY); } outlet_anything(x->main_outlet, gensym("massesForcesYL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].forceY); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].forceY); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesForcesYL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceY); outlet_anything(x->main_outlet, gensym("massesForcesYL"),1 , pos_list); } @@ -270,27 +302,31 @@ void pmpd3d_massesSpeedsYL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].speedY); } outlet_anything(x->main_outlet, gensym("massesSpeedsYL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].speedY); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].speedY); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesSpeedsYL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedY); outlet_anything(x->main_outlet, gensym("massesSpeedsYL"),1 , pos_list); } @@ -301,27 +337,31 @@ void pmpd3d_massesPosZL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i < x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].posZ); } outlet_anything(x->main_outlet, gensym("massesPosZL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].posZ); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].posZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesPosZL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].posZ); outlet_anything(x->main_outlet, gensym("massesPosZL"),1 , pos_list); } @@ -332,27 +372,31 @@ void pmpd3d_massesForcesZL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].forceZ); } outlet_anything(x->main_outlet, gensym("massesForcesZL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),x->mass[i].forceZ); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),x->mass[j].forceZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesForcesZL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].forceZ); outlet_anything(x->main_outlet, gensym("massesForcesZL"),1 , pos_list); } @@ -363,27 +407,31 @@ void pmpd3d_massesSpeedsZL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),x->mass[i].speedZ); } outlet_anything(x->main_outlet, gensym("massesSpeedsZL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { SETFLOAT(&(pos_list[i]),x->mass[i].speedZ); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesSpeedsZL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { SETFLOAT(&(pos_list[0]),x->mass[(int)atom_getfloatarg(0, argc, argv)].speedZ); outlet_anything(x->main_outlet, gensym("massesSpeedsZL"),1 , pos_list); } @@ -396,26 +444,30 @@ void pmpd3d_massesPosNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { + if (argc==0) + { for (i=0; i< x->nb_mass; i++) { SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].posX)+sqr(x->mass[i].posY)+sqr(x->mass[i].posZ))); } outlet_anything(x->main_outlet, gensym("massesPosNormL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].posX)+sqr(x->mass[i].posY)+sqr(x->mass[i].posZ))); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[j].posX)+sqr(x->mass[j].posY)+sqr(x->mass[j].posZ))); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesPosNormL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { i=(int)atom_getfloatarg(0, argc, argv); SETFLOAT(&(pos_list[0]),sqrt(sqr(x->mass[i].posX)+sqr(x->mass[i].posY)+sqr(x->mass[i].posZ))); outlet_anything(x->main_outlet, gensym("massesPosNormL"),1 , pos_list); @@ -427,26 +479,31 @@ void pmpd3d_massesForcesNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { - for (i=0; i< x->nb_mass; i++) { + if (argc==0) + { + for (i=0; i< x->nb_mass; i++) + { SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].forceX)+sqr(x->mass[i].forceY)+sqr(x->mass[i].forceZ))); } outlet_anything(x->main_outlet, gensym("massesForcesNormL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].forceX)+sqr(x->mass[i].forceY)+sqr(x->mass[i].forceZ))); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[j].forceX)+sqr(x->mass[j].forceY)+sqr(x->mass[j].forceZ))); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesForcesNormL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { i=(int)atom_getfloatarg(0, argc, argv); SETFLOAT(&(pos_list[0]),sqrt(sqr(x->mass[i].forceX)+sqr(x->mass[i].forceY)+sqr(x->mass[i].forceZ))); outlet_anything(x->main_outlet, gensym("massesForcesNormL"),1 , pos_list); @@ -458,26 +515,31 @@ void pmpd3d_massesSpeedsNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int i,j; t_atom pos_list[x->nb_mass]; - if (argc==0) { - for (i=0; i< x->nb_mass; i++) { + if (argc==0) + { + for (i=0; i< x->nb_mass; i++) + { SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].speedX)+sqr(x->mass[i].speedY)+sqr(x->mass[i].speedZ))); } outlet_anything(x->main_outlet, gensym("massesSpeedsNormL"),x->nb_mass , pos_list); } - else - if ((argc==1) && (argv[1].a_type == A_SYMBOL)) { + else if ((argc==1) && (argv[0].a_type == A_SYMBOL)) + { i = 0; j = 0; - while (j < x->nb_mass){ - if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) { - SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].speedX)+sqr(x->mass[i].speedY)+sqr(x->mass[i].speedZ))); + while (j < x->nb_mass) + { + if (atom_getsymbolarg(0,argc,argv) == x->mass[j].Id) + { + SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[j].speedX)+sqr(x->mass[j].speedY)+sqr(x->mass[j].speedZ))); i++; } + j++; } outlet_anything(x->main_outlet, gensym("massesSpeedsNormL"),i , pos_list); } - else - if ((argc==1) && (argv[0].a_type == A_FLOAT)) { + else if ((argc==1) && (argv[0].a_type == A_FLOAT)) + { i=(int)atom_getfloatarg(0, argc, argv); SETFLOAT(&(pos_list[i]),sqrt(sqr(x->mass[i].speedX)+sqr(x->mass[i].speedY)+sqr(x->mass[i].speedZ))); outlet_anything(x->main_outlet, gensym("massesSpeedsNormL"),1 , pos_list); @@ -731,7 +793,7 @@ void pmpd3d_linksLengthSpeedXL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) j++; } } - outlet_anything(x->main_outlet, gensym("linksPosSpeedXL"), j, pos_list); + outlet_anything(x->main_outlet, gensym("linksLengthSpeedXL"), j, pos_list); } } @@ -1032,8 +1094,8 @@ void pmpd3d_linksLengthNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) sqr(x->link[i].mass2->posX - x->link[i].mass1->posX) + \ sqr(x->link[i].mass2->posY - x->link[i].mass1->posY) + \ sqr(x->link[i].mass2->posZ - x->link[i].mass1->posZ) )); - j++; } + j++; } outlet_anything(x->main_outlet, gensym("linksLengthNormL"), j, pos_list); } @@ -1067,8 +1129,8 @@ void pmpd3d_linksPosSpeedNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) sqr((x->link[i].mass1->speedX + x->link[i].mass2->speedX)/2) + \ sqr((x->link[i].mass1->speedY + x->link[i].mass2->speedY)/2) + \ sqr((x->link[i].mass1->speedZ + x->link[i].mass2->speedZ)/2) )); - j++; } + j++; } outlet_anything(x->main_outlet, gensym("linksPosSpeedNormL"), j, pos_list); } @@ -1102,8 +1164,8 @@ void pmpd3d_linksLengthSpeedNormL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *ar sqr((x->link[i].mass1->speedX + x->link[i].mass2->speedX)/2) + \ sqr((x->link[i].mass1->speedY + x->link[i].mass2->speedY)/2) + \ sqr((x->link[i].mass1->speedZ + x->link[i].mass2->speedZ)/2) )); - j++; } + j++; } outlet_anything(x->main_outlet, gensym("linksLengthSpeedNormL"), j, pos_list); } diff --git a/pmpd3d_set.c b/pmpd3d_set.c index 4792a72..3577613 100644 --- a/pmpd3d_set.c +++ b/pmpd3d_set.c @@ -2,7 +2,7 @@ void pmpd3d_setK(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc==2) &&( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); @@ -24,7 +24,7 @@ void pmpd3d_setD(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc==2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); @@ -46,13 +46,13 @@ void pmpd3d_setDEnv(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].D2 = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -62,7 +62,7 @@ void pmpd3d_setDEnv(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - if ( ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) + if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -75,13 +75,13 @@ void pmpd3d_setDEnvOffset(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].D2offset = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -91,7 +91,7 @@ void pmpd3d_setDEnvOffset(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - if ( ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) + if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -104,13 +104,13 @@ void pmpd3d_setL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].L = atom_getfloatarg(1, argc, argv); } - else if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + else if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -120,13 +120,13 @@ void pmpd3d_setL(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - else if ( ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) + else if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].L = x->link[tmp].mass2->posX - x->link[tmp].mass1->posX; } - else if ( ( argv[0].a_type == A_SYMBOL ) && ( argc == 1 ) ) + else if ( (argc == 1) && ( argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -141,13 +141,13 @@ void pmpd3d_setLCurrent(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) + if ( ( argc == 1 ) && ( argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].L = x->link[tmp].mass2->posX - x->link[tmp].mass1->posX; } - else if ( ( argv[0].a_type == A_SYMBOL ) && ( argc == 1 ) ) + else if ( ( argc == 1 ) && ( argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -157,19 +157,19 @@ void pmpd3d_setLCurrent(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } - else if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + else if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { i = atom_getfloatarg(0, argc, argv); i = max(0, min( x->nb_link-1, i)); - x->link[i].L = mix(x->link[i].L,x->link[i].distance,atom_getfloatarg(2, argc, argv)); + x->link[i].L = mix(x->link[i].L,x->link[i].distance,atom_getfloatarg(1, argc, argv)); } - else if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + else if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { if ( atom_getsymbolarg(0,argc,argv) == x->link[i].Id) { - x->link[i].L = mix(x->link[i].L,x->link[i].distance,atom_getfloatarg(2, argc, argv)); + x->link[i].L = mix(x->link[i].L,x->link[i].distance,atom_getfloatarg(1, argc, argv)); } } } @@ -182,13 +182,13 @@ void pmpd3d_setLKTab(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int tmp, i; t_float K_l = atom_getfloatarg(1, argc, argv); if (K_l <= 0) K_l = 1; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].K_L = K_l; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -205,13 +205,13 @@ void pmpd3d_setLDTab(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) int tmp, i; t_float D_l = atom_getfloatarg(1, argc, argv); if (D_l <= 0) D_l = 1; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].D_L = D_l; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -227,13 +227,13 @@ void pmpd3d_setLinkId(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].Id = atom_getsymbolarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( ((argc == 2) && argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -249,13 +249,13 @@ void pmpd3d_setMassId(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].Id = atom_getsymbolarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -271,13 +271,13 @@ void pmpd3d_setFixed(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 1) && (argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].mobile = 0; } - if ( argv[0].a_type == A_SYMBOL ) + if ( (argc == 2) && (argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -293,13 +293,13 @@ void pmpd3d_setMobile(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].mobile = 1; } - if ( argv[0].a_type == A_SYMBOL ) + if ( (argc == 1) && ( argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -315,7 +315,7 @@ void pmpd3d_setSpeed(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -323,7 +323,7 @@ void pmpd3d_setSpeed(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].speedY = atom_getfloatarg(2, argc, argv); x->mass[tmp].speedZ = atom_getfloatarg(3, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -341,13 +341,13 @@ void pmpd3d_setSpeedX(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].speedX = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -363,13 +363,13 @@ void pmpd3d_setSpeedY(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].speedY = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -385,13 +385,13 @@ void pmpd3d_setSpeedZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].speedZ = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -407,7 +407,7 @@ void pmpd3d_setForce(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -415,7 +415,7 @@ void pmpd3d_setForce(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].forceY = atom_getfloatarg(2, argc, argv); x->mass[tmp].forceZ = atom_getfloatarg(3, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -433,13 +433,13 @@ void pmpd3d_setForceX(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].forceX = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -455,13 +455,13 @@ void pmpd3d_setForceY(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].forceY = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -477,13 +477,13 @@ void pmpd3d_setForceZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].forceZ = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -499,13 +499,13 @@ void pmpd3d_setActive(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].active = 1; } - else if ( argv[0].a_type == A_SYMBOL ) + else if ( (argc == 1) && ( argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -528,13 +528,13 @@ void pmpd3d_setInactive(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 1) && ( argv[0].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].active = 0; } - else if ( argv[0].a_type == A_SYMBOL ) + else if ( (argc == 1) && ( argv[0].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -558,7 +558,7 @@ void pmpd3d_pos(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) // displace a mass to a certain position t_int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -572,7 +572,7 @@ void pmpd3d_pos(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].speedZ = 0; x->mass[tmp].forceZ = 0; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) + if ( (argc == 4) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) && ( argv[2].a_type == A_FLOAT ) && ( argv[3].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -597,7 +597,7 @@ void pmpd3d_posX(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) // displace a mass to a certain position t_int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -606,7 +606,7 @@ void pmpd3d_posX(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].forceX = 0; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -626,7 +626,7 @@ void pmpd3d_posY(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) // displace a mass to a certain position t_int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -635,7 +635,7 @@ void pmpd3d_posY(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].forceY = 0; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -654,7 +654,7 @@ void pmpd3d_posZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) // displace a mass to a certain position t_int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); @@ -663,7 +663,7 @@ void pmpd3d_posZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) x->mass[tmp].forceZ = 0; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { |