diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-04-10 13:10:45 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-04-10 13:10:45 +0000 |
commit | 313728c669e8123d2a7804869bbfc0d0ae2443c4 (patch) | |
tree | 4171b47526926c4770f626e2c3fb31d3c42189b8 | |
parent | 8a138c34f426ed03ccdca35435af8bcd4667f82f (diff) |
fix interactors
svn path=/trunk/externals/pmpd/; revision=17083
-rw-r--r-- | pmpd2d_interactor.c | 10 | ||||
-rw-r--r-- | pmpd3d.c | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/pmpd2d_interactor.c b/pmpd2d_interactor.c index 08bbbbc..86d6746 100644 --- a/pmpd2d_interactor.c +++ b/pmpd2d_interactor.c @@ -6,7 +6,7 @@ void pmpd2d_iCircle_i(t_pmpd2d *x, int i, t_float a, t_float b, t_float r, t_flo Y = x->mass[i].posY - b; rayon = sqrt ( sqr(X) + sqr(Y) ); - distance = r - rayon; + distance = rayon - r; if (rayon != 0) { @@ -22,9 +22,9 @@ void pmpd2d_iCircle_i(t_pmpd2d *x, int i, t_float a, t_float b, t_float r, t_flo // X, Y : vecteur unitaire normal au cercle // rayon : distance au centre. - if ( (rayon>Rmin) && (rayon<=Rmax) ) + if ( (distance>Rmin) && (distance<=Rmax) ) { - tmp = pow_ch(K * distance, power); + tmp = -pow_ch(K * distance, power); x->mass[i].forceX += X * tmp; x->mass[i].forceY += Y * tmp; } @@ -98,7 +98,7 @@ void pmpd2d_iLine_i(t_pmpd2d *x, int i, t_float a, t_float b, t_float c, t_float if ( (distance>Rmin) && (distance<=Rmax) ) { - force = pow_ch(K * distance, power); + force = -pow_ch(K * distance, power); x->mass[i].forceX += a * force; x->mass[i].forceY += b * force; } @@ -149,7 +149,7 @@ void pmpd2d_iLine(t_pmpd2d *x, t_symbol *s, int argc, t_atom *argv) power = atom_getfloatarg(6, argc, argv); if (power == 0) power = 1; - Rmin = 0; + Rmin = -1000000; if ((argc>=8) && (argv[7].a_type == A_FLOAT)) { Rmin = (atom_getfloatarg(7,argc,argv));} Rmax = 1000000; if ((argc>=9) && (argv[8].a_type == A_FLOAT)) { Rmax = (atom_getfloatarg(8,argc,argv));} @@ -302,7 +302,7 @@ void pmpd3d_setup(void) class_addmethod(pmpd3d_class, (t_method)pmpd3d_iCylinder, gensym("iCylinder"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_iPlane, gensym("iPlane"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_iSphere, gensym("iSphere"), A_GIMME, 0);
-
+
/*
pmpd3d_various
--
|