From 313728c669e8123d2a7804869bbfc0d0ae2443c4 Mon Sep 17 00:00:00 2001 From: Cyrille Henry Date: Wed, 10 Apr 2013 13:10:45 +0000 Subject: fix interactors svn path=/trunk/externals/pmpd/; revision=17083 --- pmpd2d_interactor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pmpd2d_interactor.c') 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));} -- cgit v1.2.1