diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-01-23 16:00:49 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2013-01-23 16:00:49 +0000 |
commit | c855b4cbc7dbf795819e84681538a98eeeec1a95 (patch) | |
tree | 0d56ccff75a94a39e9dd1327781ab0b52a95a173 | |
parent | 67aa61fecab396b2b8fe4a931103305ac4307ab3 (diff) |
rename pos and posX message to setPos and setPosX
svn path=/trunk/externals/pmpd/; revision=16979
-rw-r--r-- | pmpd3d.c | 16 | ||||
-rw-r--r-- | pmpd3d_set.c | 125 | ||||
-rw-r--r-- | pmpd3d_various.c | 124 |
3 files changed, 135 insertions, 130 deletions
@@ -76,8 +76,16 @@ void pmpd3d_setup(void) class_addmethod(pmpd3d_class, (t_method)pmpd3d_setForceZ, gensym("setForceZ"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_setForce, gensym("setForce"), 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_setMobile, gensym("setInactive"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_pos, gensym("pos"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posX, gensym("posX"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posY, gensym("posY"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posZ, gensym("posZ"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_pos, gensym("setpos"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posX, gensym("setposX"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posY, gensym("setposY"), A_GIMME, 0);
+ class_addmethod(pmpd3d_class, (t_method)pmpd3d_posZ, gensym("setposZ"), A_GIMME, 0);
+
// pmpd3d_get
class_addmethod(pmpd3d_class, (t_method)pmpd3d_get, gensym("get"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_massesPos, gensym("massesPos"), A_GIMME, 0);
@@ -270,10 +278,6 @@ void pmpd3d_setup(void) class_addmethod(pmpd3d_class, (t_method)pmpd3d_forceX, gensym("forceX"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_forceY, gensym("forceY"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_forceZ, gensym("forceZ"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_pos, gensym("pos"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_posX, gensym("posX"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_posY, gensym("posY"), A_GIMME, 0);
- class_addmethod(pmpd3d_class, (t_method)pmpd3d_posZ, gensym("posZ"), A_GIMME, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_min, gensym("min"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_max, gensym("max"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd3d_class, (t_method)pmpd3d_minX, gensym("Xmin"), A_DEFFLOAT, 0);
diff --git a/pmpd3d_set.c b/pmpd3d_set.c index e806fd5..58bd812 100644 --- a/pmpd3d_set.c +++ b/pmpd3d_set.c @@ -529,3 +529,128 @@ void pmpd3d_setInactive(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } } + +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 ) ) + { + tmp = atom_getfloatarg(0, argc, argv); + tmp = max(0, min( x->nb_mass-1, tmp)); + x->mass[tmp].posX = atom_getfloatarg(1, argc, argv); + x->mass[tmp].speedX = 0; + x->mass[tmp].forceX = 0; + x->mass[tmp].posY = atom_getfloatarg(2, argc, argv); + x->mass[tmp].speedY = 0; + x->mass[tmp].forceY = 0; + x->mass[tmp].posZ = atom_getfloatarg(3, argc, 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 ) ) + { + for (i=0; i< x->nb_mass; i++) + { + if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) + { + x->mass[i].posX = atom_getfloatarg(1, argc, argv); + x->mass[i].speedX = 0; + x->mass[i].forceX = 0; + x->mass[i].posY = atom_getfloatarg(2, argc, argv); + x->mass[i].speedY = 0; + x->mass[i].forceY = 0; + x->mass[i].posZ = atom_getfloatarg(3, argc, argv); + x->mass[i].speedZ = 0; + x->mass[i].forceZ = 0; + } + } + } +} + +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 ) ) + { + tmp = atom_getfloatarg(0, argc, argv); + tmp = max(0, min( x->nb_mass-1, tmp)); + x->mass[tmp].posX = atom_getfloatarg(1, argc, argv); + x->mass[tmp].speedX = 0; + x->mass[tmp].forceX = 0; + + } + if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + { + for (i=0; i< x->nb_mass; i++) + { + if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) + { + x->mass[i].posX = atom_getfloatarg(1, argc, argv); + x->mass[i].speedX = 0; + x->mass[i].forceX = 0; + + } + } + } +} + +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 ) ) + { + tmp = atom_getfloatarg(0, argc, argv); + tmp = max(0, min( x->nb_mass-1, tmp)); + x->mass[tmp].posY = atom_getfloatarg(1, argc, argv); + x->mass[tmp].speedY = 0; + x->mass[tmp].forceY = 0; + + } + if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + { + for (i=0; i< x->nb_mass; i++) + { + if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) + { + x->mass[i].posY = atom_getfloatarg(1, argc, argv); + x->mass[i].speedY = 0; + x->mass[i].forceY = 0; + } + } + } +} + +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 ) ) + { + tmp = atom_getfloatarg(0, argc, argv); + tmp = max(0, min( x->nb_mass-1, tmp)); + x->mass[tmp].posZ = atom_getfloatarg(1, argc, argv); + x->mass[tmp].speedZ = 0; + x->mass[tmp].forceZ = 0; + + } + if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + { + for (i=0; i< x->nb_mass; i++) + { + if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) + { + x->mass[i].posZ = atom_getfloatarg(1, argc, argv); + x->mass[i].speedZ = 0; + x->mass[i].forceZ = 0; + } + } + } +} + diff --git a/pmpd3d_various.c b/pmpd3d_various.c index d6cf307..5ff2ec5 100644 --- a/pmpd3d_various.c +++ b/pmpd3d_various.c @@ -133,130 +133,6 @@ void pmpd3d_forceZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } -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 ) ) - { - tmp = atom_getfloatarg(0, argc, argv); - tmp = max(0, min( x->nb_mass-1, tmp)); - x->mass[tmp].posX = atom_getfloatarg(1, argc, argv); - x->mass[tmp].speedX = 0; - x->mass[tmp].forceX = 0; - x->mass[tmp].posY = atom_getfloatarg(2, argc, argv); - x->mass[tmp].speedY = 0; - x->mass[tmp].forceY = 0; - x->mass[tmp].posZ = atom_getfloatarg(3, argc, 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 ) ) - { - for (i=0; i< x->nb_mass; i++) - { - if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) - { - x->mass[i].posX = atom_getfloatarg(1, argc, argv); - x->mass[i].speedX = 0; - x->mass[i].forceX = 0; - x->mass[i].posY = atom_getfloatarg(2, argc, argv); - x->mass[i].speedY = 0; - x->mass[i].forceY = 0; - x->mass[i].posZ = atom_getfloatarg(3, argc, argv); - x->mass[i].speedZ = 0; - x->mass[i].forceZ = 0; - } - } - } -} - -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 ) ) - { - tmp = atom_getfloatarg(0, argc, argv); - tmp = max(0, min( x->nb_mass-1, tmp)); - x->mass[tmp].posX = atom_getfloatarg(1, argc, argv); - x->mass[tmp].speedX = 0; - x->mass[tmp].forceX = 0; - - } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) - { - for (i=0; i< x->nb_mass; i++) - { - if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) - { - x->mass[i].posX = atom_getfloatarg(1, argc, argv); - x->mass[i].speedX = 0; - x->mass[i].forceX = 0; - - } - } - } -} - -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 ) ) - { - tmp = atom_getfloatarg(0, argc, argv); - tmp = max(0, min( x->nb_mass-1, tmp)); - x->mass[tmp].posY = atom_getfloatarg(1, argc, argv); - x->mass[tmp].speedY = 0; - x->mass[tmp].forceY = 0; - - } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) - { - for (i=0; i< x->nb_mass; i++) - { - if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) - { - x->mass[i].posY = atom_getfloatarg(1, argc, argv); - x->mass[i].speedY = 0; - x->mass[i].forceY = 0; - } - } - } -} - -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 ) ) - { - tmp = atom_getfloatarg(0, argc, argv); - tmp = max(0, min( x->nb_mass-1, tmp)); - x->mass[tmp].posZ = atom_getfloatarg(1, argc, argv); - x->mass[tmp].speedZ = 0; - x->mass[tmp].forceZ = 0; - - } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) - { - for (i=0; i< x->nb_mass; i++) - { - if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) - { - x->mass[i].posZ = atom_getfloatarg(1, argc, argv); - x->mass[i].speedZ = 0; - x->mass[i].forceZ = 0; - } - } - } -} - void pmpd3d_min(t_pmpd3d *x, t_float minX, t_float minY, t_float minZ) { x->minX = minX; |