aboutsummaryrefslogtreecommitdiff
path: root/pmpd3d_various.c
diff options
context:
space:
mode:
authorCyrille Henry <nusmuk@users.sourceforge.net>2013-01-22 10:43:25 +0000
committerCyrille Henry <nusmuk@users.sourceforge.net>2013-01-22 10:43:25 +0000
commit6e61a93db2dceb3aba8c1b1623d41a9f19d4b7a0 (patch)
tree9da4106145b3939cd1da24b6b2c904bcb32a52ad /pmpd3d_various.c
parent155a668bfb876510ad6c70060769ea2118e2d6d8 (diff)
add a field for saving force in link structure so that it's possibile to filter link regarding to last force generated
svn path=/trunk/externals/pmpd/; revision=16944
Diffstat (limited to 'pmpd3d_various.c')
-rw-r--r--pmpd3d_various.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/pmpd3d_various.c b/pmpd3d_various.c
index b5688a1..48a6835 100644
--- a/pmpd3d_various.c
+++ b/pmpd3d_various.c
@@ -667,7 +667,7 @@ void pmpd3d_enumMasses(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
void pmpd3d_enumLinks(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
- t_int i, j, test;
+ t_int i, j, test, tmp, tmp2;
t_atom std_out[1];
j = 0;
@@ -682,7 +682,7 @@ void pmpd3d_enumLinks(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
if ( x->link[i].Id != atom_getsymbolarg(j+1,argc,argv) ) { test = 0; j+=2;}
}
-/* else if (atom_getsymbolarg(j,argc,argv) == gensym("forcesXSup") )
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("forcesXSup") )
{
if ( x->link[i].forceX < atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
}
@@ -690,7 +690,51 @@ void pmpd3d_enumLinks(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
if ( x->link[i].forceX > atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
}
-*/ else if (atom_getsymbolarg(j,argc,argv) == gensym("lengthSup") )
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("forcesYSup") )
+ {
+ if ( x->link[i].forceY < atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
+ }
+ else if ( atom_getsymbolarg(j,argc,argv) == gensym("forcesYInf") )
+ {
+ if ( x->link[i].forceY > atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
+ }
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("forcesZSup") )
+ {
+ if ( x->link[i].forceZ < atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
+ }
+ else if ( atom_getsymbolarg(j,argc,argv) == gensym("forcesZInf") )
+ {
+ if ( x->link[i].forceZ > atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
+ }
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("forcesSup") )
+ {
+ tmp = x->link[i].forceX;
+ tmp *= tmp;
+ tmp2 = x->link[i].forceY;
+ tmp = tmp + tmp2*tmp2;
+ tmp2 = x->link[i].forceZ;
+ tmp = tmp + tmp2*tmp2;
+
+ tmp2 = atom_getfloatarg(j+1,argc,argv);
+ tmp2 *= tmp2;
+
+ if ( tmp < tmp2 ) { test = 0; j+=2;}
+ }
+ else if ( atom_getsymbolarg(j,argc,argv) == gensym("forcesInf") )
+ {
+ tmp = x->link[i].forceX;
+ tmp = tmp * tmp;
+ tmp2 = x->link[i].forceY;
+ tmp = tmp + tmp2*tmp2;
+ tmp2 = x->link[i].forceZ;
+ tmp = tmp + tmp2*tmp2;
+
+ tmp2 = atom_getfloatarg(j+1,argc,argv);
+ tmp2 *= tmp2;
+
+ if ( tmp > tmp2 ) { test = 0; j+=2;}
+ }
+ else if (atom_getsymbolarg(j,argc,argv) == gensym("lengthSup") )
{
if ( x->link[i].distance < atom_getfloatarg(j+1,argc,argv) ) { test = 0; j+=2;}
}