aboutsummaryrefslogtreecommitdiff
path: root/pmpd.c
diff options
context:
space:
mode:
authorCyrille Henry <nusmuk@users.sourceforge.net>2011-02-14 21:13:57 +0000
committerCyrille Henry <nusmuk@users.sourceforge.net>2011-02-14 21:13:57 +0000
commit45db148cbbebda92ccc34ba8c7cbb0736d63c297 (patch)
tree08671a0fff4ddd77c773cd3baa4acad222e311b0 /pmpd.c
parent66873c674bdbf5dbe87a29158ed2204dec8bec02 (diff)
svn path=/trunk/externals/pmpd/; revision=14923
Diffstat (limited to 'pmpd.c')
-rw-r--r--pmpd.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/pmpd.c b/pmpd.c
index 3fb4a77..c220638 100644
--- a/pmpd.c
+++ b/pmpd.c
@@ -49,16 +49,6 @@ t_float sign_ch(t_float v)
return v > 0 ? 1 : -1;
}
-t_float abs_ch(t_float v)
-{
- return v > 0 ? v : -v;
-}
-
-t_float pow_ch(t_float a, t_float x)
-{
- return a > 0 ? pow(a,x) : -pow(-a,x);
-}
-
static t_class *pmpd_class;
typedef struct _mass {
@@ -101,7 +91,7 @@ void pmpd_bang(t_pmpd *x)
// this part is doing all the PM
t_float F, L, absL;
t_int i;
- post("bang");
+ // post("bang");
for (i=1; i<x->nb_mass; i++)
// compute new masses position
@@ -117,13 +107,13 @@ void pmpd_bang(t_pmpd *x)
// comput link forces
{
L = x->link[i].mass1->posX - x->link[i].mass2->posX;
- absL = abs_ch(L);
+ absL = fabs(L);
if ( (absL >= x->link[i].Lmin) & (absL < x->link[i].Lmax) & (L!=0))
{
F = x->link[i].D * (L - x->link[i].distance) ;
x->link[i].distance=L;
- L = sign_ch(L) * pow_ch( absL - x->link[i].L, x->link[i].Pow);
+ L = sign_ch(L) * pow( absL - x->link[i].L, x->link[i].Pow);
F += x->link[i].K * L;
x->link[i].mass1->forceX -= F;