aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iAmbient2D.c200
-rw-r--r--src/iAmbient3D.c259
-rw-r--r--src/iCircle2D.c276
-rw-r--r--src/iCircle3D.c211
-rw-r--r--src/iCylinder3D.c292
-rw-r--r--src/iLine2D.c179
-rw-r--r--src/iPlane3D.c193
-rw-r--r--src/iSeg2D.c175
-rw-r--r--src/iSphere3D.c253
-rw-r--r--src/link.c161
-rw-r--r--src/link2D.c212
-rw-r--r--src/link3D.c237
-rw-r--r--src/makefile95
-rw-r--r--src/mass.c186
-rw-r--r--src/mass2D.c811
-rw-r--r--src/mass3D.c1095
-rw-r--r--src/pmpd.c407
-rw-r--r--src/pmpd~.c417
-rw-r--r--src/tCircle2D.c113
-rw-r--r--src/tCircle3D.c195
-rw-r--r--src/tCube3D.c114
-rw-r--r--src/tCylinder3D.c218
-rw-r--r--src/tLine2D.c137
-rw-r--r--src/tLink2D.c157
-rw-r--r--src/tLink3D.c152
-rw-r--r--src/tPlane3D.c175
-rw-r--r--src/tSeg2D.c139
-rw-r--r--src/tSphere3D.c128
-rw-r--r--src/tSquare2D.c92
29 files changed, 0 insertions, 7279 deletions
diff --git a/src/iAmbient2D.c b/src/iAmbient2D.c
deleted file mode 100644
index f5050ce..0000000
--- a/src/iAmbient2D.c
+++ /dev/null
@@ -1,200 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iAmbient2D_class;
-
-typedef struct _iAmbient2D {
- t_object x_obj;
- t_atom force[12];
- /*
- force =
- forceX,
- forceY,
- randomFX,
- randomFY,
- damp,
- Xmin,
- Xmax,
- Ymin,
- Ymax,
- dX,
- dY;
- */
-
- t_outlet *force_new;// outlet
- t_symbol *x_sym; // send
-} t_iAmbient2D;
-
-void iAmbient2D_forceX(t_iAmbient2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[0]), f1);
-}
-
-void iAmbient2D_forceY(t_iAmbient2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[1]), f1);
-}
-
-void iAmbient2D_force(t_iAmbient2D *x, t_floatarg f1, t_floatarg f2)
-{
- SETFLOAT(&(x->force[0]), f1);
- SETFLOAT(&(x->force[1]), f2 );
-}
-
-void iAmbient2D_rndFX(t_iAmbient2D *x, t_float X)
-{
- SETFLOAT(&(x->force[2]), X);
-}
-
-void iAmbient2D_rndFY(t_iAmbient2D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iAmbient2D_rndF(t_iAmbient2D *x, t_floatarg f1, t_floatarg f2)
-{
- SETFLOAT(&(x->force[2]), f1);
- SETFLOAT(&(x->force[3]), f2);
-}
-
-void iAmbient2D_damp(t_iAmbient2D *x, t_float X)
-{
- SETFLOAT(&(x->force[4]), X);
-}
-
-void iAmbient2D_Xmin(t_iAmbient2D *x, t_float Xmin)
-{
- SETFLOAT(&(x->force[6]), Xmin);
-}
-
-void iAmbient2D_Xmax(t_iAmbient2D *x, t_float Xmax)
-{
- SETFLOAT(&(x->force[7]), Xmax);
-}
-
-void iAmbient2D_Ymin(t_iAmbient2D *x, t_float Ymin)
-{
- SETFLOAT(&(x->force[8]), Ymin);
-}
-
-void iAmbient2D_Ymax(t_iAmbient2D *x, t_float Ymax)
-{
- SETFLOAT(&(x->force[9]), Ymax);
-}
-
-void iAmbient2D_dXY(t_iAmbient2D *x, t_float dX, t_float dY)
-{
- SETFLOAT(&(x->force[10]), dX);
- SETFLOAT(&(x->force[11]), dY);
-}
-
-void iAmbient2D_dX(t_iAmbient2D *x, t_float dX)
-{
- SETFLOAT(&(x->force[10]), dX);
-}
-
-void iAmbient2D_dY(t_iAmbient2D *x, t_float dY)
-{
- SETFLOAT(&(x->force[11]), dY);
-}
-
-void iAmbient2D_bang(t_iAmbient2D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_ambient_2D"), 12, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_ambient_2D"), 12, x->force);
-}
-
-void *iAmbient2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iAmbient2D *x = (t_iAmbient2D *)pd_new(iAmbient2D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
- SETFLOAT(&(x->force[5]), 0);
-
-
- if (argc>=12)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 100000);
-
- if (argc>=9)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[8]), -100000);
-
- if (argc>=8)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 100000);
-
- if (argc>=7)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[6]), -100000);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), 0);
-
- return (x);
-}
-
-void iAmbient2D_setup(void)
-{
- iAmbient2D_class = class_new(gensym("iAmbient2D"),
- (t_newmethod)iAmbient2D_new,
- 0, sizeof(t_iAmbient2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iAmbient2D_new, gensym("pmpd.iAmbient2D"), A_GIMME, 0);
-
- class_addbang(iAmbient2D_class, iAmbient2D_bang);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_force, gensym("setFXY"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_forceX, gensym("setFX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_forceY, gensym("setFY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_Xmin, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_Ymin, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_Xmax, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_Ymax, gensym("setYmax"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_rndFY, gensym("setRndFY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_rndFX, gensym("setRndFX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_damp, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_dX, gensym("setdX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_dY, gensym("setdY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient2D_class, (t_method)iAmbient2D_dXY, gensym("setdXY"), A_DEFFLOAT, A_DEFFLOAT, 0);
-}
diff --git a/src/iAmbient3D.c b/src/iAmbient3D.c
deleted file mode 100644
index cd95088..0000000
--- a/src/iAmbient3D.c
+++ /dev/null
@@ -1,259 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iAmbient3D_class;
-
-typedef struct _iAmbient3D {
- t_object x_obj;
- t_atom force[17];
-/* 1 : name of the mass (send interactors informations to this masses)
- 2 : FX (constant X force apply to the masses) (0)
- 3 : FY (constant Y force apply to the masses) (0)
- 4 : FZ (constant Z force apply to the masses) (0)
- 5 : Rnd FX (random X force apply to the masses) (0)
- 6 : Rnd FY (random Y force apply to the masses) (0)
- 7 : Rnd FZ (random Z force apply to the masses) (0)
- 8 : Damping (velocity damping of the masses) (0)
- 9 : Rien
- 10 : Xmin (minimum and maximum limit of the interactors) (-10000)
- 9 : Xmax (a mass interact with this object only if it is inside the interactor bounds) (10000)
- 10 : Ymin (-10000)
- 11 : Ymax (10000)
- 12 : Zmin (-10000)
- 13 : Zmax (10000)
- 14 : dX (displace the mass by a constant value) (0)
- 15 : dY (0)
- 16 : dZ (0)
-*/
- t_outlet *force_new;// outlet
- t_symbol *x_sym; // send
-} t_iAmbient3D;
-
-void iAmbient3D_forceX(t_iAmbient3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[0]), f1);
-}
-
-void iAmbient3D_forceY(t_iAmbient3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[1]), f1);
-}
-
-void iAmbient3D_forceZ(t_iAmbient3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[2]), f1);
-}
-
-void iAmbient3D_force(t_iAmbient3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- SETFLOAT(&(x->force[0]), f1 );
- SETFLOAT(&(x->force[1]), f2 );
- SETFLOAT(&(x->force[2]), f3 );
-}
-
-void iAmbient3D_rndFX(t_iAmbient3D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iAmbient3D_rndFY(t_iAmbient3D *x, t_float X)
-{
- SETFLOAT(&(x->force[4]), X);
-}
-
-void iAmbient3D_rndFZ(t_iAmbient3D *x, t_float X)
-{
- SETFLOAT(&(x->force[5]), X);
-}
-
-void iAmbient3D_rndF(t_iAmbient3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- SETFLOAT(&(x->force[3]), f1);
- SETFLOAT(&(x->force[4]), f2);
- SETFLOAT(&(x->force[5]), f3);
-}
-
-void iAmbient3D_damp(t_iAmbient3D *x, t_float X)
-{
- SETFLOAT(&(x->force[6]), X);
-}
-
-
-void iAmbient3D_Xmin(t_iAmbient3D *x, t_float Xmin)
-{
- SETFLOAT(&(x->force[8]), Xmin);
-}
-
-void iAmbient3D_Xmax(t_iAmbient3D *x, t_float Xmax)
-{
- SETFLOAT(&(x->force[9]), Xmax);
-}
-
-void iAmbient3D_Ymin(t_iAmbient3D *x, t_float Ymin)
-{
- SETFLOAT(&(x->force[10]), Ymin);
-}
-
-void iAmbient3D_Ymax(t_iAmbient3D *x, t_float Ymax)
-{
- SETFLOAT(&(x->force[11]), Ymax);
-}
-
-void iAmbient3D_Zmin(t_iAmbient3D *x, t_float Zmin)
-{
- SETFLOAT(&(x->force[12]), Zmin);
-}
-
-void iAmbient3D_Zmax(t_iAmbient3D *x, t_float Zmax)
-{
- SETFLOAT(&(x->force[13]), Zmax);
-}
-
-void iAmbient3D_dXYZ(t_iAmbient3D *x, t_float dX, t_float dY, t_float dZ)
-{
- SETFLOAT(&(x->force[14]), dX);
- SETFLOAT(&(x->force[15]), dY);
- SETFLOAT(&(x->force[16]), dZ);
-}
-
-void iAmbient3D_dX(t_iAmbient3D *x, t_float dX)
-{
- SETFLOAT(&(x->force[14]), dX);
-}
-
-void iAmbient3D_dY(t_iAmbient3D *x, t_float dY)
-{
- SETFLOAT(&(x->force[15]), dY);
-}
-
-void iAmbient3D_dZ(t_iAmbient3D *x, t_float dZ)
-{
- SETFLOAT(&(x->force[16]), dZ);
-}
-
-void iAmbient3D_bang(t_iAmbient3D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_ambient_3D"), 17, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_ambient_3D"), 17, x->force);
-}
-
-void *iAmbient3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iAmbient3D *x = (t_iAmbient3D *)pd_new(iAmbient3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
- if (argc>=16)
- SETFLOAT(&(x->force[15]), atom_getfloatarg(15, argc, argv));
- else
- SETFLOAT(&(x->force[15]), 0);
-
- if (argc>=15)
- SETFLOAT(&(x->force[14]), atom_getfloatarg(14, argc, argv));
- else
- SETFLOAT(&(x->force[14]), 0);
-
- if (argc>=14)
- SETFLOAT(&(x->force[13]), atom_getfloatarg(13, argc, argv));
- else
- SETFLOAT(&(x->force[13]), 10000);
-
- if (argc>=13)
- SETFLOAT(&(x->force[12]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[12]), -10000);
-
- if (argc>=12)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 10000);
-
- if (argc>=11)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[10]), -10000);
-
- if (argc>=10)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 10000);
-
- if (argc>=9)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[8]), -10000);
-
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), 0);
-
- return (x);
-}
-
-void iAmbient3D_setup(void)
-{
-
- iAmbient3D_class = class_new(gensym("iAmbient3D"),
- (t_newmethod)iAmbient3D_new,
- 0, sizeof(t_iAmbient3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iAmbient3D_new, gensym("pmpd.iAmbient3D"), A_GIMME, 0);
-
- class_addbang(iAmbient3D_class, iAmbient3D_bang);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_force, gensym("setFXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_forceX, gensym("setFX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_forceY, gensym("setFY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_forceZ, gensym("setFZ"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Xmin, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Ymin, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Zmin, gensym("setZmin"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Xmax, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Ymax, gensym("setYmax"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_Zmax, gensym("setZmax"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_rndFY, gensym("setRndFY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_rndFX, gensym("setRndFX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_rndFZ, gensym("setRndFZ"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_damp, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_dXYZ, gensym("dXYZ"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_dX, gensym("setdX"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_dY, gensym("setdY"), A_DEFFLOAT, 0);
- class_addmethod(iAmbient3D_class, (t_method)iAmbient3D_dZ, gensym("setdZ"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/iCircle2D.c b/src/iCircle2D.c
deleted file mode 100644
index 869dd70..0000000
--- a/src/iCircle2D.c
+++ /dev/null
@@ -1,276 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iCircle2D_class;
-
-typedef struct _iCircle2D {
- t_object x_obj;
- t_atom force[20];
- t_outlet *force_new; // outlet
- t_symbol *x_sym; // send
- t_float posX_old, posY_old, posX, posY; // anciennes position, pour calculer la vitesse de cette interacteur.
-
-} t_iCircle2D;
-
-void iCircle2D_bang(t_iCircle2D *x)
-{
- SETFLOAT(&(x->force[14]), x->posX_old); // posX_old
- SETFLOAT(&(x->force[15]), x->posY_old); // posY_old
-
- x->posX_old = x->posX;
- x->posY_old = x->posY;
-
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_circle_2D"), 20, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_circle_2D"), 20, x->force);
-}
-
-void iCircle2D_setXY(t_iCircle2D *x, t_float X, t_float Y)
-{
- SETFLOAT(&(x->force[0]), X);
- x->posX= X;
- SETFLOAT(&(x->force[1]), Y);
- x->posY = Y;
-}
-
-void iCircle2D_setX(t_iCircle2D *x, t_float X)
-{
- SETFLOAT(&(x->force[0]), X);
- x->posX= X;
-}
-
-void iCircle2D_setY(t_iCircle2D *x, t_float Y)
-{
- SETFLOAT(&(x->force[1]), Y);
- x->posY = Y;
-}
-
-void iCircle2D_setRmin(t_iCircle2D *x, t_float X)
-{
- SETFLOAT(&(x->force[2]), X);
-}
-
-void iCircle2D_setRmax(t_iCircle2D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iCircle2D_setFN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[4]), f1);
-}
-
-void iCircle2D_setFT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[5]), f1);
-}
-
-void iCircle2D_setKN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iCircle2D_setKT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-void iCircle2D_setRN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iCircle2D_setRT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iCircle2D_setDN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iCircle2D_setDT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[11]), f1);
-}
-
-void iCircle2D_setdRN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[12]), f1);
-}
-
-void iCircle2D_setdRT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[13]), f1);
-}
-
-void iCircle2D_setD(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[16]), f1);
-}
-
-void iCircle2D_setG(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[17]), f1);
-}
-
-void iCircle2D_setdN(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[18]), f1);
-}
-
-void iCircle2D_setdT(t_iCircle2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[19]), f1);
-}
-
-void *iCircle2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iCircle2D *x = (t_iCircle2D *)pd_new(iCircle2D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
- if (argc>=19)
- SETFLOAT(&(x->force[19]), atom_getfloatarg(18, argc, argv));
- else
- SETFLOAT(&(x->force[19]), 0);
-
- if (argc>=18)
- SETFLOAT(&(x->force[18]), atom_getfloatarg(17, argc, argv));
- else
- SETFLOAT(&(x->force[18]), 0);
-
- if (argc>=17)
- SETFLOAT(&(x->force[17]), atom_getfloatarg(16, argc, argv));
- else
- SETFLOAT(&(x->force[17]), 0);
-
- if (argc>=16)
- SETFLOAT(&(x->force[16]), atom_getfloatarg(15, argc, argv));
- else
- SETFLOAT(&(x->force[16]), 0);
-
- if (argc>=15)
- SETFLOAT(&(x->force[13]), atom_getfloatarg(14, argc, argv));
- else
- SETFLOAT(&(x->force[13]), 0);
-
- if (argc>=14)
- SETFLOAT(&(x->force[12]), atom_getfloatarg(13, argc, argv));
- else
- SETFLOAT(&(x->force[12]), 0);
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 1);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- {
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- SETFLOAT(&(x->force[15]), atom_getfloatarg(2, argc, argv));
- x->posY_old = atom_getfloatarg(2, argc, argv);
- }
- else
- {
- SETFLOAT(&(x->force[1]), 0);
- SETFLOAT(&(x->force[15]), 0);
- x->posY_old = 0;
- }
-
- if (argc>=2)
- {
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- SETFLOAT(&(x->force[14]), atom_getfloatarg(1, argc, argv));
- x->posX_old = atom_getfloatarg(1, argc, argv);
- }
- else
- {
- SETFLOAT(&(x->force[0]), 0);
- SETFLOAT(&(x->force[14]), 0);
- x->posX_old = 0;
- }
-
- return (x);
-}
-
-void iCircle2D_setup(void)
-{
-
- iCircle2D_class = class_new(gensym("iCircle2D"),
- (t_newmethod)iCircle2D_new,
- 0, sizeof(t_iCircle2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iCircle2D_new, gensym("pmpd.iCircle2D"), A_GIMME, 0);
-
- class_addbang(iCircle2D_class, iCircle2D_bang);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setFT, gensym("setFT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setKT, gensym("setKT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setDN, gensym("setDN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setDT, gensym("setDT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setXY, gensym("setXY"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setRN, gensym("setRN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setRT, gensym("setRT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setdT, gensym("setdT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setdRN, gensym("setdRN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setdRT, gensym("setdRT"), A_DEFFLOAT, 0);
- class_addmethod(iCircle2D_class, (t_method)iCircle2D_setG, gensym("setG"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/iCircle3D.c b/src/iCircle3D.c
deleted file mode 100644
index cfbc412..0000000
--- a/src/iCircle3D.c
+++ /dev/null
@@ -1,211 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iCircle3D_class;
-
-typedef struct _iCircle3D {
- t_object x_obj;
- t_atom force[14];
- t_outlet *force_new; // outlet
- t_symbol *x_sym; // send
-
-} t_iCircle3D;
-
-void iCircle3D_bang(t_iCircle3D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_circle_3D"), 14, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_circle_3D"), 14, x->force);
-}
-
-void iCircle3D_setXYZ(t_iCircle3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[3]), X);
- SETFLOAT(&(x->force[4]), Y);
- SETFLOAT(&(x->force[5]), Z);
-}
-void iCircle3D_setVXYZ(t_iCircle3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[0]), X);
- SETFLOAT(&(x->force[1]), Y);
- SETFLOAT(&(x->force[2]), Z);
-}
-
-void iCircle3D_setVX(t_iCircle3D *x, t_float X)
-{
- SETFLOAT(&(x->force[0]), X);
-}
-
-void iCircle3D_setVY(t_iCircle3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[1]), Y);
-}
-
-void iCircle3D_setVZ(t_iCircle3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[2]), Z);
-}
-void iCircle3D_setX(t_iCircle3D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iCircle3D_setY(t_iCircle3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[4]), Y);
-}
-
-void iCircle3D_setZ(t_iCircle3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[5]), Z);
-}
-
-void iCircle3D_setRmin(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iCircle3D_setRmax(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-void iCircle3D_setFN(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iCircle3D_setKN(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iCircle3D_setD(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iCircle3D_setPmax(t_iCircle3D *x, t_float X)
-{
- SETFLOAT(&(x->force[11]), X);
-}
-
-void iCircle3D_setdN(t_iCircle3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[12]), f1);
-}
-
-void iCircle3D_setdKN(t_iCircle3D *x, t_float X)
-{
- SETFLOAT(&(x->force[13]), X);
-}
-
-void *iCircle3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iCircle3D *x = (t_iCircle3D *)pd_new(iCircle3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
-
- if (argc>=15)
- SETFLOAT(&(x->force[13]), atom_getfloatarg(14, argc, argv));
- else
- SETFLOAT(&(x->force[13]), 0);
-
- if (argc>=14)
- SETFLOAT(&(x->force[12]), atom_getfloatarg(13, argc, argv));
- else
- SETFLOAT(&(x->force[12]), 0);
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 10000);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 1);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), 1);
-
- return (x);
-}
-
-void iCircle3D_setup(void)
-{
- iCircle3D_class = class_new(gensym("iCircle3D"),
- (t_newmethod)iCircle3D_new,
- 0, sizeof(t_iCircle3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iCircle3D_new, gensym("pmpd.iCircle3D"), A_GIMME, 0);
-
- class_addbang(iCircle3D_class, iCircle3D_bang);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setPmax, gensym("setPmax"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setdKN, gensym("setdKN"), A_DEFFLOAT, 0);
- class_addmethod(iCircle3D_class, (t_method)iCircle3D_setD, gensym("setD"), A_DEFFLOAT, 0);
-}
diff --git a/src/iCylinder3D.c b/src/iCylinder3D.c
deleted file mode 100644
index 59336bf..0000000
--- a/src/iCylinder3D.c
+++ /dev/null
@@ -1,292 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iCylinder3D_class;
-
-typedef struct _iCylinder3D {
- t_object x_obj;
- t_atom force[21];
- t_outlet *force_new; // outlet
- t_symbol *x_sym; // send
-
-} t_iCylinder3D;
-
-
-
-void iCylinder3D_bang(t_iCylinder3D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_cylinder_3D"), 21, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_cylinder_3D"), 21, x->force);
-}
-
-void iCylinder3D_setXYZ(t_iCylinder3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[3]), X);
- SETFLOAT(&(x->force[4]), Y);
- SETFLOAT(&(x->force[5]), Z);
-}
-void iCylinder3D_setVXYZ(t_iCylinder3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[0]), X);
- SETFLOAT(&(x->force[1]), Y);
- SETFLOAT(&(x->force[2]), Z);
-}
-
-void iCylinder3D_setVX(t_iCylinder3D *x, t_float X)
-{
- SETFLOAT(&(x->force[0]), X);
-}
-
-void iCylinder3D_setVY(t_iCylinder3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[1]), Y);
-}
-
-void iCylinder3D_setVZ(t_iCylinder3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[2]), Z);
-}
-void iCylinder3D_setX(t_iCylinder3D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iCylinder3D_setY(t_iCylinder3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[4]), Y);
-}
-
-void iCylinder3D_setZ(t_iCylinder3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[5]), Z);
-}
-
-void iCylinder3D_setRmin(t_iCylinder3D *x, t_float X)
-{
- SETFLOAT(&(x->force[6]), X);
-}
-
-void iCylinder3D_setRmax(t_iCylinder3D *x, t_float X)
-{
- SETFLOAT(&(x->force[7]), X);
-}
-
-void iCylinder3D_setFN(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iCylinder3D_setKN(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iCylinder3D_setD(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iCylinder3D_setRN(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[11]), f1);
-}
-
-void iCylinder3D_setG(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[12]), f1);
-}
-
-void iCylinder3D_setPmin(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[13]), f1);
-}
-
-void iCylinder3D_setPmax(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[14]), f1);
-}
-
-void iCylinder3D_setFT(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[15]), f1);
-}
-
-void iCylinder3D_setKT(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[16]), f1);
-}
-
-void iCylinder3D_setdN(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[17]), f1);
-}
-
-void iCylinder3D_setdT(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[18]), f1);
-}
-
-void iCylinder3D_setdKN(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[19]), f1);
-}
-
-void iCylinder3D_setdKT(t_iCylinder3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[20]), f1);
-}
-
-void *iCylinder3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iCylinder3D *x = (t_iCylinder3D *)pd_new(iCylinder3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
-
- if (argc>=22)
- SETFLOAT(&(x->force[20]), atom_getfloatarg(21, argc, argv));
- else
- SETFLOAT(&(x->force[20]), 0);
-
- if (argc>=21)
- SETFLOAT(&(x->force[19]), atom_getfloatarg(20, argc, argv));
- else
- SETFLOAT(&(x->force[19]), 0);
-
- if (argc>=20)
- SETFLOAT(&(x->force[18]), atom_getfloatarg(19, argc, argv));
- else
- SETFLOAT(&(x->force[18]), 0);
-
- if (argc>=19)
- SETFLOAT(&(x->force[17]), atom_getfloatarg(18, argc, argv));
- else
- SETFLOAT(&(x->force[17]), 0);
-
- if (argc>=18)
- SETFLOAT(&(x->force[16]), atom_getfloatarg(17, argc, argv));
- else
- SETFLOAT(&(x->force[16]), 0);
-
- if (argc>=17)
- SETFLOAT(&(x->force[15]), atom_getfloatarg(16, argc, argv));
- else
- SETFLOAT(&(x->force[15]), 0);
-
- if (argc>=16)
- SETFLOAT(&(x->force[14]), atom_getfloatarg(15, argc, argv));
- else
- SETFLOAT(&(x->force[14]), 1000);
-
- if (argc>=15)
- SETFLOAT(&(x->force[13]), atom_getfloatarg(14, argc, argv));
- else
- SETFLOAT(&(x->force[13]), -1000);
-
- if (argc>=14)
- SETFLOAT(&(x->force[12]), atom_getfloatarg(13, argc, argv));
- else
- SETFLOAT(&(x->force[12]), 0);
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 1);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), 1);
-
- return (x);
-}
-
-void iCylinder3D_setup(void)
-{
-
- iCylinder3D_class = class_new(gensym("iCylinder3D"),
- (t_newmethod)iCylinder3D_new,
- 0, sizeof(t_iCylinder3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iCylinder3D_new, gensym("pmpd.iCylinder3D"), A_GIMME, 0);
-
- class_addbang(iCylinder3D_class, iCylinder3D_bang);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setPmin, gensym("setPmin"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setPmax, gensym("setPmax"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setRN, gensym("setRN"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setG, gensym("setG"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setFT, gensym("setFT"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setKT, gensym("setKT"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setdT, gensym("setdT"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setdKN, gensym("setdKN"), A_DEFFLOAT, 0);
- class_addmethod(iCylinder3D_class, (t_method)iCylinder3D_setdKT, gensym("setdKT"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/iLine2D.c b/src/iLine2D.c
deleted file mode 100644
index d188d92..0000000
--- a/src/iLine2D.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iLine2D_class;
-
-typedef struct _iLine2D {
- t_object x_obj;
- t_atom force[12];
- t_outlet *force_new;// outlet
- t_symbol *x_sym; // send
-} t_iLine2D;
-
-
-
-void iLine2D_bang(t_iLine2D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_line_2D"), 12, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_line_2D"), 12, x->force);
-}
-
-void iLine2D_X1(t_iLine2D *x, t_float Xmax)
-{
- SETFLOAT(&(x->force[0]), Xmax);
-}
-
-void iLine2D_Y1(t_iLine2D *x, t_float Ymax)
-{
- SETFLOAT(&(x->force[1]), Ymax);
-}
-
-void iLine2D_X2(t_iLine2D *x, t_float X)
-{
- SETFLOAT(&(x->force[2]), X);
-}
-
-void iLine2D_Y2(t_iLine2D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iLine2D_setPmax(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[4]), f1);
-}
-
-void iLine2D_setFN(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[5]), f1);
-}
-
-void iLine2D_setFT(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iLine2D_setKN(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-void iLine2D_setDN(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iLine2D_setDT(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iLine2D_setdN(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iLine2D_setdT(t_iLine2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[11]), f1);
-}
-
-void *iLine2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iLine2D *x = (t_iLine2D *)pd_new(iLine2D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 1);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 1);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), -1);
-
- return (x);
-}
-
-void iLine2D_setup(void)
-{
-
- iLine2D_class = class_new(gensym("iLine2D"),
- (t_newmethod)iLine2D_new,
- 0, sizeof(t_iLine2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iLine2D_new, gensym("pmpd.iLine2D"), A_GIMME, 0);
-
- class_addbang(iLine2D_class, iLine2D_bang);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setPmax, gensym("setPmax"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setFT, gensym("setFT"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setDN, gensym("setDN"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setDT, gensym("setDT"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_setdT, gensym("setdT"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_X1, gensym("setX1"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_Y1, gensym("setY1"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_X2, gensym("setX2"), A_DEFFLOAT, 0);
- class_addmethod(iLine2D_class, (t_method)iLine2D_Y2, gensym("setY2"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/iPlane3D.c b/src/iPlane3D.c
deleted file mode 100644
index f9be065..0000000
--- a/src/iPlane3D.c
+++ /dev/null
@@ -1,193 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iPlane3D_class;
-
-typedef struct _iPlane3D {
- t_object x_obj;
- t_atom force[12];
- t_outlet *force_new; // outlet
- t_symbol *x_sym; // send
-
-} t_iPlane3D;
-
-
-
-void iPlane3D_bang(t_iPlane3D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_plane_3D"), 12, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_plane_3D"), 12, x->force);
-}
-
-void iPlane3D_setXYZ(t_iPlane3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[3]), X);
- SETFLOAT(&(x->force[4]), Y);
- SETFLOAT(&(x->force[5]), Z);
-}
-void iPlane3D_setVXYZ(t_iPlane3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[0]), X);
- SETFLOAT(&(x->force[1]), Y);
- SETFLOAT(&(x->force[2]), Z);
-}
-
-void iPlane3D_setVX(t_iPlane3D *x, t_float X)
-{
- SETFLOAT(&(x->force[0]), X);
-}
-
-void iPlane3D_setVY(t_iPlane3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[1]), Y);
-}
-
-void iPlane3D_setVZ(t_iPlane3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[2]), Z);
-}
-void iPlane3D_setX(t_iPlane3D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iPlane3D_setY(t_iPlane3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[4]), Y);
-}
-
-void iPlane3D_setZ(t_iPlane3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[5]), Z);
-}
-
-void iPlane3D_setFN(t_iPlane3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iPlane3D_setKN(t_iPlane3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-void iPlane3D_setD(t_iPlane3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iPlane3D_setP(t_iPlane3D *x, t_float X)
-{
- SETFLOAT(&(x->force[9]), X);
-}
-
-void iPlane3D_setdN(t_iPlane3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iPlane3D_setdKN(t_iPlane3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[11]), f1);
-}
-
-void *iPlane3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iPlane3D *x = (t_iPlane3D *)pd_new(iPlane3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 10000);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 0);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 0);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), 1);
-
- return (x);
-}
-
-void iPlane3D_setup(void)
-{
-
- iPlane3D_class = class_new(gensym("iPlane3D"),
- (t_newmethod)iPlane3D_new,
- 0, sizeof(t_iPlane3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iPlane3D_new, gensym("pmpd.iPlane3D"), A_GIMME, 0);
-
- class_addbang(iPlane3D_class, iPlane3D_bang);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setP, gensym("setPmax"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setdKN, gensym("setdKN"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(iPlane3D_class, (t_method)iPlane3D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/iSeg2D.c b/src/iSeg2D.c
deleted file mode 100644
index 77c740b..0000000
--- a/src/iSeg2D.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iSeg2D_class;
-
-typedef struct _iSeg2D {
- t_object x_obj;
- t_atom force[12];
- t_outlet *force_new;// outlet
- t_symbol *x_sym; // send
-} t_iSeg2D;
-
-void iSeg2D_bang(t_iSeg2D *x)
-{
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_segment_2D"), 12, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_segment_2D"), 12, x->force);
-}
-
-void iSeg2D_X1(t_iSeg2D *x, t_float Xmax)
-{
- SETFLOAT(&(x->force[0]), Xmax);
-}
-
-void iSeg2D_Y1(t_iSeg2D *x, t_float Ymax)
-{
- SETFLOAT(&(x->force[1]), Ymax);
-}
-
-void iSeg2D_X2(t_iSeg2D *x, t_float X)
-{
- SETFLOAT(&(x->force[2]), X);
-}
-
-void iSeg2D_Y2(t_iSeg2D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iSeg2D_setPmax(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[4]), f1);
-}
-
-void iSeg2D_setFN(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[5]), f1);
-}
-
-void iSeg2D_setFT(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iSeg2D_setKN(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-void iSeg2D_setDN(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iSeg2D_setDT(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iSeg2D_setdN(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[10]), f1);
-}
-
-void iSeg2D_setdT(t_iSeg2D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[11]), f1);
-}
-
-void *iSeg2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iSeg2D *x = (t_iSeg2D *)pd_new(iSeg2D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
-
- if (argc>=13)
- SETFLOAT(&(x->force[11]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[11]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[10]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[10]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 1);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- else
- SETFLOAT(&(x->force[2]), 1);
-
- if (argc>=3)
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- else
- SETFLOAT(&(x->force[1]), 0);
-
- if (argc>=2)
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- else
- SETFLOAT(&(x->force[0]), -1);
-
- return (x);
-}
-
-void iSeg2D_setup(void)
-{
-
- iSeg2D_class = class_new(gensym("iSeg2D"),
- (t_newmethod)iSeg2D_new,
- 0, sizeof(t_iSeg2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iSeg2D_new, gensym("pmpd.iSeg2D"), A_GIMME, 0);
-
- class_addbang(iSeg2D_class, iSeg2D_bang);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setPmax, gensym("setPmax"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setFT, gensym("setFT"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setDN, gensym("setDN"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setDT, gensym("setDT"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_setdT, gensym("setdT"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_X1, gensym("setX1"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_Y1, gensym("setY1"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_X2, gensym("setX2"), A_DEFFLOAT, 0);
- class_addmethod(iSeg2D_class, (t_method)iSeg2D_Y2, gensym("setY2"), A_DEFFLOAT, 0);
-}
diff --git a/src/iSphere3D.c b/src/iSphere3D.c
deleted file mode 100644
index 5b84171..0000000
--- a/src/iSphere3D.c
+++ /dev/null
@@ -1,253 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *iSphere3D_class;
-
-typedef struct _iSphere3D {
- t_object x_obj;
- t_atom force[17];
- // = Xcentre, Ycentre, .., Rmin, Rmax, Fnormal, K normal, F/R normal, DampNormal, dN, posX_old, posY_old, posZ_old, lia_damp, f/R2
- t_outlet *force_new; // outlet
- t_symbol *x_sym; // send
- t_float posX_old, posY_old, posZ_old, posX, posY, posZ; // anciennes position, pour calculer la vitesse de cette interacteur.
-
-} t_iSphere3D;
-
-
-
-void iSphere3D_bang(t_iSphere3D *x)
-{
-
- SETFLOAT(&(x->force[10]), x->posX_old); // posX_old
- SETFLOAT(&(x->force[11]), x->posY_old); // posY_old
- SETFLOAT(&(x->force[12]), x->posZ_old); // posZ_old
-
- x->posX_old = x->posX;
- x->posY_old = x->posY;
- x->posZ_old = x->posZ;
-
- if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, gensym("interactor_sphere_3D"), 17, x->force);
-
- outlet_anything(x->force_new, gensym("interactor_sphere_3D"), 17, x->force);
-}
-
-void iSphere3D_setXYZ(t_iSphere3D *x, t_float X, t_float Y, t_float Z)
-{
- SETFLOAT(&(x->force[0]), X);
- x->posX= X;
- SETFLOAT(&(x->force[1]), Y);
- x->posY = Y;
- SETFLOAT(&(x->force[2]), Z);
- x->posZ = Z;
-}
-
-void iSphere3D_setX(t_iSphere3D *x, t_float X)
-{
- SETFLOAT(&(x->force[0]), X);
- x->posX= X;
-}
-
-void iSphere3D_setY(t_iSphere3D *x, t_float Y)
-{
- SETFLOAT(&(x->force[1]), Y);
- x->posY = Y;
-}
-
-void iSphere3D_setZ(t_iSphere3D *x, t_float Z)
-{
- SETFLOAT(&(x->force[2]), Z);
- x->posZ = Z;
-}
-
-void iSphere3D_setRmin(t_iSphere3D *x, t_float X)
-{
- SETFLOAT(&(x->force[3]), X);
-}
-
-void iSphere3D_setRmax(t_iSphere3D *x, t_float X)
-{
- SETFLOAT(&(x->force[4]), X);
-}
-
-void iSphere3D_setFN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[5]), f1);
-}
-
-void iSphere3D_setKN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[6]), f1);
-}
-
-void iSphere3D_setFRN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[7]), f1);
-}
-
-
-void iSphere3D_setDN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[8]), f1);
-}
-
-void iSphere3D_setdN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[9]), f1);
-}
-
-void iSphere3D_setG(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[13]), f1);
-}
-
-void iSphere3D_setdKN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[14]), f1);
-}
-
-void iSphere3D_setdRN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[15]), f1);
-}
-
-void iSphere3D_setdGN(t_iSphere3D *x, t_floatarg f1)
-{
- SETFLOAT(&(x->force[16]), f1);
-}
-
-void *iSphere3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_iSphere3D *x = (t_iSphere3D *)pd_new(iSphere3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
-
- x->force_new=outlet_new(&x->x_obj, 0);
-
- if (argc>=15)
- SETFLOAT(&(x->force[16]), atom_getfloatarg(14, argc, argv));
- else
- SETFLOAT(&(x->force[16]), 0);
-
- if (argc>=14)
- SETFLOAT(&(x->force[15]), atom_getfloatarg(13, argc, argv));
- else
- SETFLOAT(&(x->force[15]), 0);
-
- if (argc>=13)
- SETFLOAT(&(x->force[14]), atom_getfloatarg(12, argc, argv));
- else
- SETFLOAT(&(x->force[14]), 0);
-
- if (argc>=12)
- SETFLOAT(&(x->force[13]), atom_getfloatarg(11, argc, argv));
- else
- SETFLOAT(&(x->force[13]), 0);
-
- if (argc>=11)
- SETFLOAT(&(x->force[9]), atom_getfloatarg(10, argc, argv));
- else
- SETFLOAT(&(x->force[9]), 0);
-
- if (argc>=10)
- SETFLOAT(&(x->force[8]), atom_getfloatarg(9, argc, argv));
- else
- SETFLOAT(&(x->force[8]), 0);
-
- if (argc>=9)
- SETFLOAT(&(x->force[7]), atom_getfloatarg(8, argc, argv));
- else
- SETFLOAT(&(x->force[7]), 0);
-
- if (argc>=8)
- SETFLOAT(&(x->force[6]), atom_getfloatarg(7, argc, argv));
- else
- SETFLOAT(&(x->force[6]), 0);
-
- if (argc>=7)
- SETFLOAT(&(x->force[5]), atom_getfloatarg(6, argc, argv));
- else
- SETFLOAT(&(x->force[5]), 0);
-
- if (argc>=6)
- SETFLOAT(&(x->force[4]), atom_getfloatarg(5, argc, argv));
- else
- SETFLOAT(&(x->force[4]), 1);
-
- if (argc>=5)
- SETFLOAT(&(x->force[3]), atom_getfloatarg(4, argc, argv));
- else
- SETFLOAT(&(x->force[3]), 0);
-
- if (argc>=4)
- {
- SETFLOAT(&(x->force[12]), atom_getfloatarg(3, argc, argv));
- SETFLOAT(&(x->force[2]), atom_getfloatarg(3, argc, argv));
- x->posZ_old = atom_getfloatarg(3, argc, argv);
- }
- else
- {
- SETFLOAT(&(x->force[12]), 0);
- SETFLOAT(&(x->force[2]), 0);
- x->posZ_old = 0;
- }
-
- if (argc>=3)
- {
- SETFLOAT(&(x->force[11]), atom_getfloatarg(2, argc, argv));
- SETFLOAT(&(x->force[1]), atom_getfloatarg(2, argc, argv));
- x->posY_old = atom_getfloatarg(2, argc, argv);
-
- }
- else
- {
- SETFLOAT(&(x->force[1]), 0);
- SETFLOAT(&(x->force[11]), 0);
- x->posY_old = 0;
- }
-
- if (argc>=2)
- {
- SETFLOAT(&(x->force[10]), atom_getfloatarg(1, argc, argv));
- SETFLOAT(&(x->force[0]), atom_getfloatarg(1, argc, argv));
- x->posX_old = atom_getfloatarg(1, argc, argv);
- }
- else
- {
- SETFLOAT(&(x->force[10]), 0);
- SETFLOAT(&(x->force[0]), 0);
- x->posX_old = 0;
- }
-
- return (x);
-}
-
-void iSphere3D_setup(void)
-{
-
- iSphere3D_class = class_new(gensym("iSphere3D"),
- (t_newmethod)iSphere3D_new,
- 0, sizeof(t_iSphere3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)iSphere3D_new, gensym("pmpd.iSphere3D"), A_GIMME, 0);
-
- class_addbang(iSphere3D_class, iSphere3D_bang);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setFN, gensym("setFN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setKN, gensym("setKN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setDN, gensym("setDN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setFRN, gensym("setFRN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setdN, gensym("setdN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setdRN, gensym("setdRN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setG, gensym("setG"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setdKN, gensym("setdKN"), A_DEFFLOAT, 0);
- class_addmethod(iSphere3D_class, (t_method)iSphere3D_setdGN, gensym("setdGN"), A_DEFFLOAT, 0);
-
-}
-
-
diff --git a/src/link.c b/src/link.c
deleted file mode 100644
index 459f4a2..0000000
--- a/src/link.c
+++ /dev/null
@@ -1,161 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *linkKD_class;
-
-typedef struct _linkKD {
- t_object x_obj;
- t_float raideur, viscosite, D2, longueur, distance_old, position1, position2, position_old1, position_old2;
- t_outlet *force1;
- t_outlet *force2;
- t_float Lmin, Lmax;
- t_symbol *x_sym; // receive
-} t_linkKD;
-
-void linkKD_float(t_linkKD *x, t_floatarg f1)
-{
- x->position1 = f1;
-}
-
-void linkKD_bang(t_linkKD *x)
-{
- t_float force1, force2, distance;
-
- distance = (x->position2 - x->position1);
-//distance = abs(x->position2 - x->position1);
- if (distance<0) distance = -distance;
-
- force1 = x->raideur*(distance-(x->longueur)) + x->viscosite*(distance - x->distance_old) ;
-
- x->distance_old = distance;
-
- if (distance > x->Lmax) force1=0;
- if (distance < x->Lmin) force1=0;
-
- if (distance != 0)
- {
- force1 = force1 * (x->position2 - x->position1) / distance;
- }
-
- force2 = -force1 + (x->position_old2 - x->position2)*x->D2;
- force1 += (x->position_old1 - x->position1)*x->D2;
- // masse damping
-
- outlet_float(x->force1, force1);
- outlet_float(x->force2, force2);
-
-
- x->position_old1 = x->position1;
- x->position_old2 = x->position2;
-
-}
-
-void linkKD_reset(t_linkKD *x)
-{
- x->position1 = 0;
- x->position2 = 0;
-
- x->position_old1 = 0;
- x->position_old2 = 0;
-
- x->distance_old = x->longueur;
-}
-
-void linkKD_resetF(t_linkKD *x)
-{
- x->position_old1 = x->position1;
- x->position_old2 = x->position2;
-
- x->distance_old = x->longueur;
-}
-
-void linkKD_resetl(t_linkKD *x)
-{
- x->longueur = (x->position1 - x->position2);
-}
-
-void linkKD_setL(t_linkKD *x, t_float L)
-{
- x->longueur = L;
-}
-
-void linkKD_setK(t_linkKD *x, t_float K)
-{
- x->raideur = K;
-}
-
-void linkKD_setD(t_linkKD *x, t_float D)
-{
- x->viscosite = D;
-}
-
-void linkKD_setD2(t_linkKD *x, t_float D2)
-{
- x->D2 = D2;
-}
-
-void linkKD_Lmin(t_linkKD *x, t_float Lmin)
-{
- x->Lmin = Lmin;
-}
-
-void linkKD_Lmax(t_linkKD *x, t_float Lmax)
-{
- x->Lmax = Lmax;
-}
-
-static void linkKD_free(t_linkKD *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *linkKD_new(t_symbol *s, t_floatarg L, t_floatarg K, t_floatarg D, t_floatarg D2 )
-{
-
- t_linkKD *x = (t_linkKD *)pd_new(linkKD_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- floatinlet_new(&x->x_obj, &x->position2);
-
- x->force1=outlet_new(&x->x_obj, 0);
- x->force2=outlet_new(&x->x_obj, 0);
-
- x->position1 = 0;
- x->position2 = 0;
-
- x->raideur=K;
- x->viscosite=D;
- x->D2=D2;
-
- x->Lmin= 0;
- x->Lmax= 10000;
-
- x->longueur=L;
-
- return (void *)x;
-}
-
-void link_setup(void)
-{
- linkKD_class = class_new(gensym("link"),
- (t_newmethod)linkKD_new,
- (t_method)linkKD_free,
- sizeof(t_linkKD),
- CLASS_DEFAULT, A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addcreator((t_newmethod)linkKD_new, gensym("lia"), A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addfloat(linkKD_class, linkKD_float);
- class_addbang(linkKD_class, linkKD_bang);
- class_addmethod(linkKD_class, (t_method)linkKD_reset, gensym("reset"), 0);
- class_addmethod(linkKD_class, (t_method)linkKD_resetl, gensym("resetL"), 0);
- class_addmethod(linkKD_class, (t_method)linkKD_resetF, gensym("resetF"), 0);
- class_addmethod(linkKD_class, (t_method)linkKD_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(linkKD_class, (t_method)linkKD_setD2, gensym("setD2"), A_DEFFLOAT, 0);
- class_addmethod(linkKD_class, (t_method)linkKD_setK, gensym("setK"), A_DEFFLOAT, 0);
- class_addmethod(linkKD_class, (t_method)linkKD_setL, gensym("setL"), A_DEFFLOAT, 0);
- class_addmethod(linkKD_class, (t_method)linkKD_Lmin, gensym("setLmin"), A_DEFFLOAT, 0);
- class_addmethod(linkKD_class, (t_method)linkKD_Lmax, gensym("setLmax"), A_DEFFLOAT, 0);
-}
diff --git a/src/link2D.c b/src/link2D.c
deleted file mode 100644
index 318685d..0000000
--- a/src/link2D.c
+++ /dev/null
@@ -1,212 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *link2D_class;
-
-typedef struct _link2D {
- t_object x_obj;
- t_float raideur, viscosite, D2, longueur, distance_old;
- t_float position2Dx1, position2Dx2, posx_old1, posx_old2;
- t_float position2Dy1, position2Dy2, posy_old1, posy_old2;
- t_float Lmin, Lmax, muscle;
- t_outlet *force1;
- t_outlet *force2;
- t_symbol *x_sym; // receive
-} t_link2D;
-
-void link2D_position2D(t_link2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->position2Dx1 = f1;
- x->position2Dy1 = f2;
-}
-
-void link2D_position2D2(t_link2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->position2Dx2 = f1;
- x->position2Dy2 = f2;
-}
-
-void link2D_bang(t_link2D *x)
-{
- t_float force, force2, forcex1, forcey1, forcex2, forcey2, distance;
- t_atom force1[2];
-
- distance = sqrt ( pow((x->position2Dx2-x->position2Dx1), 2) + pow((x->position2Dy2-x->position2Dy1), 2) );
-
- force = ( x->raideur*(distance-(x->longueur * x->muscle)) ) + ( x->viscosite*(distance-x->distance_old) );
-
- if (distance > x->Lmax) force=0;
- if (distance < x->Lmin) force=0;
-
- if (distance != 0)
- {
- forcex1 = force * (x->position2Dx2 - x->position2Dx1) / distance;
- forcey1 = force * (x->position2Dy2 - x->position2Dy1) / distance;
- }
- else
- {
- forcex1 = 0;
- forcey1 = 0 ;
- }
-
- forcex2 = -forcex1;
- forcey2 = -forcey1;
-
- forcex1 += (x->posx_old1 - x->position2Dx1)*x->D2;
- forcey1 += (x->posy_old1 - x->position2Dy1)*x->D2;
-
- forcex2 += (x->posx_old2 - x->position2Dx2)*x->D2;
- forcey2 += (x->posy_old2 - x->position2Dy2)*x->D2;
-
- SETFLOAT(&(force1[0]), forcex2 );
- SETFLOAT(&(force1[1]), forcey2 );
-
- outlet_anything(x->force2, gensym("force2D"), 2, force1);
-
- SETFLOAT(&(force1[0]), forcex1 );
- SETFLOAT(&(force1[1]), forcey1 );
-
- outlet_anything(x->force1, gensym("force2D"), 2, force1);
-
- x->posx_old2 = x->position2Dx2;
- x->posx_old1 = x->position2Dx1;
-
- x->posy_old2 = x->position2Dy2;
- x->posy_old1 = x->position2Dy1;
-
- x->distance_old = distance;
-}
-
-void link2D_reset(t_link2D *x)
-{
- x->position2Dx1 = 0;
- x->position2Dx2 = 0;
- x->posx_old1 = 0;
- x->posx_old2 = 0;
-
- x->position2Dy1 = 0;
- x->position2Dy2 = 0;
- x->posy_old1 = 0;
- x->posy_old2 = 0;
-
- x->distance_old = x->longueur;
-}
-
-void link2D_resetF(t_link2D *x)
-{
-
- x->posx_old1 = x->position2Dx1;
- x->posx_old2 = x->position2Dx2;
-
- x->posy_old1 = x->position2Dy1;
- x->posy_old2 = x->position2Dy2;
-
- x->distance_old = x->longueur;
-
-}
-
-void link2D_resetL(t_link2D *x)
-{
- x->longueur = sqrt ( pow((x->position2Dx2-x->position2Dx1), 2) + pow((x->position2Dy2-x->position2Dy1), 2) );
-}
-
-
-void link2D_setK(t_link2D *x, t_float K)
-{
- x->raideur = K;
-}
-
-void link2D_setL(t_link2D *x, t_float L)
-{
- x->longueur = L;
-}
-
-void link2D_setD(t_link2D *x, t_float D)
-{
- x->viscosite = D;
-}
-
-void link2D_setD2(t_link2D *x, t_float D)
-{
- x->D2 = D;
-}
-
-void link2D_Lmin(t_link2D *x, t_float Lmin)
-{
- x->Lmin = Lmin;
-}
-
-void link2D_Lmax(t_link2D *x, t_float Lmax)
-{
- x->Lmax = Lmax;
-}
-
-void link2D_muscle(t_link2D *x, t_float muscle)
-{
- x->muscle = muscle;
-}
-
-static void link2D_free(t_link2D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *link2D_new(t_symbol *s, t_floatarg l, t_floatarg K, t_floatarg D, t_floatarg D2)
-{
-
- t_link2D *x = (t_link2D *)pd_new(link2D_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("position2D"), gensym("position2D2"));
-
- x->force1=outlet_new(&x->x_obj, 0);
- x->force2=outlet_new(&x->x_obj, 0);
-
- x->position2Dx1 = 0;
- x->position2Dx2 = 0;
- x->position2Dy1 = 0;
- x->position2Dy2 = 0;
-
- x->raideur=K;
- x->viscosite=D;
- x->longueur = l;
-
- x->D2=D2;
-
- x->Lmin= 0;
- x->Lmax= 10000;
- x->muscle= 1;
-
- x->distance_old = x->longueur;
-
- return (x);
-}
-
-void link2D_setup(void)
-{
-
- link2D_class = class_new(gensym("link2D"),
- (t_newmethod)link2D_new,
- (t_method)link2D_free,
- sizeof(t_link2D),
- CLASS_DEFAULT, A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addcreator((t_newmethod)link2D_new, gensym("lia2D"), A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addbang(link2D_class, link2D_bang);
- class_addmethod(link2D_class, (t_method)link2D_reset, gensym("reset"), 0);
- class_addmethod(link2D_class, (t_method)link2D_resetL, gensym("resetL"), 0);
- class_addmethod(link2D_class, (t_method)link2D_resetF, gensym("resetF"), 0);
- class_addmethod(link2D_class, (t_method)link2D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_setD2, gensym("setD2"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_setK, gensym("setK"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_setL, gensym("setL"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_Lmin, gensym("setLmin"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_Lmax, gensym("setLmax"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_muscle, gensym("setM"), A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(link2D_class, (t_method)link2D_position2D2, gensym("position2D2"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
-}
diff --git a/src/link3D.c b/src/link3D.c
deleted file mode 100644
index bbf0987..0000000
--- a/src/link3D.c
+++ /dev/null
@@ -1,237 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *link3D_class;
-
-typedef struct _link3D {
- t_object x_obj;
- t_float raideur, viscosite, D2, longueur, distance_old;
- t_float position3Dx1, position3Dx2, posx_old1, posx_old2;
- t_float position3Dy1, position3Dy2, posy_old1, posy_old2;
- t_float position3Dz1, position3Dz2, posz_old1, posz_old2;
- t_float Lmin, Lmax, muscle;
- t_outlet *force1;
- t_outlet *force2;
- t_symbol *x_sym; // receive
-} t_link3D;
-
-void link3D_position3D(t_link3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->position3Dx1 = f1;
- x->position3Dy1 = f2;
- x->position3Dz1 = f3;
-
-}
-
-void link3D_position3D2(t_link3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->position3Dx2 = f1;
- x->position3Dy2 = f2;
- x->position3Dz2 = f3;
-}
-
-void link3D_bang(t_link3D *x)
-{
- t_float force, force2, forcex1, forcey1, forcez1, forcex2, forcey2, forcez2, distance;
- t_atom force1[3];
-
- distance = sqrt ( pow((x->position3Dx2-x->position3Dx1), 2) + pow((x->position3Dy2-x->position3Dy1),2) + pow((x->position3Dz2-x->position3Dz1), 2) );
-
- force = ( x->raideur*(distance-(x->longueur * x->muscle)) ) + ( x->viscosite*(distance-x->distance_old) );
-
- if (distance > x->Lmax) force=0;
- if (distance < x->Lmin) force=0;
-
- if (distance != 0)
- {
- forcex1 = force * (x->position3Dx2 - x->position3Dx1) / distance;
- forcey1 = force * (x->position3Dy2 - x->position3Dy1) / distance;
- forcez1 = force * (x->position3Dz2 - x->position3Dz1) / distance;
- }
- else
- {
- forcex1 = 0;
- forcey1 = 0;
- forcez1 = 0;
- }
-
- forcex2 = -forcex1;
- forcey2 = -forcey1;
- forcez2 = -forcez1;
-
- forcex1 += (x->posx_old1 - x->position3Dx1)*x->D2;
- forcey1 += (x->posy_old1 - x->position3Dy1)*x->D2;
- forcez1 += (x->posz_old1 - x->position3Dz1)*x->D2;
-
- forcex2 += (x->posx_old2 - x->position3Dx2)*x->D2;
- forcey2 += (x->posy_old2 - x->position3Dy2)*x->D2;
- forcez2 += (x->posz_old2 - x->position3Dz2)*x->D2;
-
-
- SETFLOAT(&(force1[0]), forcex1 );
- SETFLOAT(&(force1[1]), forcey1 );
- SETFLOAT(&(force1[2]), forcez1 );
- outlet_anything(x->force1, gensym("force3D"), 3, force1);
-
- SETFLOAT(&(force1[0]), forcex2 );
- SETFLOAT(&(force1[1]), forcey2 );
- SETFLOAT(&(force1[2]), forcez2 );
-
- outlet_anything(x->force2, gensym("force3D"), 3, force1);
-
- x->posx_old2 = x->position3Dx2;
- x->posx_old1 = x->position3Dx1;
-
- x->posy_old2 = x->position3Dy2;
- x->posy_old1 = x->position3Dy1;
-
- x->posz_old2 = x->position3Dz2;
- x->posz_old1 = x->position3Dz1;
-
- x->distance_old = distance;
-}
-
-void link3D_reset(t_link3D *x)
-{
- x->position3Dx1 = 0;
- x->position3Dx2 = 0;
- x->posx_old1 = 0;
- x->posx_old2 = 0;
-
- x->position3Dy1 = 0;
- x->position3Dy2 = 0;
- x->posy_old1 = 0;
- x->posy_old2 = 0;
-
- x->position3Dz1 = 0;
- x->position3Dz2 = 0;
- x->posz_old1 = 0;
- x->posz_old2 = 0;
-
- x->distance_old = x->longueur;
-
-}
-
-void link3D_resetF(t_link3D *x)
-{
-
- x->posx_old1 = x->position3Dx1;
- x->posx_old2 = x->position3Dx2;
-
- x->posy_old1 = x->position3Dy1;
- x->posy_old2 = x->position3Dy2;
-
- x->posz_old1 = x->position3Dz1;
- x->posz_old2 = x->position3Dz2;
-
- x->distance_old = x->longueur;
-
-}
-
-void link3D_resetL(t_link3D *x)
-{
- x->longueur = sqrt ( pow((x->position3Dx2-x->position3Dx1), 2) + pow((x->position3Dy2-x->position3Dy1),2) + pow((x->position3Dz2-x->position3Dz1), 2) );
-}
-
-void link3D_setK(t_link3D *x, t_float K)
-{
- x->raideur = K;
-}
-
-void link3D_setL(t_link3D *x, t_float L)
-{
- x->longueur = L;
-}
-
-void link3D_setD(t_link3D *x, t_float D)
-{
- x->viscosite = D;
-}
-
-void link3D_setD2(t_link3D *x, t_float D2)
-{
- x->D2 = D2;
-}
-
-void link3D_Lmin(t_link3D *x, t_float Lmin)
-{
- x->Lmin = Lmin;
-}
-
-void link3D_Lmax(t_link3D *x, t_float Lmax)
-{
- x->Lmax = Lmax;
-}
-
-void link3D_muscle(t_link3D *x, t_float muscle)
-{
- x->muscle = muscle;
-}
-
-static void link3D_free(t_link3D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *link3D_new(t_symbol *s, t_floatarg l, t_floatarg K, t_floatarg D, t_floatarg D2)
-{
-
- t_link3D *x = (t_link3D *)pd_new(link3D_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("position3D"), gensym("position3D2"));
-
- x->force1=outlet_new(&x->x_obj, 0);
- x->force2=outlet_new(&x->x_obj, 0);
-
- x->position3Dx1 = 0;
- x->position3Dx2 = 0;
- x->position3Dy1 = 0;
- x->position3Dy2 = 0;
- x->position3Dz1 = 0;
- x->position3Dz2 = 0;
-
- x->raideur = K;
- x->viscosite = D;
- x->longueur = l;
-
- x->D2 = D2;
-
- x->Lmin= 0;
- x->Lmax= 10000;
-
- x->distance_old = x->longueur;
-
- x->muscle = 1;
-
- return (void *)x;
-}
-
-void link3D_setup(void)
-{
-
- link3D_class = class_new(gensym("link3D"),
- (t_newmethod)link3D_new,
- (t_method)link3D_free,
- sizeof(t_link3D),
- CLASS_DEFAULT, A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addcreator((t_newmethod)link3D_new, gensym("lia3D"), A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addbang(link3D_class, link3D_bang);
- class_addmethod(link3D_class, (t_method)link3D_reset, gensym("reset"), 0);
- class_addmethod(link3D_class, (t_method)link3D_resetL, gensym("resetL"), 0);
- class_addmethod(link3D_class, (t_method)link3D_resetF, gensym("resetF"), 0);
- class_addmethod(link3D_class, (t_method)link3D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_setD2, gensym("setD2"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_setK, gensym("setK"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_setL, gensym("setL"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_Lmin, gensym("setLmin"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_Lmax, gensym("setLmax"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_muscle, gensym("setM"), A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(link3D_class, (t_method)link3D_position3D2, gensym("position3D2"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
-}
diff --git a/src/makefile b/src/makefile
deleted file mode 100644
index 45f07bf..0000000
--- a/src/makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-current:
- echo make pd_linux, pd_nt, pd_darwin
-
-clean: ; rm -f *.pd_linux *.o
-
-# ----------------------- NT -----------------------
-
-pd_nt: pmpd.dll mass.dll link.dll mass2D.dll link2D.dll mass3D.dll link3D.dll iAmbient2D.dll iLine2D.dll iSeg2D.dll iCircle2D.dll tSquare2D.dll tLine2D.dll tSeg2D.dll tCircle2D.dll tLink2D.dll iAmbient3D.dll iSphere3D.dll iPlane3D.dll iCircle3D.dll iCylinder3D.dll tCube3D.dll tSphere3D.dll tPlane3D.dll tCircle3D.dll tCylinder3D.dll tLink3D.dll pmpd~.dll
-
-.SUFFIXES: .dll
-
-PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
-VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-
-PDNTINCLUDE = /I. /I\tcl\include /I..\..\..\pd\src /I$(VC)\include
-
-PDNTLDIR = $(VC)\lib
-PDNTLIB = $(PDNTLDIR)\libc.lib \
- $(PDNTLDIR)\oldnames.lib \
- $(PDNTLDIR)\kernel32.lib \
- ..\..\..\pd\bin\pd.lib
-
-.c.dll:
- cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
- link /dll /export:$*_setup $*.obj $(PDNTLIB)
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix5: pmpd.pd_irix5
-
-.SUFFIXES: .pd_irix5
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-
-SGIINCLUDE = -I../../src/
-
-.c.pd_irix5:
- cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm $*.o
-
-# ----------------------- IRIX 6.x -----------------------
-
-pd_irix6: pmpd.pd_irix6
-
-.SUFFIXES: .pd_irix6
-
-SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
- -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
- -Ofast=ip32
-
-.c.pd_irix6:
- cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -IPA -n32 -shared -rdata_shared -o $*.pd_irix6 $*.o
- rm $*.o
-
-# ----------------------- LINUX i386 -----------------------
-
-pd_linux: pmpd.pd_linux mass.pd_linux link.pd_linux mass2D.pd_linux link2D.pd_linux mass3D.pd_linux link3D.pd_linux iAmbient2D.pd_linux iLine2D.pd_linux iSeg2D.pd_linux iCircle2D.pd_linux tSquare2D.pd_linux tLine2D.pd_linux tSeg2D.pd_linux tCircle2D.pd_linux tLink2D.pd_linux iAmbient3D.pd_linux iSphere3D.pd_linux iPlane3D.pd_linux iCircle3D.pd_linux iCylinder3D.pd_linux tCube3D.pd_linux tSphere3D.pd_linux tPlane3D.pd_linux tCircle3D.pd_linux tCylinder3D.pd_linux tLink3D.pd_linux pmpd~.pd_linux
-
-.SUFFIXES: .pd_linux
-
-LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
- -Wall -W -Wshadow -Wstrict-prototypes -Werror \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-LINUXINCLUDE = -I../../src
-
-.c.pd_linux:
- cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- ld --export-dynamic -shared -o $*.pd_linux $*.o -lc -lm
- strip --strip-unneeded $*.pd_linux
- rm $*.o
-
-# ----------------------- Mac OS X (Darwin) -----------------------
-
-pd_darwin: pmpd.pd_darwin mass.pd_darwin link.pd_darwin mass2D.pd_darwin link2D.pd_darwin mass3D.pd_darwin link3D.pd_darwin iAmbient2D.pd_darwin iLine2D.pd_darwin iSeg2D.pd_darwin iCircle2D.pd_darwin tSquare2D.pd_darwin tLine2D.pd_darwin tSeg2D.pd_darwin tCircle2D.pd_darwin tLink2D.pd_darwin iAmbient3D.pd_darwin iSphere3D.pd_darwin iPlane3D.pd_darwin iCircle3D.pd_darwin iCylinder3D.pd_darwin tCube3D.pd_darwin tSphere3D.pd_darwin tPlane3D.pd_darwin tCircle3D.pd_darwin tCylinder3D.pd_darwin tLink3D.pd_darwin pmpd~.pd_darwin
-
-.SUFFIXES: .pd_darwin
-
-DARWINCFLAGS = -DPD -DUNIX -DMACOSX -O2 \
- -Wall -W -Wshadow -Wstrict-prototypes \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-# where is your m_pd.h ???
-DARWININCLUDE = -I/. -I../pd/src -I../pd/obj
-
-.c.pd_darwin:
- cc $(DARWINCFLAGS) $(DARWININCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
-
-
diff --git a/src/mass.c b/src/mass.c
deleted file mode 100644
index de1a331..0000000
--- a/src/mass.c
+++ /dev/null
@@ -1,186 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) )
-
-
-static t_class *mass_class;
-
-typedef struct _mass {
- t_object x_obj;
- t_float pos_old_1, pos_old_2, Xinit;
- t_float force, mass, dX;
- t_float minX, maxX;
- t_outlet *position_new, *vitesse_out, *force_out;
- t_symbol *x_sym; // receive
- unsigned int x_state; // random
- t_float x_f; // random
-
-} t_mass;
-
-static int makeseed(void)
-{
- static unsigned int random_nextseed = 1489853723;
- random_nextseed = random_nextseed * 435898247 + 938284287;
- return (random_nextseed & 0x7fffffff);
-}
-
-static float random_bang(t_mass *x)
-{
- int nval;
- int range = 2000000;
- float rnd;
- unsigned int randval = x->x_state;
- x->x_state = randval = randval * 472940017 + 832416023;
- nval = ((double)range) * ((double)randval)
- * (1./4294967296.);
- if (nval >= range) nval = range-1;
-
- rnd=nval;
-
- rnd-=1000000;
- rnd=rnd/1000000.; //pour mettre entre -1 et 1;
- return (rnd);
-}
-
-void mass_minX(t_mass *x, t_floatarg f1)
-{
- x->minX = f1;
-}
-
-void mass_maxX(t_mass *x, t_floatarg f1)
-{
- x->maxX = f1;
-}
-
-void mass_float(t_mass *x, t_floatarg f1)
-{
- x->force += f1;
-}
-
-void mass_bang(t_mass *x)
-{
- t_float pos_new;
-
- if (x->mass > 0)
- pos_new = x->force/x->mass + 2*x->pos_old_1 - x->pos_old_2;
- else pos_new = x->pos_old_1;
-
- pos_new = max(min(x->maxX, pos_new), x->minX);
-
- pos_new += x->dX;
-
- x->pos_old_1 += x->dX; // pour ne pas avoir d'inertie suplementaire du a ce deplacement
-
- outlet_float(x->vitesse_out, x->pos_old_1 - x->pos_old_2);
- outlet_float(x->force_out, x->force);
- outlet_float(x->position_new, pos_new);
-
- x->pos_old_2 = x->pos_old_1;
- x->pos_old_1 = pos_new;
-
-// x->force = 0;
-
- x->force = random_bang(x)*1e-25; // avoiding denormal problem by adding low amplitude noise
-
- x->dX = 0;
-
-}
-
-void mass_reset(t_mass *x)
-{
- x->pos_old_2 = x->Xinit;
- x->pos_old_1 = x->Xinit;
-
- x->force=0;
-
- outlet_float(x->position_new, x->Xinit);
-}
-
-void mass_resetF(t_mass *x)
-{
- x->force=0;
-
-}
-
-void mass_dX(t_mass *x, t_float posX)
-{
- x->dX += posX;
-}
-
-void mass_setX(t_mass *x, t_float posX)
-{
- x->pos_old_2 = posX; // clear history for stability (instability) problem
- x->pos_old_1 = posX;
-
- x->force=0;
-
- outlet_float(x->position_new, posX);
-}
-
-void mass_loadbang(t_mass *x)
-{
- outlet_float(x->position_new, x->Xinit);
-}
-
-void mass_set_mass(t_mass *x, t_float mass)
-{
- x->mass=mass;
-}
-
-static void mass_free(t_mass *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *mass_new(t_symbol *s, t_floatarg M, t_floatarg X)
-{
-
- t_mass *x = (t_mass *)pd_new(mass_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- x->position_new=outlet_new(&x->x_obj, 0);
- x->force_out=outlet_new(&x->x_obj, 0);
- x->vitesse_out=outlet_new(&x->x_obj, 0);
-
- x->Xinit=X;
-
- x->pos_old_1 = X;
- x->pos_old_2 = X;
- x->force=0;
- x->mass=M;
-
- x->minX = -100000;
- x->maxX = 100000;
-
- if (x->mass<=0) x->mass=1;
-
- makeseed();
-
- return (void *)x;
-}
-
-void mass_setup(void)
-{
-
- mass_class = class_new(gensym("mass"),
- (t_newmethod)mass_new,
- (t_method)mass_free,
- sizeof(t_mass),
- CLASS_DEFAULT, A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT,0);
- class_addcreator((t_newmethod)mass_new, gensym("masse"), A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT,0);
- class_addfloat(mass_class, mass_float);
- class_addbang(mass_class, mass_bang);
- class_addmethod(mass_class, (t_method)mass_set_mass, gensym("setM"), A_DEFFLOAT, 0);
- class_addmethod(mass_class, (t_method)mass_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(mass_class, (t_method)mass_dX, gensym("dX"), A_DEFFLOAT, 0);
- class_addmethod(mass_class, (t_method)mass_reset, gensym("reset"), 0);
- class_addmethod(mass_class, (t_method)mass_resetF, gensym("resetF"), 0);
- class_addmethod(mass_class, (t_method)mass_minX, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(mass_class, (t_method)mass_maxX, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(mass_class, (t_method)mass_loadbang, gensym("loadbang"), 0);
-}
-
diff --git a/src/mass2D.c b/src/mass2D.c
deleted file mode 100644
index bea7cd7..0000000
--- a/src/mass2D.c
+++ /dev/null
@@ -1,811 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) )
-
-static t_class *mass2D_class;
-
-typedef struct _mass2D {
- t_object x_obj;
- t_float posX_old_1, posX_old_2, posY_old_1, posY_old_2, Xinit, Yinit;
- t_float forceX, forceY, VX, VY, dX, dY, onoff;
- t_float mass2D, seuil, damp;
- t_float minX, maxX, minY, maxY;
- t_atom pos_new[2], vitesse[3], force[3];
- t_outlet *position2D_new, *vitesse_out, *force_out;
- t_symbol *x_sym; // receive
- unsigned int x_state; // random
- t_float x_f; // random
-} t_mass2D;
-
-static int makeseed2D(void)
-{
- static unsigned int random_nextseed = 1489853723;
- random_nextseed = random_nextseed * 435898247 + 938284287;
- return (random_nextseed & 0x7fffffff);
-}
-
-static float random_bang2D(t_mass2D *x)
-{
- int nval;
- int range = 2000000;
- float rnd;
- unsigned int randval = x->x_state;
- x->x_state = randval = randval * 472940017 + 832416023;
- nval = ((double)range) * ((double)randval)
- * (1./4294967296.);
- if (nval >= range) nval = range-1;
-
- rnd=nval;
-
- rnd-=1000000;
- rnd=rnd/1000000.; //pour mettre entre -1 et 1;
- return (rnd);
-}
-
-void mass2D_seuil(t_mass2D *x, t_floatarg f1)
-{
- x->seuil = f1;
-}
-
-void mass2D_on(t_mass2D *x)
-{
- x->onoff = 1;
-}
-
-void mass2D_off(t_mass2D *x)
-{
- x->onoff = 0;
-}
-
-void mass2D_minX(t_mass2D *x, t_floatarg f1)
-{
- x->minX = f1;
-}
-
-void mass2D_maxX(t_mass2D *x, t_floatarg f1)
-{
- x->maxX = f1;
-}
-
-void mass2D_minY(t_mass2D *x, t_floatarg f1)
-{
- x->minY = f1;
-}
-
-void mass2D_maxY(t_mass2D *x, t_floatarg f1)
-{
- x->maxY = f1;
-}
-
-void mass2D_force(t_mass2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->forceX = x->forceX+f1;
- x->forceY = x->forceY+f2;
-}
-
-void mass2D_displace(t_mass2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->dX += f1;
- x->dY += f2;
-}
-
-void mass2D_damp(t_mass2D *x, t_floatarg f1)
-{
- x->damp = f1;
-}
-
-void mass2D_dX(t_mass2D *x, t_floatarg f1)
-{
- x->dX += f1;
-}
-
-void mass2D_dY(t_mass2D *x, t_floatarg f1)
-{
- x->dY += f1;
-}
-
-void mass2D_bang(t_mass2D *x)
-{
- t_float posX_new, posY_new, vX=1, vY=1;
- if (x->onoff != 0)
- {
-
- if (x->seuil > 0)
- {
- if (x->posY_old_1 == x->minY) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (fabs(x->forceX)<=(x->seuil * -(x->forceY)))
- vX = 0; // on est a l'interieur du cone de frotement,
- }
-
- if (x->posY_old_1 == x->maxY) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (fabs(x->forceX)<=(x->seuil * (x->forceY)))
- vX = 0; // on est a l'interieur du cone de frotement,
- }
-
- if (x->posX_old_1 == x->minX) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (fabs(x->forceX)<=(x->seuil * -(x->forceY)))
- vY = 0; // on est a l'interieur du cone de frotement,
- }
-
- if (x->posX_old_1 == x->maxX) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (fabs(x->forceX)<=(x->seuil * (x->forceY)))
- vY = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- x->forceX += x->damp * ((x->posX_old_2)-(x->posX_old_1));
- x->forceY += x->damp * ((x->posY_old_2)-(x->posY_old_1)); // damping
-
- if (x->mass2D != 0)
- {
- posX_new = x->forceX/x->mass2D + 2*x->posX_old_1 - x->posX_old_2;
- posY_new = x->forceY/x->mass2D + 2*x->posY_old_1 - x->posY_old_2;
- }
- else
- {
- posX_new = x->posX_old_1;
- posY_new = x->posY_old_1;
- }
-
- if (vX==0)
- posX_new = x->posX_old_1; // on n'a pas de mv qd on est a l'interieur du cone de frotement
- if (vY==0)
- posY_new = x->posY_old_1;
-
- posX_new = max(min(posX_new, x->maxX), x->minX);
- posY_new = max(min(posY_new, x->maxY), x->minY);
-
- posX_new += x->dX;
- posY_new += x->dY;
-
- x->posX_old_1 += x->dX; // pour eviter l'inertie
- x->posY_old_1 += x->dY;
-
- SETFLOAT(&(x->pos_new[0]), posX_new );
- SETFLOAT(&(x->pos_new[1]), posY_new );
-
- x->posX_old_2 = x->posX_old_1;
- x->posX_old_1 = posX_new;
-
- x->posY_old_2 = x->posY_old_1;
- x->posY_old_1 = posY_new;
-
- SETFLOAT(&(x->force[0]), x->forceX );
- SETFLOAT(&(x->force[1]), x->forceY );
- SETFLOAT(&(x->force[2]), sqrt( (x->forceX * x->forceX) + (x->forceY * x->forceY) ));
-
-// x->forceX=0;
-// x->forceY=0;
-
- x->forceX = random_bang2D(x)*1e-25;
- x->forceY = random_bang2D(x)*1e-25; // avoiding denormal problem by adding low amplitude noise
-
-
- x->dX=0;
- x->dY=0;
-
- x->VX = x->posX_old_1 - x->posX_old_2;
- x->VY = x->posY_old_1 - x->posY_old_2;
-
- SETFLOAT(&(x->vitesse[0]), x->VX );
- SETFLOAT(&(x->vitesse[1]), x->VY );
- SETFLOAT(&(x->vitesse[2]), sqrt( (x->VX * x->VX) + (x->VY * x->VY) ));
-
- outlet_anything(x->vitesse_out, gensym("velocity2D"), 3, x->vitesse);
- outlet_anything(x->force_out, gensym("force2D"), 3, x->force);
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
- }
-}
-
-void mass2D_reset(t_mass2D *x)
-{
- x->posX_old_2 = x->Xinit;
- x->posX_old_1 = x->Xinit;
- x->forceX=0;
-
- x->posY_old_2 = x->Yinit;
- x->posY_old_1 = x->Yinit;
- x->forceY=0;
-
- x->VX = 0;
- x->VY = 0;
-
- x->dX=0;
- x->dY=0;
-
- x->seuil=0;
-
- x->onoff = 1;
-
- SETFLOAT(&(x->pos_new[0]), x->Xinit );
- SETFLOAT(&(x->pos_new[1]), x->Yinit );
-
- SETFLOAT(&(x->force[0]), 0 );
- SETFLOAT(&(x->force[1]), 0 );
- SETFLOAT(&(x->force[2]), 0 );
-
- SETFLOAT(&(x->vitesse[0]), 0 );
- SETFLOAT(&(x->vitesse[1]), 0 );
- SETFLOAT(&(x->vitesse[2]), 0 );
-
- outlet_anything(x->vitesse_out, gensym("velocity2D"), 3, x->vitesse);
- outlet_anything(x->force_out, gensym("force2D"), 3, x->force);
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
-}
-
-void mass2D_resetf(t_mass2D *x)
-{
- x->dX=0;
- x->dY=0;
-
- x->forceX=0;
- x->forceY=0;
-}
-
-void mass2D_setXY(t_mass2D *x, t_float posX, t_float posY)
-{
- x->posX_old_2 = posX;
- x->posX_old_1 = posX;
- x->forceX=0;
-
- x->posY_old_2 = posY;
- x->posY_old_1 = posY;
- x->forceY=0;
-
- SETFLOAT(&(x->pos_new[0]), posX );
- SETFLOAT(&(x->pos_new[1]), posY );
-
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
-}
-
-void mass2D_setX(t_mass2D *x, t_float posX)
-{
- x->posX_old_2 = posX;
- x->posX_old_1 = posX;
- x->forceX=0;
-
- SETFLOAT(&(x->pos_new[0]), posX );
-
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
-}
-
-void mass2D_setY(t_mass2D *x, t_float posY)
-{
- x->posY_old_2 = posY;
- x->posY_old_1 = posY;
- x->forceY=0;
-
- SETFLOAT(&(x->pos_new[1]), posY );
-
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
-}
-
-void mass2D_loadbang(t_mass2D *x)
-{
- outlet_anything(x->position2D_new, gensym("position2D"), 2, x->pos_new);
-}
-
-
-void mass2D_set_mass2D(t_mass2D *x, t_float mass)
-{
- x->mass2D=mass;
-}
-
-void mass2D_inter_ambient(t_mass2D *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (argc == 12)
- // 0 : FX
- // 1 : FY
- // 2 : RndX
- // 3 : RndY
- // 4 : D2
- // 5 : rien
- // 6 : Xmin
- // 7 : Xmax
- // 8 : Ymin
- // 9 : Ymax
- // 10 : dX
- // 11 : dY
- {
- if (x->posX_old_1 > atom_getfloatarg(6, argc, argv))
- {
- if (x->posX_old_1 < atom_getfloatarg(7, argc, argv))
- {
- if (x->posY_old_1 > atom_getfloatarg(8, argc, argv))
- {
- if (x->posY_old_1 < atom_getfloatarg(9, argc, argv))
- {
- x->forceX += atom_getfloatarg(0, argc, argv);
- x->forceY += atom_getfloatarg(1, argc, argv); // constant
-
- x->forceX += random_bang2D(x)*atom_getfloatarg(2, argc, argv);
- x->forceY += random_bang2D(x)*atom_getfloatarg(3, argc, argv); // random
-
- x->forceX += atom_getfloatarg(4, argc, argv) * ((x->posX_old_2)-(x->posX_old_1));
- x->forceY += atom_getfloatarg(4, argc, argv) * ((x->posY_old_2)-(x->posY_old_1)); // damping
-
- x->dX += atom_getfloatarg(10, argc, argv);
- x->dY += atom_getfloatarg(11, argc, argv); // constant
- }
- }
- }
- }
- }
- else
- {
- error("bad ambient interraction message");
- }
-}
-
-void mass2D_inter_seg(t_mass2D *x, t_symbol *s, int argc, t_atom *argv)
-{
-t_float a1, b1, c1, a2, b2, c2, a3, b3, c3, tmp;
-t_float posx1, posx2, posy1, posy2;
-t_float profondeur, prof_max;
-
- if (argc == 12)
- // 0 : posx1
- // 1 : posy1
- // 2 : posx2
- // 3 : posy2
- // 4 : profondeur max
- // 5 : F CT Normal
- // 6 : F CT Tengentiel
- // 7 : K normal
- // 8 : Damp2 normal
- // 9 : Damp2 tan
- // 10 : displacement Normal
- // 11 : d Tan
-
- {
- posx1 = atom_getfloatarg(0, argc, argv);
- posy1 = atom_getfloatarg(1, argc, argv);
- posx2 = atom_getfloatarg(2, argc, argv);
- posy2 = atom_getfloatarg(3, argc, argv);
-
- b1 = posx2 - posx1;
- a1 = -posy2 + posy1;
-
- if (!((a1==0) & (b1==0)))
- {
-
- tmp = sqrt((a1*a1)+(b1*b1)); // = longueur du vecteur pour renormalisation
- if (tmp !=0)
- {
- a1 = a1/tmp;
- b1 = b1/tmp;
- }
- else
- {
- a1 = 0;
- b1 = 0;
- }
-
- c1 = a1*posx1+b1*posy1;
-
- profondeur = ( (a1 * x->posX_old_1) + (b1 * x->posY_old_1) ) - c1;
-
- if ( ( profondeur < 0) & (profondeur > - atom_getfloatarg(4, argc, argv)) )
- {
- a2 = b1;
- b2 = -a1;
- c2 = a2*posx1+b2*posy1;
- if (( (a2 * x->posX_old_1) + (b2 * x->posY_old_1) ) > c2)
- {
- a3 = a2;
- b3 = b2;
- c3 = a3*posx2+b3*posy2;
- if (( (a3 * x->posX_old_1) + (b3 * x->posY_old_1) ) < c3)
- {
- tmp = atom_getfloatarg(5, argc, argv); // force ct normal
- x->forceX += tmp * a1;
- x->forceY += tmp * b1;
-
- tmp = atom_getfloatarg(6, argc, argv); // force ct normal
- x->forceX -= tmp * b1;
- x->forceY -= tmp * -a1;
-
- tmp = atom_getfloatarg(7, argc, argv); // force K normal
- tmp *= profondeur;
- x->forceX -= tmp * a1;
- x->forceY -= tmp * b1;
-
- tmp = atom_getfloatarg(8, argc, argv); // damping2 normal
- tmp *= ( x->VX * a1 + x->VY * b1 );
- x->forceX -= tmp * a1 ;
- x->forceY -= tmp * b1 ;
-
- tmp = atom_getfloatarg(9, argc, argv); // damping2 tangentiel
- tmp *= ( x->VX * b1 - x->VY * a1 );
- x->forceX -= tmp * b1 ;
- x->forceY -= tmp * -a1 ;
-
- tmp = atom_getfloatarg(10, argc, argv); // displacement normal
- x->dX += tmp * a1 ;
- x->dY += tmp * b1 ;
-
- tmp = atom_getfloatarg(11, argc, argv); // displacement tengentiel
- x->dX -= tmp * b1 ;
- x->dY -= tmp * -a1 ;
- }
- }
- }
- }
- }
- else
- {
- error("bad interact_2D_segment message");
- }
-}
-
-void mass2D_inter_line(t_mass2D *x, t_symbol *s, int argc, t_atom *argv)
-{
-t_float a1, b1, c1, tmp;
-t_float posx1, posx2, posy1, posy2;
-t_float profondeur, prof_max;
-
- if (argc == 12)
- // 0 : posx1
- // 1 : posy1
- // 2 : posx2
- // 3 : posy2
- // 4 : profondeur max
- // 5 : F CT Normal
- // 6 : F CT Tengentiel
- // 7 : K normal
- // 8 : Damp2 normal
- // 9 : Damp2 tan
- // 10 : d normal
- // 11 : d tengential
- {
- posx1 = atom_getfloatarg(0, argc, argv);
- posy1 = atom_getfloatarg(1, argc, argv);
- posx2 = atom_getfloatarg(2, argc, argv);
- posy2 = atom_getfloatarg(3, argc, argv);
-
- b1 = posx2 - posx1;
- a1 = -posy2 + posy1;
-
- if (!((a1==0) & (b1==0)))
- {
- tmp = sqrt((a1*a1)+(b1*b1)); // = longueur du vecteur pour renormalisation
- a1 = a1/tmp; // composante X de la normal
- b1 = b1/tmp; // composante Y de la normal
- c1 = a1*posx1+b1*posy1; //
-
- profondeur = ( (a1 * x->posX_old_1) + (b1 * x->posY_old_1) ) - c1;
- if ( ( profondeur < 0) & (profondeur > - atom_getfloatarg(4, argc, argv)) )
- {
- tmp = atom_getfloatarg(5, argc, argv); // force ct normal
- x->forceX += tmp * a1;
- x->forceY += tmp * b1;
-
- tmp = atom_getfloatarg(6, argc, argv); // force ct tengentiel
- x->forceX -= tmp * b1;
- x->forceY -= tmp * -a1;
-
- tmp = atom_getfloatarg(7, argc, argv); // force K normal
- tmp *= profondeur ;
- x->forceX -= tmp * a1;
- x->forceY -= tmp * b1;
-
- tmp = atom_getfloatarg(8, argc, argv); // damping2 normal
- tmp *= ( x->VX * a1 + x->VY * b1 ) ;
- x->forceX -= tmp * a1 ;
- x->forceY -= tmp * b1 ;
-
- tmp = atom_getfloatarg(9, argc, argv); // damping2 tangentiel
- tmp *= ( x->VX * b1 - x->VY * a1 );
- x->forceX -= tmp * b1 ;
- x->forceY -= tmp * -a1 ;
-
- tmp = atom_getfloatarg(10, argc, argv); // d normal
- x->dX += tmp * a1;
- x->dY += tmp * b1;
-
- tmp = atom_getfloatarg(11, argc, argv); // d tangentiel
- x->dX -= tmp * b1;
- x->dY -= tmp * -a1;
- }
- }
- }
- else
- {
- error("bad interact_2D_line message");
- }
-}
-
-void mass2D_inter_circle(t_mass2D *x, t_symbol *s, int argc, t_atom *argv)
-{
-t_float posx1, posy1, Nx, Ny, dx, dy, distance, Dmax, tmp;
-t_float deltaX_old, deltaY_old, distance_old ;
-t_float fnx=0, fny=0;
-t_float ftx=0, fty=0;
-
- if (argc == 20)
- // 0 : Xcentre
- // 1 : Ycendre
- // 2 : Rmin
- // 3 : Rmax
- // 4 : F normal
- // 5 : F tangentiel
- // 6 : K normal
- // 7 : K tengentiel
- // 8 : F normal proportionel a 1/R
- // 9 : F tengentiel proportionel a 1/R
- // 10 : Damp2 normal
- // 11 : Damp2 tan
- // 12 : deplacement N proportionel a 1/R
- // 13 : deplacement tengentiel proportionel a 1/R
- // 14 : position ancienne de l'interacteur en X
- // 15 : position abcienne de l'interacteur en Y
- // 16 : damping de liaison
- // 17 : F normal proportionel a 1/R*R
- // 18 : normal displacement
- // 19 : tengential displacement
-
- {
- posx1 = atom_getfloatarg(0, argc, argv);
- posy1 = atom_getfloatarg(1, argc, argv);
- Nx = (x->posX_old_1)-posx1; // vecteur deplacement X
- Ny = (x->posY_old_1)-posy1; // vecteur deplacement Y
-
- distance = sqrt((Nx * Nx)+(Ny * Ny)); // distance entre le centre de l'interaction, et le pts
-
- Dmax= atom_getfloatarg(3, argc, argv); // distance max de l'interaction
- if ( (distance > atom_getfloatarg(2, argc, argv)) & (distance < Dmax) )
- {
- Nx = Nx/distance; // composante X de la normal (normalisé)
- Ny = Ny/distance; // composante Y de la normal.
-
- tmp = atom_getfloatarg(4, argc, argv); // force constante normal
-// x->forceX += tmp * Nx;
-// x->forceY += tmp * Ny;
- fnx +=tmp;
-// fny +=tmp;
-
- tmp = atom_getfloatarg(5, argc, argv); // force constante tengentiel
-// x->forceX += tmp * Ny;
-// x->forceY += tmp * -Nx;
- ftx +=tmp;
-// fty +=tmp;
-
- tmp = atom_getfloatarg(6, argc, argv); // force variable (K) normal
- tmp *= ( Dmax-distance );
-// x->forceX += tmp * Nx ;
-// x->forceY += tmp * Ny ;
- fnx +=tmp;
-// fny +=tmp;
-
- tmp = atom_getfloatarg(7, argc, argv); // force variable (K) tengentiel
- tmp *= ( Dmax-distance );
-// x->forceX += tmp * Ny ;
-// x->forceY += tmp * -Nx ;
- ftx +=tmp;
-// fty +=tmp;
-
- tmp = atom_getfloatarg(8, argc, argv); // force normal proportionel a 1/r
- if (distance != 0)
- {
- tmp /= distance;
-// x->forceX += tmp * Nx ;
-// x->forceY += tmp * Ny ;
- fnx +=tmp;
-// fny +=tmp;
- }
-
- tmp = atom_getfloatarg(9, argc, argv); // force tengentiel proportionel a 1/r
- if (distance != 0)
- {
- tmp /= distance;
-// x->forceX -= tmp * Ny ;
-// x->forceY -= tmp * -Nx ;
- ftx -=tmp;
-// fty -=tmp;
- }
-
- tmp = atom_getfloatarg(10, argc, argv); // damping2 normal
- tmp *= ( x->VX * Nx + x->VY * Ny );
-// x->forceX -= tmp * Nx ;
-// x->forceY -= tmp * Ny ;
- fnx -=tmp;
-// fny -=tmp;
-
- tmp = atom_getfloatarg(11, argc, argv); // damping2 tangentiel
- tmp *= ( x->VX * Ny - x->VY * Nx );
-// x->forceX -= tmp * Ny ;
-// x->forceY -= tmp * -Ny ;
- ftx -=tmp;
-// fty -=tmp;
-
- tmp = atom_getfloatarg(12, argc, argv); // d normal
- if (distance != 0)
- {
- tmp /= distance;
- x->dX += tmp * Nx ;
- x->dY += tmp * Ny ;
- }
-
- tmp = atom_getfloatarg(13, argc, argv); // d tangentiel
- if (distance != 0)
- {
- tmp /= distance;
-
- x->dX -= tmp * Ny ;
- x->dY -= tmp * -Nx ;
- }
-
- tmp = atom_getfloatarg(16, argc, argv); // damping de liaison
- if (tmp!= 0)
- {
- deltaX_old = atom_getfloatarg(14, argc, argv) - x->posX_old_2;
- deltaY_old = atom_getfloatarg(15, argc, argv) - x->posY_old_2;
- distance_old = sqrt( (deltaX_old * deltaX_old) + (deltaY_old * deltaY_old));
-
-// x->forceX -= Nx * tmp * (distance - distance_old);
-// x->forceY -= Ny * tmp * (distance - distance_old);
-
- tmp *= (distance - distance_old);
- fnx -=tmp;
-// fny -=tmp;
- }
-
- tmp = atom_getfloatarg(17, argc, argv); // force normal proportionel a 1/r2
- if (distance != 0)
- {
- tmp /= (distance*distance);
-// x->forceX -= tmp * Nx;
-// x->forceY -= tmp * Ny;
- fnx +=tmp;
-// fny +=tmp;
- }
-
- tmp = atom_getfloatarg(18, argc, argv); // deplacement constante normal
- x->dX += tmp * Nx;
- x->dY += tmp * Ny;
-
- tmp = atom_getfloatarg(19, argc, argv); // deplacement constante tengentiel
- x->dX -= tmp * Ny;
- x->dY -= tmp * -Nx;
-
- x->forceX += fnx * Nx + ftx * Ny; // optimisation, but does not change anything...
- x->forceY += fnx * Ny - ftx * Nx;
- }
- }
- else
- {
- error("bad interact_2D_circle message");
- }
-}
-
-void *mass2D_new(t_symbol *s, int argc, t_atom *argv)
-{
-
- t_mass2D *x = (t_mass2D *)pd_new(mass2D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
- x->x_state = makeseed2D();
-
- pd_bind(&x->x_obj.ob_pd, atom_getsymbolarg(0, argc, argv));
-
- x->position2D_new=outlet_new(&x->x_obj, 0);
- x->force_out=outlet_new(&x->x_obj, 0);
- x->vitesse_out=outlet_new(&x->x_obj, 0);
-
- x->forceX=0;
- x->forceY=0;
-
- if (argc >= 2)
- x->mass2D = atom_getfloatarg(1, argc, argv) ;
- else
- x->mass2D = 1;
-
- x->onoff = 1;
-
- x->VX = 0;
- x->VY = 0;
-
- x->dX=0;
- x->dY=0;
-
- if (argc >= 3)
- x->Xinit = atom_getfloatarg(2, argc, argv);
- else
- x->Xinit = 0 ;
-
- x->posX_old_1 = x->Xinit ;
- x->posX_old_2 = x->Xinit;
- SETFLOAT(&(x->pos_new[0]), x->Xinit);
-
- if (argc >= 4)
- x->Yinit = atom_getfloatarg(3, argc, argv);
- else
- x->Yinit = 0 ;
-
- x->posY_old_1 = x->Yinit ;
- x->posY_old_2 = x->Yinit;
- SETFLOAT(&(x->pos_new[1]), x->Yinit);
-
- if (argc >= 5)
- x->minX = atom_getfloatarg(4, argc, argv) ;
- else
- x->minX = -100000;
-
- if (argc >= 6)
- x->maxX = atom_getfloatarg(5, argc, argv) ;
- else
- x->maxX = 100000;
-
- if (argc >= 7)
- x->minY = atom_getfloatarg(6, argc, argv) ;
- else
- x->minY = -100000;
-
- if (argc >= 8)
- x->maxY = atom_getfloatarg(7, argc, argv) ;
- else
- x->maxY = 100000;
-
- if (argc >= 9)
- x->seuil = atom_getfloatarg(8, argc, argv) ;
- else
- x->seuil = 0;
-
- if (argc >= 10)
- x->damp = atom_getfloatarg(9, argc, argv) ;
- else
- x->damp = 0;
-
- return (x);
-}
-
-static void mass2D_free(t_mass2D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void mass2D_setup(void)
-{
-
- mass2D_class = class_new(gensym("mass2D"),
- (t_newmethod)mass2D_new,
- (t_method)mass2D_free, sizeof(t_mass2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)mass2D_new, gensym("masse2D"), A_GIMME, 0);
-
- class_addbang(mass2D_class, mass2D_bang);
-
- class_addmethod(mass2D_class, (t_method)mass2D_force, gensym("force2D"),A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_displace, gensym("dXY"),A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_dX, gensym("dX"),A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_dY, gensym("dY"),A_DEFFLOAT, 0);
-
- class_addmethod(mass2D_class, (t_method)mass2D_inter_ambient, gensym("interactor_ambient_2D"), A_GIMME, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_inter_line, gensym("interactor_line_2D"), A_GIMME, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_inter_seg, gensym("interactor_segment_2D"), A_GIMME, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_inter_circle, gensym("interactor_circle_2D"), A_GIMME, 0);
-
- class_addmethod(mass2D_class, (t_method)mass2D_seuil, gensym("setT"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_set_mass2D, gensym("setM"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_minX, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_minY, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_maxX, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_maxY, gensym("setYmax"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_setXY, gensym("setXY"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_damp, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(mass2D_class, (t_method)mass2D_on, gensym("on"), 0);
- class_addmethod(mass2D_class, (t_method)mass2D_off, gensym("off"), 0);
- class_addmethod(mass2D_class, (t_method)mass2D_reset, gensym("reset"), 0);
- class_addmethod(mass2D_class, (t_method)mass2D_resetf, gensym("resetF"), 0);
- class_addmethod(mass2D_class, (t_method)mass2D_loadbang, gensym("loadbang"), 0);
-
-}
diff --git a/src/mass3D.c b/src/mass3D.c
deleted file mode 100644
index e8e362b..0000000
--- a/src/mass3D.c
+++ /dev/null
@@ -1,1095 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) )
-
-static t_class *mass3D_class;
-
-typedef struct _mass3D {
- t_object x_obj;
- t_float posX_old_1, posX_old_2, posY_old_1, posY_old_2, posZ_old_1, posZ_old_2;
- t_float Xinit, Yinit, Zinit, forceX, forceY, forceZ, VX, VY, VZ, dX, dY, dZ;
- t_float mass3D, seuil, onoff, damp;
- t_atom pos_new[3], vitesse[4], force[4];
- t_float minX, maxX, minY, maxY, minZ, maxZ;
- t_outlet *position3D_new, *vitesse_out, *force_out;
- t_symbol *x_sym; // receive
- unsigned int x_state; // random
- t_float x_f; // random
-} t_mass3D;
-
-static int makeseed3D(void)
-{
- static unsigned int random_nextseed = 1489853723;
- random_nextseed = random_nextseed * 435898247 + 938284287;
- return (random_nextseed & 0x7fffffff);
-}
-
-static float random_bang3D(t_mass3D *x)
-{
- int nval;
- int range = 2000000;
- float rnd;
- unsigned int randval = x->x_state;
- x->x_state = randval = randval * 472940017 + 832416023;
- nval = ((double)range) * ((double)randval)
- * (1./4294967296.);
- if (nval >= range) nval = range-1;
-
- rnd=nval;
-
- rnd-=1000000;
- rnd=rnd/1000000.; //pour mettre entre -1 et 1;
- return (rnd);
-}
-
-void mass3D_on(t_mass3D *x)
-{
- x->onoff = 1;
-}
-
-void mass3D_off(t_mass3D *x)
-{
- x->onoff = 0;
-}
-
-void mass3D_minX(t_mass3D *x, t_floatarg f1)
-{
- x->minX = f1;
-}
-
-void mass3D_maxX(t_mass3D *x, t_floatarg f1)
-{
- x->maxX = f1;
-}
-
-void mass3D_minY(t_mass3D *x, t_floatarg f1)
-{
- x->minY = f1;
-}
-
-void mass3D_maxY(t_mass3D *x, t_floatarg f1)
-{
- x->maxY = f1;
-}
-
-void mass3D_minZ(t_mass3D *x, t_floatarg f1)
-{
- x->minZ = f1;
-}
-
-void mass3D_maxZ(t_mass3D *x, t_floatarg f1)
-{
- x->maxZ = f1;
-}
-
-void mass3D_seuil(t_mass3D *x, t_floatarg f1)
-{
- x->seuil = f1;
-}
-
-void mass3D_damp(t_mass3D *x, t_floatarg f1)
-{
- x->damp = f1;
-}
-
-void mass3D_loadbang(t_mass3D *x, t_float posZ)
-{
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-}
-
-void mass3D_setX(t_mass3D *x, t_float posX)
-{
-
- x->posX_old_2 = posX;
- x->posX_old_1 = posX;
- x->forceX=0;
-
- SETFLOAT(&(x->pos_new[0]), posX);
-
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-
-}
-
-void mass3D_setY(t_mass3D *x, t_float posY)
-{
- x->posY_old_2 = posY;
- x->posY_old_1 = posY;
- x->forceY=0;
-
- SETFLOAT(&(x->pos_new[1]), posY);
-
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-
-}
-
-void mass3D_setZ(t_mass3D *x, t_float posZ)
-{
- x->posZ_old_2 = posZ;
- x->posZ_old_1 = posZ;
- x->forceZ=0;
-
- SETFLOAT(&(x->pos_new[2]), posZ);
-
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-
-}
-
-void mass3D_setXYZ(t_mass3D *x, t_float posX, t_float posY, t_float posZ)
-{
-
- x->posX_old_2 = posX;
- x->posX_old_1 = posX;
- x->forceX=0;
-
- x->posY_old_2 = posY;
- x->posY_old_1 = posY;
- x->forceY=0;
-
- x->posZ_old_2 = posZ;
- x->posZ_old_1 = posZ;
- x->forceZ=0;
-
- SETFLOAT(&(x->pos_new[0]), posX);
- SETFLOAT(&(x->pos_new[1]), posY);
- SETFLOAT(&(x->pos_new[2]), posZ);
-
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-}
-
-void mass3D_set_mass3D(t_mass3D *x, t_float mass)
-{
- x->mass3D=mass;
-}
-
-
-void mass3D_force(t_mass3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->forceX += f1;
- x->forceY += f2;
- x->forceZ += f3;
-}
-
-void mass3D_dXYZ(t_mass3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->dX += f1;
- x->dY += f2;
- x->dZ += f3;
-}
-
-void mass3D_dX(t_mass3D *x, t_floatarg f1 )
-{
- x->dX += f1;
-}
-
-void mass3D_dY(t_mass3D *x, t_floatarg f1 )
-{
- x->dY += f1;
-}
-
-void mass3D_dZ(t_mass3D *x, t_floatarg f1 )
-{
- x->dZ += f1;
-}
-
-void mass3D_bang(t_mass3D *x)
-{
- t_float posX_new, posY_new, posZ_new, vX=1, vY=1, vZ=1;
- if (x->onoff != 0)
- {
-
- if (x->seuil > 0)
- {
- if (x->posZ_old_1 == x->minZ) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceX*x->forceX + x->forceY*x->forceY)<=(x->seuil * -(x->forceZ)))
- {
- vX = 0; // on est a l'interieur du cone de frotement,
- vY = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- if (x->posZ_old_1 == x->maxZ) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceX*x->forceX + x->forceY*x->forceY)<=(x->seuil * (x->forceZ)))
- {
- vX = 0; // on est a l'interieur du cone de frotement,
- vY = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- if (x->posY_old_1 == x->minY) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceX*x->forceX + x->forceZ*x->forceZ)<=(x->seuil * -(x->forceY)))
- {
- vX = 0; // on est a l'interieur du cone de frotement,
- vZ = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- if (x->posY_old_1 == x->maxY) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceX*x->forceX + x->forceZ*x->forceZ)<=(x->seuil * (x->forceY)))
- {
- vX = 0; // on est a l'interieur du cone de frotement,
- vZ = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- if (x->posX_old_1 == x->minX) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceY*x->forceY + x->forceZ*x->forceZ)<=(x->seuil * -(x->forceX)))
- {
- vY = 0; // on est a l'interieur du cone de frotement,
- vZ = 0; // on est a l'interieur du cone de frotement,
- }
- }
-
- if (x->posX_old_1 == x->maxX) // si on est en dehors de la structure -> frottement sec sur les bords
- {
- if (sqrt(x->forceY*x->forceY + x->forceZ*x->forceZ)<=(x->seuil * (x->forceX)))
- {
- vY = 0; // on est a l'interieur du cone de frotement,
- vZ = 0; // on est a l'interieur du cone de frotement,
- }
- }
- }
-
- x->forceX += x->damp * ((x->posX_old_2)-(x->posX_old_1));
- x->forceY += x->damp * ((x->posY_old_2)-(x->posY_old_1)); // damping
- x->forceZ += x->damp * ((x->posZ_old_2)-(x->posZ_old_1)); // damping
-
- if (!(x->mass3D == 0))
- {
- posX_new = x->forceX/x->mass3D + 2*x->posX_old_1 - x->posX_old_2;
- posY_new = x->forceY/x->mass3D + 2*x->posY_old_1 - x->posY_old_2;
- posZ_new = x->forceZ/x->mass3D + 2*x->posZ_old_1 - x->posZ_old_2;
- }
- else
- {
- posX_new = x->posX_old_1;
- posY_new = x->posY_old_1;
- posZ_new = x->posY_old_1;
- }
-
-
- if (vX==0)
- posX_new = x->posX_old_1; // on n'a pas de mv qd on est a l'interieur du cone de frotement
- if (vY==0)
- posY_new = x->posY_old_1;
- if (vZ==0)
- posZ_new = x->posZ_old_1;
-
- posX_new = max(min(x->maxX, posX_new), x->minX);
- posY_new = max(min(x->maxY, posY_new), x->minY);
- posZ_new = max(min(x->maxZ, posZ_new), x->minZ);
-
-
- posX_new += x->dX;
- posY_new += x->dY;
- posZ_new += x->dZ;
-
- x->posX_old_1 += x->dX;
- x->posY_old_1 += x->dY;
- x->posZ_old_1 += x->dZ;
-
- SETFLOAT(&(x->pos_new[0]), posX_new );
- SETFLOAT(&(x->pos_new[1]), posY_new );
- SETFLOAT(&(x->pos_new[2]), posZ_new );
-
- x->posX_old_2 = x->posX_old_1;
- x->posX_old_1 = posX_new;
-
- x->posY_old_2 = x->posY_old_1;
- x->posY_old_1 = posY_new;
-
- x->posZ_old_2 = x->posZ_old_1;
- x->posZ_old_1 = posZ_new;
-
- SETFLOAT(&(x->force[0]), x->forceX );
- SETFLOAT(&(x->force[1]), x->forceY );
- SETFLOAT(&(x->force[2]), x->forceZ );
- SETFLOAT(&(x->force[3]), sqrt( (x->forceX * x->forceX) + (x->forceY * x->forceY) + (x->forceZ * x->forceZ) ));
-
-// x->forceX=0;
-// x->forceY=0;
-// x->forceZ=0;
-
- x->forceX = random_bang3D(x)*1e-25;
- x->forceY = random_bang3D(x)*1e-25; // avoiding denormal problem by adding low amplitude noise
- x->forceZ = random_bang3D(x)*1e-25;
-
-
- x->dX=0;
- x->dY=0;
- x->dZ=0;
-
- x->VX = x->posX_old_1 - x->posX_old_2;
- x->VY = x->posY_old_1 - x->posY_old_2;
- x->VZ = x->posZ_old_1 - x->posZ_old_2;
-
- SETFLOAT(&(x->vitesse[0]), x->VX );
- SETFLOAT(&(x->vitesse[1]), x->VY );
- SETFLOAT(&(x->vitesse[2]), x->VZ );
- SETFLOAT(&(x->vitesse[3]), sqrt( (x->VX * x->VX) + (x->VY * x->VY) + (x->VZ * x->VZ) ));
-
- outlet_anything(x->vitesse_out, gensym("velocity3D"), 4, x->vitesse);
- outlet_anything(x->force_out, gensym("force3D"), 4, x->force);
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
- }
-}
-
-void mass3D_reset(t_mass3D *x)
-{
-
- x->posX_old_2 = x->Xinit;
- x->posX_old_1 = x->Xinit;
- x->forceX=0;
-
- x->posY_old_2 = x->Yinit;
- x->posY_old_1 = x->Yinit;
- x->forceY=0;
-
- x->posZ_old_2 = x->Zinit;
- x->posZ_old_1 = x->Zinit;
- x->forceZ=0;
-
- x->VX = 0;
- x->VY = 0;
- x->VZ = 0;
-
- x->dX=0;
- x->dY=0;
- x->dZ=0;
-
- x->seuil=0;
-
- x->onoff = 1;
-
- SETFLOAT(&(x->pos_new[0]), x->Xinit );
- SETFLOAT(&(x->pos_new[1]), x->Yinit );
- SETFLOAT(&(x->pos_new[2]), x->Zinit );
-
- SETFLOAT(&(x->force[0]), 0 );
- SETFLOAT(&(x->force[1]), 0 );
- SETFLOAT(&(x->force[2]), 0 );
- SETFLOAT(&(x->force[3]), 0 );
-
- SETFLOAT(&(x->vitesse[0]), 0 );
- SETFLOAT(&(x->vitesse[1]), 0 );
- SETFLOAT(&(x->vitesse[2]), 0 );
- SETFLOAT(&(x->vitesse[3]), 0 );
-
- outlet_anything(x->vitesse_out, gensym("velocity3D"), 4, x->vitesse);
- outlet_anything(x->force_out, gensym("force3D"), 4, x->force);
- outlet_anything(x->position3D_new, gensym("position3D"), 3, x->pos_new);
-
-}
-
-
-void mass3D_resetf(t_mass3D *x)
-{
- x->forceX=0;
- x->forceY=0;
- x->forceZ=0;
-
- x->dX=0;
- x->dY=0;
- x->dZ=0;
-}
-
-void mass3D_inter_ambient(t_mass3D *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float tmp;
-
- if (argc == 17)
- // 0 : FX
- // 1 : FY
- // 2 : FZ
- // 3 : RndX
- // 4 : RndY
- // 5 : RndZ
- // 6 : D2
- // 7 : rien
- // 8 : Xmin
- // 9 : Xmax
- // 10 : Ymin
- // 11 : Ymax
- // 12 : Zmin
- // 13 : Zmax
- // 14 : dX
- // 15 : dY
- // 16 : dZ
- {
- if (x->posX_old_1 > atom_getfloatarg(8, argc, argv))
- {
- if (x->posX_old_1 < atom_getfloatarg(9, argc, argv))
- {
- if (x->posY_old_1 > atom_getfloatarg(10, argc, argv))
- {
- if (x->posY_old_1 < atom_getfloatarg(11, argc, argv))
- {
- if (x->posZ_old_1 > atom_getfloatarg(12, argc, argv))
- {
- if (x->posZ_old_1 < atom_getfloatarg(13, argc, argv))
- {
- x->forceX += atom_getfloatarg(0, argc, argv);
- x->forceY += atom_getfloatarg(1, argc, argv); // constant
- x->forceZ += atom_getfloatarg(2, argc, argv); // constant
-
- x->forceX += random_bang3D(x)*atom_getfloatarg(3, argc, argv);
- x->forceY += random_bang3D(x)*atom_getfloatarg(4, argc, argv); // random
- x->forceZ += random_bang3D(x)*atom_getfloatarg(5, argc, argv); // random
-
- tmp = atom_getfloatarg(6, argc, argv);
- if (tmp != 0)
- {
- x->forceX += tmp * ((x->posX_old_2)-(x->posX_old_1));
- x->forceY += tmp * ((x->posY_old_2)-(x->posY_old_1)); // damping
- x->forceZ += tmp * ((x->posZ_old_2)-(x->posZ_old_1)); // damping
- }
-
- x->dX += atom_getfloatarg(14, argc, argv);
- x->dY += atom_getfloatarg(15, argc, argv); // constant
- x->dZ += atom_getfloatarg(16, argc, argv); // constant
- }
- }
- }
- }
- }
- }
- }
- else
- {
- error("bad ambient interraction message");
- }
-}
-
-void mass3D_inter_plane(t_mass3D *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float a, b, c, d, profondeur, distance, tmp, profondeur_old;
-
- if (argc == 12)
- // 0 : Xvector
- // 1 : Yvector
- // 2 : Zvector
- // 3 : Xcenter
- // 4 : Ycenter
- // 5 : Zcenter
- // 6 : FNCt
- // 7 : KN
- // 8 : damping de liaison (profondeur)
- // 9 : Profondeur maximum
- // 10 : deplacement normal X
- // 11 : deplacement proportionel a P
-
- {
-
-// ax+by+cz-d=0
-// a = Xvector / |V|
-// b = Yvector ...
-// d est tel que aXcenter +bYcenter + cYcenter = d
-
- a = atom_getfloatarg(0, argc, argv);
- b = atom_getfloatarg(1, argc, argv);
- c = atom_getfloatarg(2, argc, argv);
-
- tmp = sqrt (a*a + b*b + c*c);
- if (tmp != 0)
- {
- a /= tmp;
- b /= tmp;
- c /= tmp;
-
- }
- else
- {
- a=1;
- b=0;
- c=0;
- }
-
- d = a * atom_getfloatarg(3, argc, argv) + b * atom_getfloatarg(4, argc, argv) + c * atom_getfloatarg(5, argc, argv);
-//C a optimiser : envoyer directement les coef directeur et l'offset
-//C a faire pour les autres obj aussi
-
- profondeur = a * x->posX_old_1 + b * x->posY_old_1 + c * x->posZ_old_1 - d;
-
- if ( (profondeur < 0) & (profondeur > -atom_getfloatarg(9, argc, argv)) )
- {
-
- tmp = atom_getfloatarg(6, argc, argv); // force normal constante
-
- x->forceX += tmp * a;
- x->forceY += tmp * b;
- x->forceZ += tmp * c;
-
- tmp = atom_getfloatarg(7, argc, argv); // force normal proportionelle a la profondeur
- tmp *= profondeur;
- x->forceX -= tmp * a;
- x->forceY -= tmp * b;
- x->forceZ -= tmp * c;
-
- tmp = atom_getfloatarg(8, argc, argv); // force normal proportionelle a la profondeur
-
- profondeur_old = a * x->posX_old_2 + b * x->posY_old_2 + c * x->posZ_old_2 - d;
- tmp *= (profondeur - profondeur_old);
- x->forceX -= tmp * a;
- x->forceY -= tmp * b;
- x->forceZ -= tmp * c;
-
-
- tmp = atom_getfloatarg(10, argc, argv); // deplacement normal constant
-
- x->dX += tmp * a;
- x->dY += tmp * b;
- x->dZ += tmp * c;
-
- tmp = atom_getfloatarg(11, argc, argv); // deplacement normal proportionel
- tmp *= profondeur;
-
- x->dX -= tmp * a;
- x->dY -= tmp * b;
- x->dZ -= tmp * c;
- }
-
- }
- else
- {
- error("bad plane interraction message");
- }
-}
-
-
-void mass3D_inter_sphere(t_mass3D *x, t_symbol *s, int argc, t_atom *argv)
-{
-t_float posx1, posy1, posz1, Nx, Ny, Nz, dx, dy, dz, distance, Dmax, tmp;
-t_float deltaX_old, deltaY_old, deltaZ_old, distance_old ;
-
- if (argc == 17)
- // 0 : Xcentre
- // 1 : Ycendre
- // 2 : Zcentre
- // 3 : Rmin
- // 4 : Rmax
- // 5 : F normal
- // 6 : K normal
- // 7 : F normal proportionel a 1/R
- // 8 : Damp de liason normal
- // 9 : deplacement N Ct
- // 10 : position ancienne de l'interacteur en X
- // 11 : position abcienne de l'interacteur en Y
- // 12 : position abcienne de l'interacteur en Z
- // 13 : d dormal proportionel a R
- // 14 : force normal proportionel a 1/R2
- // 15 : d dormal proportionel a 1/R
- // 16 : d dormal proportionel a 1/R*R
-
- {
- posx1 = atom_getfloatarg(0, argc, argv);
- posy1 = atom_getfloatarg(1, argc, argv);
- posz1 = atom_getfloatarg(2, argc, argv);
- Nx = (x->posX_old_1)-posx1; // vecteur deplacement X
- Ny = (x->posY_old_1)-posy1; // vecteur deplacement Y
- Nz = (x->posZ_old_1)-posz1; // vecteur deplacement Y
-
- distance = sqrt((Nx * Nx)+(Ny * Ny)+(Nz * Nz)); // distance entre le centre de l'interaction, et le pts
-
- Nx = Nx/distance; // composante X de la normal (normalisé)
- Ny = Ny/distance; // composante Y de la normal.
- Nz = Nz/distance; // composante Y de la normal.
-
- Dmax= atom_getfloatarg(4, argc, argv); // distance max de l'interaction
- if ( (distance > atom_getfloatarg(3, argc, argv)) & (distance < Dmax) )
- {
- tmp = atom_getfloatarg(5, argc, argv); // force constante normal
- x->forceX += tmp * Nx;
- x->forceY += tmp * Ny;
- x->forceZ += tmp * Nz;
-
- tmp = atom_getfloatarg(6, argc, argv); // force variable (K) normal
- tmp *= ( Dmax-distance );
- x->forceX += tmp * Nx ;
- x->forceY += tmp * Ny ;
- x->forceZ += tmp * Nz ;
-
- tmp = atom_getfloatarg(7, argc, argv); // force normal proportionel a 1/r
- if ( (distance != 0) & (tmp != 0) )
- {
- tmp /= distance;
- x->forceX += tmp * Nx;
- x->forceY += tmp * Ny;
- x->forceZ += tmp * Nz ;
- }
-
- tmp = atom_getfloatarg(8, argc, argv); // damping2 normal
- tmp *= ( x->VX * Nx + x->VY * Ny + x->VZ * Nz );
- x->forceX -= tmp * Nx ;
- x->forceY -= tmp * Ny ;
- x->forceZ -= tmp * Nz ;
-
- tmp = atom_getfloatarg(9, argc, argv); // d normal
- x->dX += tmp * Nx ;
- x->dY += tmp * Ny ;
- x->dZ += tmp * Nz ;
-
- tmp = atom_getfloatarg(13, argc, argv); // force normal proportionel a 1/r2
- if ( (distance != 0) & (tmp != 0) )
- {
- tmp /= (distance * distance);
- x->forceX += tmp * Nx ;
- x->forceY += tmp * Ny ;
- x->forceZ += tmp * Nz ;
- }
-
- tmp = atom_getfloatarg(14, argc, argv); // deplacement variable (K) normal
- tmp *= ( Dmax-distance );
- x->dX += tmp * Nx ;
- x->dY += tmp * Ny ;
- x->dZ += tmp * Nz ;
-
- tmp = atom_getfloatarg(15, argc, argv); // deplacement normal proportionel a 1/r
- if ( (distance != 0) & (tmp != 0) )
- {
- tmp /= distance;
- x->dX += tmp * Nx ;
- x->dY += tmp * Ny ;
- x->dZ += tmp * Nz ;
- }
-
- tmp = atom_getfloatarg(16, argc, argv); // deplacement normal proportionel a 1/r2
- if ( (distance != 0) & (tmp != 0) )
- {
- tmp /= (distance * distance);
- x->dX += tmp * Nx;
- x->dY += tmp * Ny;
- x->dZ += tmp * Nz;
- }
-
- }
- }
- else
- {
- error("bad interact_3D_sphere message");
- }
-}
-
-
-void mass3D_inter_circle(t_mass3D *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float a, b, c, d, profondeur, distance, tmp, profondeur_old, rayon, rayon_old;
-
- if (argc == 14)
- // 0 : Xvector
- // 1 : Yvector
- // 2 : Zvector
- // 3 : Xcenter
- // 4 : Ycenter
- // 5 : Zcenter
- // 6 : Rmin
- // 7 : RMax
- // 8 : FNCt
- // 9 : KN
- // 10 : damping de liaison (profondeur)
- // 11 : Profondeur maximum
- // 12 : dN
- // 13 : dKN
-
- {
-// ax+by+cz-d=0
-// a = Xvector / |V|
-// b = Yvector ...
-// d est tel que aXcenter +bYcenter + cYcenter = d
-
- a = atom_getfloatarg(0, argc, argv);
- b = atom_getfloatarg(1, argc, argv);
- c = atom_getfloatarg(2, argc, argv);
-
- tmp = sqrt (a*a + b*b + c*c);
- if (tmp != 0)
- {
- a /= tmp;
- b /= tmp;
- c /= tmp;
- }
- else
- {
- a=1;
- b=0;
- c=0;
- }
-
- d = a * atom_getfloatarg(3, argc, argv) + b * atom_getfloatarg(4, argc, argv) + c * atom_getfloatarg(5, argc, argv);
-
- profondeur = a * x->posX_old_1 + b * x->posY_old_1 + c * x->posZ_old_1 - d;
-
- rayon = sqrt ( pow(x->posX_old_1-atom_getfloatarg(3, argc, argv), 2) +pow(x->posY_old_1-atom_getfloatarg(4, argc, argv) , 2) + pow(x->posZ_old_1 - atom_getfloatarg(5, argc, argv) , 2) - profondeur*profondeur );
-
- if ( (profondeur < 0) & (profondeur > - atom_getfloatarg(11, argc, argv)) & (rayon > atom_getfloatarg(6, argc, argv)) & (rayon < atom_getfloatarg(7, argc, argv)))
- {
-
- tmp = atom_getfloatarg(8, argc, argv); // force normal constante
-
- x->forceX += tmp * a;
- x->forceY += tmp * b;
- x->forceZ += tmp * c;
-
- tmp = atom_getfloatarg(9, argc, argv); // force normal proportionelle a la profondeur
- tmp *= profondeur;
- x->forceX -= tmp * a;
- x->forceY -= tmp * b;
- x->forceZ -= tmp * c;
-
- tmp = atom_getfloatarg(10, argc, argv); // force normal proportionelle a la profondeur
-
- profondeur_old = a * x->posX_old_2 + b * x->posY_old_2 + c * x->posZ_old_2 - d;
- tmp *= (profondeur - profondeur_old);
-
- x->forceX -= tmp * a;
- x->forceY -= tmp * b;
- x->forceZ -= tmp * c;
-
- tmp = atom_getfloatarg(12, argc, argv); // deplacement normal constante
- x->dX += tmp * a;
- x->dY += tmp * b;
- x->dZ += tmp * c;
-
- tmp = atom_getfloatarg(13, argc, argv); // deplacement normal proportionelle a la profondeur
- tmp *= profondeur;
- x->dX -= tmp * a;
- x->dY -= tmp * b;
- x->dZ -= tmp * c;
- }
- }
- else
- {
- error("bad circle interraction message");
- }
-}
-
-
-void mass3D_inter_cylinder(t_mass3D *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float a, b, c, d, profondeur, profondeur_old, distance, tmp, rayon_old, rayon;
- t_float Xb, Yb, Zb, Ta, Tb, Tc, Xb_old, Yb_old, Zb_old;
-
- if (argc == 21)
- // 0 : Xvector
- // 1 : Yvector
- // 2 : Zvector
- // 3 : Xcenter
- // 4 : Ycenter
- // 5 : Zcenter
- // 6 : Rmin
- // 7 : Rmax
- // 8 : FNCt
- // 9 : KN
- // 10 : damping de liaison (rayon)
- // 11 : FN 1/R
- // 12 : FN 1/R2
- // 13 : Pmin
- // 14 : Pmax
- // 15 : FTct
- // 16 : KT
- // 17 : dNct
- // 18 : dTct
- // 19 : dKN
- // 20 : dKT
-
- {
-
-// ax+by+cz-d=0
-// a = Xvector / |V|
-// b = Yvector ...
-// d est tel que aXcenter +bYcenter + cYcenter = d
-
- a = atom_getfloatarg(0, argc, argv);
- b = atom_getfloatarg(1, argc, argv);
- c = atom_getfloatarg(2, argc, argv);
-
- tmp = sqrt (a*a + b*b + c*c);
- if (tmp != 0)
- {
- a /= tmp;
- b /= tmp;
- c /= tmp;
- }
- else
- {
- a=1;
- b=0;
- c=0;
- }
-
- d = a * atom_getfloatarg(3, argc, argv) + b * atom_getfloatarg(4, argc, argv) + c * atom_getfloatarg(5, argc, argv);
-
- profondeur = a * x->posX_old_1 + b * x->posY_old_1 + c * x->posZ_old_1 - d;
-
- Xb = x->posX_old_1 - atom_getfloatarg(3, argc, argv) - profondeur * a;
- Yb = x->posY_old_1 - atom_getfloatarg(4, argc, argv) - profondeur * b;
- Zb = x->posZ_old_1 - atom_getfloatarg(5, argc, argv) - profondeur * c;
-
- rayon = sqrt ( pow(Xb, 2) + pow(Yb, 2) + pow(Zb, 2) );
-
- if (rayon != 0)
- {
- Xb /= rayon; // normalisation
- Yb /= rayon;
- Zb /= rayon;
- }
- else
- {
- Xb = 0; // normalisation
- Yb = 0;
- Zb = 0;
- }
-
-
- Ta = b*Zb - c*Yb; // vecteur tengentiel = vecteur vectoriel rayon
- Tb = c*Xb - a*Zb;
- Tc = a*Yb - b*Xb;
-
- if ( (profondeur < atom_getfloatarg(14, argc, argv)) & (profondeur > atom_getfloatarg(13, argc, argv)) & (rayon < atom_getfloatarg(7, argc, argv)) & (rayon > atom_getfloatarg(6, argc, argv)) )
- {
-
- tmp = atom_getfloatarg(8, argc, argv); // force normal constante
-
- x->forceX += tmp * Xb;
- x->forceY += tmp * Yb;
- x->forceZ += tmp * Zb;
-
- tmp = atom_getfloatarg(9, argc, argv); // rigidité normal proportionelle
- tmp *= ( atom_getfloatarg(7, argc, argv) - rayon ) ;
- x->forceX += tmp * Xb;
- x->forceY += tmp * Yb;
- x->forceZ += tmp * Zb;
-
- tmp = atom_getfloatarg(10, argc, argv); // damping normal proportionelle a la profondeur
-
- profondeur_old = a * x->posX_old_2 + b * x->posY_old_2 + c * x->posZ_old_2 - d;
-
- Xb_old = x->posX_old_2 - atom_getfloatarg(3, argc, argv) - profondeur_old * a;
- Yb_old = x->posY_old_2 - atom_getfloatarg(4, argc, argv) - profondeur_old * b;
- Zb_old = x->posZ_old_2 - atom_getfloatarg(5, argc, argv) - profondeur_old * c;
-
- rayon_old = sqrt ( pow(Xb_old, 2) + pow(Yb_old, 2) + pow(Zb_old, 2) );
-
- tmp *= (rayon - rayon_old);
-
- x->forceX -= tmp * Xb;
- x->forceY -= tmp * Yb;
- x->forceZ -= tmp * Zb;
-
- tmp = atom_getfloatarg(11, argc, argv); // force normal proportionne a 1/R
- if (rayon != 0)
- {
- tmp /= rayon;
- x->forceX += tmp * Xb;
- x->forceY += tmp * Yb;
- x->forceZ += tmp * Zb;
- }
-
- tmp = atom_getfloatarg(12, argc, argv); // force normal proportionne a 1/R*R
- if (rayon != 0)
- {
- tmp /= (rayon*rayon);
- x->forceX += tmp * Xb;
- x->forceY += tmp * Yb;
- x->forceZ += tmp * Zb;
- }
-
- tmp = atom_getfloatarg(15, argc, argv); // force tengente constante
- x->forceX -= tmp * Ta;
- x->forceY -= tmp * Tb;
- x->forceZ -= tmp * Tc;
-
- tmp = atom_getfloatarg(16, argc, argv); // rigidité tengentiel proportionelle
- tmp *= ( atom_getfloatarg(7, argc, argv) - rayon ) ;
- x->forceX += tmp * Ta;
- x->forceY += tmp * Tb;
- x->forceZ += tmp * Tc;
-
- tmp = atom_getfloatarg(17, argc, argv); // deplacement normal constante
-
- x->dX += tmp * Xb;
- x->dY += tmp * Yb;
- x->dZ += tmp * Zb;
-
- tmp = atom_getfloatarg(19, argc, argv); // deplacement normal proportionelle
- tmp *= ( atom_getfloatarg(7, argc, argv) - rayon ) ;
- x->dX += tmp * Xb;
- x->dY += tmp * Yb;
- x->dZ += tmp * Zb;
-
- tmp = atom_getfloatarg(18, argc, argv); // deplacement tengente constante
- x->dX += tmp * Ta;
- x->dY += tmp * Tb;
- x->dZ += tmp * Tc;
-
- tmp = atom_getfloatarg(20, argc, argv); // deplacement tengentiel proportionelle
- tmp *= ( atom_getfloatarg(7, argc, argv) - rayon ) ;
- x->dX += tmp * Ta;
- x->dY += tmp * Tb;
- x->dZ += tmp * Tc;
- }
- }
- else
- {
- error("bad cylinder interraction message");
- }
-}
-
-void *mass3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mass3D *x = (t_mass3D *)pd_new(mass3D_class);
-
- x->x_sym = atom_getsymbolarg(0, argc, argv);
- x->x_state = makeseed3D();
-
- pd_bind(&x->x_obj.ob_pd, atom_getsymbolarg(0, argc, argv));
-
- x->position3D_new=outlet_new(&x->x_obj, 0);
- x->force_out=outlet_new(&x->x_obj, 0);
- x->vitesse_out=outlet_new(&x->x_obj, 0);
-
- x->forceX=0;
- x->forceY=0;
- x->forceZ=0;
-
- if (argc >= 2)
- x->mass3D = atom_getfloatarg(1, argc, argv) ;
- else
- x->mass3D = 1;
-
- x->onoff = 1;
-
- x->VX = 0;
- x->VY = 0;
- x->VZ = 0;
-
- x->dX=0;
- x->dY=0;
- x->dZ=0;
-
- if (argc >= 3)
- x->Xinit = atom_getfloatarg(2, argc, argv);
- else
- x->Xinit = 0 ;
-
- x->posX_old_1 = x->Xinit ;
- x->posX_old_2 = x->Xinit;
- SETFLOAT(&(x->pos_new[0]), x->Xinit);
-
- if (argc >= 4)
- x->Yinit = atom_getfloatarg(3, argc, argv);
- else
- x->Yinit = 0 ;
-
- x->posY_old_1 = x->Yinit ;
- x->posY_old_2 = x->Yinit;
- SETFLOAT(&(x->pos_new[1]), x->Yinit);
-
- if (argc >= 5)
- x->Zinit = atom_getfloatarg(4, argc, argv);
- else
- x->Zinit = 0 ;
-
- x->posZ_old_1 = x->Zinit ;
- x->posZ_old_2 = x->Zinit;
- SETFLOAT(&(x->pos_new[2]), x->Zinit);
-
-
- if (argc >= 6)
- x->minX = atom_getfloatarg(5, argc, argv) ;
- else
- x->minX = -100000;
-
- if (argc >= 7)
- x->maxX = atom_getfloatarg(6, argc, argv) ;
- else
- x->maxX = 100000;
-
- if (argc >= 8)
- x->minY = atom_getfloatarg(7, argc, argv) ;
- else
- x->minY = -100000;
-
- if (argc >= 9)
- x->maxY = atom_getfloatarg(8, argc, argv) ;
- else
- x->maxY = 100000;
-
- if (argc >= 10)
- x->minZ = atom_getfloatarg(9, argc, argv) ;
- else
- x->minZ = -100000;
-
- if (argc >= 11)
- x->maxZ = atom_getfloatarg(10, argc, argv) ;
- else
- x->maxZ = 100000;
-
- if (argc >= 12)
- x->seuil = atom_getfloatarg(11, argc, argv) ;
- else
- x->seuil = 0;
-
- if (argc >= 13)
- x->damp = atom_getfloatarg(12, argc, argv) ;
- else
- x->damp = 0;
-
- return (void *)x;
-}
-
-static void mass3D_free(t_mass3D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-
-void mass3D_setup(void)
-{
-
- mass3D_class = class_new(gensym("mass3D"),
- (t_newmethod)mass3D_new,
- (t_method)mass3D_free,
- sizeof(t_mass3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)mass3D_new, gensym("masse3D"), A_GIMME, 0);
-
- class_addmethod(mass3D_class, (t_method)mass3D_force, gensym("force3D"),A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(mass3D_class, mass3D_bang);
-
- class_addmethod(mass3D_class, (t_method)mass3D_dX, gensym("dX"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_dY, gensym("dY"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_dZ, gensym("dZ"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_dXYZ, gensym("dXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_minX, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_minY, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_maxX, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_maxY, gensym("setYmax"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_minZ, gensym("setZmin"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_maxZ, gensym("setZmax"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_set_mass3D, gensym("setM"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_reset, gensym("reset"), 0);
- class_addmethod(mass3D_class, (t_method)mass3D_resetf, gensym("resetF"), 0);
- class_addmethod(mass3D_class, (t_method)mass3D_reset, gensym("loadbang"), 0);
- class_addmethod(mass3D_class, (t_method)mass3D_on, gensym("on"), 0);
- class_addmethod(mass3D_class, (t_method)mass3D_off, gensym("off"), 0);
- class_addmethod(mass3D_class, (t_method)mass3D_seuil, gensym("setT"), A_DEFFLOAT, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_damp, gensym("setD"), A_DEFFLOAT, 0);
-
- class_addmethod(mass3D_class, (t_method)mass3D_inter_ambient, gensym("interactor_ambient_3D"), A_GIMME, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_inter_sphere, gensym("interactor_sphere_3D"), A_GIMME, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_inter_plane, gensym("interactor_plane_3D"), A_GIMME, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_inter_circle, gensym("interactor_circle_3D"), A_GIMME, 0);
- class_addmethod(mass3D_class, (t_method)mass3D_inter_cylinder, gensym("interactor_cylinder_3D"), A_GIMME, 0);
-
-}
diff --git a/src/pmpd.c b/src/pmpd.c
deleted file mode 100644
index 78c2f7f..0000000
--- a/src/pmpd.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
--------------------------- pmpd ----------------------------------------
-
-
- pmpd = physical modeling for pure data
- Written by Cyrille Henry (cyrille.henry@la-kitchen.fr)
-
- Get sources at http://drpichon.free.fr/pure-data/physical-modeling/
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Based on PureData by Miller Puckette and others.
-
-
-----------------------------------------------------------------------------
-*/
-
-#ifndef VERSION
-#define VERSION "0.07"
-#endif
-
-#include "m_pd.h"
-#include "stdio.h"
-
-#ifndef __DATE__
-#define __DATE__ ""
-#endif
-
-#define nb_max_link 2000
-#define nb_max_mass 2000
-#define nb_max_out 200
-#define nb_max_in 200
-#define nb_max_outlet 20
-#define nb_max_inlet 20 // hard-coded on the methods definition
-
-#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) )
-
-/*
-#include "masse.c"
-#include "lia.c"
-#include "masse2D.c"
-#include "lia2D.c"
-#include "masse3D.c"
-#include "lia3D.c"
-
-#include "iAmbient2D.c"
-#include "iLine2D.c"
-#include "iSeg2D.c"
-#include "iCircle2D.c"
-
-#include "tSquare2D.c"
-#include "tLine2D.c"
-#include "tSeg2D.c"
-#include "tCircle2D.c"
-#include "tLia2D.c"
-
-#include "iAmbient3D.c"
-#include "iSphere3D.c"
-#include "iPlane3D.c"
-#include "iCircle3D.c"
-#include "iCylinder3D.c"
-
-
-#include "tCube3D.c"
-#include "tSphere3D.c"
-#include "tPlane3D.c"
-#include "tCircle3D.c"
-#include "tCylinder3D.c"
-#include "tLia3D.c"
-
-#include "pmpd~.c"
-*/
-
-static t_class *pmpd_class;
-
-typedef struct _mass {
- t_int Id;
- t_float invM;
- t_float speedX;
- t_float posX;
- t_float forceX;
-} foo;
-
-typedef struct _link {
- t_int Id;
- struct _mass *mass1;
- struct _mass *mass2;
- t_float Ke, K1, D1, K2, D2;
-} foo1 ;
-
-typedef struct _out {
- // TODO ajouter un type pour diferencier les outlets en forces et celles en position
- t_int Id;
- t_int nbr_outlet;
- struct _mass *mass1;
- t_float influence;
-} foo2;
-
-typedef struct _in {
- // TODO ajouter un type pour diferencier les inlets en forces et celles en position
- t_int Id;
- t_int nbr_inlet;
- struct _mass *mass1;
- t_float influence;
-} foo3;
-
-typedef struct _pmpd
-{
- t_object x_obj;
- struct _link link[nb_max_link];
- struct _mass mass[nb_max_mass];
- struct _out out[nb_max_out];
- struct _in in[nb_max_in];
- t_float outlet[nb_max_outlet];
- t_outlet *taboutlet[nb_max_outlet];
- t_float inlet[nb_max_inlet];
- int nb_link, nb_mass, nb_outlet, nb_inlet, nb_in, nb_out;
-} t_pmpd;
-
-void pmpd_bang(t_pmpd *x)
-///////////////////////////////////////////////////////////////////////////////////
-// this part is doing all the job!
-{
- t_float F;
- t_int i;
- struct _mass mass_1, mass_2;
-
- for (i=0; i<x->nb_in; i++)
- // compute input
- {
- x->in[i].mass1->forceX += x->in[i].influence * x->inlet[x->in[i].nbr_inlet];
- }
-
- for (i=0; i<x->nb_inlet; i++)
- // clear inlet[i]
- {
- x->inlet[i]=0;
- }
-
- for (i=0; i<x->nb_link; i++)
- // comput link forces
- {
- F = x->link[i].K1 * ( x->link[i].mass1->posX - x->link[i].mass2->posX ) ;
- F += x->link[i].D1 * ( x->link[i].mass1->speedX - x->link[i].mass2->speedX) ;
- x->link[i].mass1->forceX -= F;
- x->link[i].mass2->forceX += F;
- }
-
- for (i=1; i<x->nb_mass; i++)
- // compute new masses position
- if (x->mass[i].Id >0) // only if Id >0
- {
- x->mass[i].speedX += x->mass[i].forceX * x->mass[i].invM;
- x->mass[i].forceX = 0;
- x->mass[i].posX += x->mass[i].speedX ;
- }
-
- for (i=0; i<x->nb_out; i++)
- // compute output point
- {
- x->outlet[x->out[i].nbr_outlet] += x->out[i].mass1->posX * x->out[i].influence ;
- }
-
-// for (i=0; i<x->nb_outlet; i++)
- for (i=x->nb_outlet-1; i>=0; i--)
- // output everything on the corresponding outlet
- {
- outlet_float(x->taboutlet[i], x->outlet[i]);
- x->outlet[i] = 0;
- }
-}
-
-void pmpd_forceX(t_pmpd *x, t_float nbr_mass, t_float force)
-{
-// add a force to a specific mass
- nbr_mass = max(0, min( x->nb_mass, (int)nbr_mass));
- x->mass[(int)nbr_mass].forceX += force;
-}
-
-void pmpd_posX(t_pmpd *x, t_float nbr_mass, t_float posX)
-{
-// displace a mass to a certain position
- nbr_mass = max(0, min( x->nb_mass, (int)nbr_mass));
- x->mass[(int)nbr_mass].posX = posX;
-}
-
-void pmpd_mass(t_pmpd *x, t_float Id, t_float M, t_float posX)
-// add a mass
-// Id, invM speedX posX forceX
-{
- if (M==0) M=1;
- x->mass[x->nb_mass].Id = (int)Id;
- x->mass[x->nb_mass].invM = 1/M;
- x->mass[x->nb_mass].speedX = 0;
- x->mass[x->nb_mass].posX = posX;
- x->mass[x->nb_mass].forceX = 0;
-
- x->nb_mass++ ;
- x->nb_mass = min ( nb_max_mass -1, x->nb_mass );
-}
-
-void pmpd_link(t_pmpd *x, t_float Id, t_float mass_1, t_float mass_2, t_float K1, t_float D1)
-// add a link
-// Id, *mass1, *mass2, Ke, K1, D1, K2, D2;
-{
-
- x->link[x->nb_link].Id = (int)Id;
- x->link[x->nb_link].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->link[x->nb_link].mass2 = &x->mass[max(0, min ( x->nb_mass, (int)mass_2))];
- x->link[x->nb_link].K1 = K1;
- x->link[x->nb_link].D1 = D1;
-
- x->nb_link++ ;
- x->nb_link = min ( nb_max_link -1, x->nb_link );
-}
-
-void pmpd_out(t_pmpd *x, t_float Id, t_float nb_outlet, t_float mass_1, t_float influence)
-// add an output point
-// Id, nbr_outlet, *mass1, influence;
-{
- x->out[x->nb_out].Id = (int)Id;
- x->out[x->nb_out].nbr_outlet = max(0, min( x->nb_outlet,(int)nb_outlet));
- x->out[x->nb_out].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->out[x->nb_out].influence = influence;
-
- x->nb_out++ ;
- x->nb_out = min ( nb_max_out - 1, x->nb_out );
-}
-
-void pmpd_in(t_pmpd *x, t_float Id, t_float nb_inlet, t_float mass_1, t_float influence)
-//add an input point
-// Id, nbr_inlet, *mass1, influence;
-{
- x->in[x->nb_in].Id = (int)Id;
- x->in[x->nb_in].nbr_inlet = max(0, min( x->nb_inlet,(int)nb_inlet));
- x->in[x->nb_in].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->in[x->nb_in].influence = influence;
-
- x->nb_in++;
- x->nb_in = min ( nb_max_in - 1, x->nb_in );
-}
-
-void pmpd_forceX_1(t_pmpd *x, t_float force)
- { x->inlet[0] += force; }
-void pmpd_forceX_2(t_pmpd *x, t_float force)
- { x->inlet[1] += force; }
-void pmpd_forceX_3(t_pmpd *x, t_float force)
- { x->inlet[2] += force; }
-void pmpd_forceX_4(t_pmpd *x, t_float force)
- { x->inlet[3] += force; }
-void pmpd_forceX_5(t_pmpd *x, t_float force)
- { x->inlet[4] += force; }
-void pmpd_forceX_6(t_pmpd *x, t_float force)
- { x->inlet[5] += force; }
-void pmpd_forceX_7(t_pmpd *x, t_float force)
- { x->inlet[6] += force; }
-void pmpd_forceX_8(t_pmpd *x, t_float force)
- { x->inlet[7] += force; }
-void pmpd_forceX_9(t_pmpd *x, t_float force)
- { x->inlet[8] += force; }
-void pmpd_forceX_10(t_pmpd *x, t_float force)
- { x->inlet[9] += force; }
-void pmpd_forceX_11(t_pmpd *x, t_float force)
- { x->inlet[10]+= force; }
-void pmpd_forceX_12(t_pmpd *x, t_float force)
- { x->inlet[11]+= force; }
-void pmpd_forceX_13(t_pmpd *x, t_float force)
- { x->inlet[12]+= force; }
-void pmpd_forceX_14(t_pmpd *x, t_float force)
- { x->inlet[13]+= force; }
-void pmpd_forceX_15(t_pmpd *x, t_float force)
- { x->inlet[14]+= force; }
-void pmpd_forceX_16(t_pmpd *x, t_float force)
- { x->inlet[15]+= force; }
-void pmpd_forceX_17(t_pmpd *x, t_float force)
- { x->inlet[16]+= force; }
-void pmpd_forceX_18(t_pmpd *x, t_float force)
- { x->inlet[17]+= force; }
-void pmpd_forceX_19(t_pmpd *x, t_float force)
- { x->inlet[18]+= force; }
-void pmpd_forceX_20(t_pmpd *x, t_float force)
- { x->inlet[19]+= force; }
-
-void pmpd_reset(t_pmpd *x)
-{
- x->nb_link = 0;
- x->nb_mass = 1;
- x->nb_out= 0;
- x->nb_in= 0;
-}
-
-void *pmpd_new(t_symbol *s, int argc, t_atom *argv)
-{
- int i;
- char buffer[10];
-
- t_pmpd *x = (t_pmpd *)pd_new(pmpd_class);
-
- pmpd_reset(x);
-
- x->nb_outlet= (int)atom_getfloatarg(1, argc, argv);
- x->nb_outlet= max(0, min(nb_max_outlet, x->nb_outlet) );
- for(i=0; i<x->nb_outlet; i++)
- x->taboutlet[i]=outlet_new(&x->x_obj, 0);
-
- x->nb_inlet = (int)atom_getfloatarg(0, argc, argv);
- x->nb_inlet= max(0, min(nb_max_inlet, x->nb_inlet) );
- for(i=0; i<x->nb_inlet; i++)
- {
- sprintf (buffer, "forceX_%i", i+1);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("forceX"), gensym(buffer));
- }
- return (void *)x;
-}
-
-void pmpd_setup(void)
-{
- pmpd_class = class_new(gensym("pmpd"),
- (t_newmethod)pmpd_new,
- 0, sizeof(t_pmpd),CLASS_DEFAULT, A_GIMME, 0);
-
- class_addbang(pmpd_class, pmpd_bang);
- class_addmethod(pmpd_class, (t_method)pmpd_mass, gensym("mass"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_link, gensym("link"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_out, gensym("out"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_in, gensym("in"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_posX, gensym("posX"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX, gensym("forceX"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_1, gensym("forceX_1"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_2, gensym("forceX_2"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_3, gensym("forceX_3"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_4, gensym("forceX_4"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_5, gensym("forceX_5"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_6, gensym("forceX_6"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_7, gensym("forceX_7"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_8, gensym("forceX_8"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_9, gensym("forceX_9"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_10, gensym("forceX_10"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_11, gensym("forceX_11"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_12, gensym("forceX_12"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_13, gensym("forceX_13"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_14, gensym("forceX_14"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_15, gensym("forceX_15"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_16, gensym("forceX_16"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_17, gensym("forceX_17"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_18, gensym("forceX_18"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_19, gensym("forceX_19"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_forceX_20, gensym("forceX_20"), A_DEFFLOAT, 0);
- class_addmethod(pmpd_class, (t_method)pmpd_reset, gensym("reset"), 0);
-
-/*
- post("");
- post(" pmpd = Physical Modeling for Pure Data");
- post(" version "VERSION);
- post(" compiled "__DATE__);
- post(" Contact : cyrille.henry@la-kitchen.fr");
- post("");
-
-masse_setup() ;
-lia_setup() ;
-masse2D_setup() ;
-lia2D_setup() ;
-masse3D_setup() ;
-lia3D_setup() ;
-
-iAmbient2D_setup();
-iLine2D_setup();
-iSeg2D_setup();
-iCircle2D_setup();
-
-tSquare2D_setup();
-tCircle2D_setup();
-tLine2D_setup();
-tSeg2D_setup();
-tLia2D_setup();
-
-iAmbient3D_setup();
-iSphere3D_setup();
-iPlane3D_setup();
-iCircle3D_setup();
-iCylinder3D_setup();
-
-tLia3D_setup();
-tCube3D_setup();
-tPlane3D_setup();
-tSphere3D_setup();
-tCylinder3D_setup();
-tCircle3D_setup();
-
-pmpd_tilde_setup();
-
-*/
-}
-
diff --git a/src/pmpd~.c b/src/pmpd~.c
deleted file mode 100644
index ce8f02d..0000000
--- a/src/pmpd~.c
+++ /dev/null
@@ -1,417 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-// this is the standard blablabla
-// made for pd
-// Gnu Public Licence
-// cyrille.henry@la-kitchen.fr
-//
-// pmpd~
-// The same than pmpd, but with audio data for input and output
-// It can be used for particular physical modeling and for modal sound synthesis
-//////////////////////////////////////////////////////////////////////
-
-
-#include "m_pd.h"
-#include "stdio.h"
-#include "math.h"
-
-#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) )
-
-#define nb_max_link 10000
-#define nb_max_mass 10000
-#define nb_max_in 1000
-#define nb_max_out 1000
-#define nb_max_outlet 20
-#define nb_max_inlet 20 // hard-coded on the methods definition
-
-static t_class *pmpd_tilde_class;
-
-typedef struct _mass {
- t_float invM;
- t_float speedX;
- t_float posX;
- t_float forceX;
-} foo;
-
-typedef struct _link {
- struct _mass *mass1;
- struct _mass *mass2;
- t_float Ke, K1, D1;
-} foo1 ;
-
-typedef struct _NLlink {
- struct _mass *mass1;
- struct _mass *mass2;
- t_float Ke, K1, D1,L0,Lmin, Lmax, Pow;
-} foo1b ;
-
-typedef struct _inPos {
- // in en position
- t_int nbr_inlet;
- struct _mass *mass1;
- t_float influence;
-} foo2;
-
-typedef struct _inForce {
- // in en force
- t_int nbr_inlet;
- struct _mass *mass1;
- t_float influence;
-} foo3;
-
-typedef struct _outPos {
- // out en position
- t_int nbr_outlet;
- struct _mass *mass1;
- t_float influence;
-} foo4;
-
-typedef struct _outSpeed {
- // out en vitesse
- t_int nbr_outlet;
- struct _mass *mass1;
- t_float influence;
-} foo5;
-
-typedef struct _pmpd_tilde {
- t_object x_obj;
- struct _link link[nb_max_link];
- struct _NLlink NLlink[nb_max_link];
- struct _mass mass[nb_max_mass];
- struct _inPos inPos[nb_max_in];
- struct _inForce inForce[nb_max_in];
- struct _outPos outPos[nb_max_out];
- struct _outSpeed outSpeed[nb_max_out];
- t_float outlet[nb_max_outlet];
- t_sample *outlet_vector[nb_max_outlet];
- t_sample *inlet_vector[nb_max_inlet];
- int nb_link, nb_NLlink, nb_mass, nb_inlet, nb_outlet, nb_inPos, nb_inForce, nb_outPos, nb_outSpeed;
- t_sample f; // used for signal inlet
- t_int loop, nb_loop; // to be able not to compute everything a each iteration
- unsigned int x_state; // random
- t_float x_f; // random
-} t_pmpd_tilde;
-
-static int makeseed_pmpd_tilde(void)
-{
- static unsigned int random_nextseed = 1489853723;
- random_nextseed = random_nextseed * 435898247 + 938284287;
- return (random_nextseed & 0x7fffffff);
-}
-
-static float random_bang_pmpd_tilde(t_pmpd_tilde *x)
-{
- int nval;
- int range = 2000000;
- float rnd;
- unsigned int randval = x->x_state;
- x->x_state = randval = randval * 472940017 + 832416023;
- nval = ((double)range) * ((double)randval)
- * (1./4294967296.);
- if (nval >= range) nval = range-1;
- rnd=nval;
- rnd-=1000000;
- rnd=rnd/1000000.; //pour mettre entre -1 et 1;
- return (rnd);
-}
-
-t_int *pmpd_tilde_perform(t_int *w)
-///////////////////////////////////////////////////////////////////////////////////
-{
- t_pmpd_tilde *x = (t_pmpd_tilde *)(w[1]);
- int n = (int)(w[2]);
-
- t_float F,L;
- t_int i;
- struct _mass mass_1, mass_2;
-
- t_sample *out[nb_max_outlet];
- t_sample *in[nb_max_inlet];
-
- for (i=0; i<x->nb_inlet; i++)
- in[i]= x->inlet_vector[i];
-
- for (i=0; i<x->nb_outlet; i++)
- out[i]= x->outlet_vector[i];
-
- while (n--)
- {
- x->loop = 0;
- while (x->loop++ < x->nb_loop)
- {
- for (i=0; i<x->nb_inPos; i++)
- // get inlet value and make it a position to the specified mass x->inPos[i].mass1->posX = x->inPos[i].influence * *in[x->inPos[i].nbr_inlet];
- for (i=0; i<x->nb_inForce; i++)
- // get inlet value and make it a force to the specified mass
- x->inForce[i].mass1->forceX += x->inForce[i].influence * *in[x->inForce[i].nbr_inlet];
-
- for (i=0; i<x->nb_link; i++)
- // compute forces generated by links (spring / dashpot)
- {
- F = x->link[i].K1 * ( x->link[i].mass1->posX - x->link[i].mass2->posX ) ;
- // spring
-
- F += x->link[i].D1 * ( x->link[i].mass1->speedX - x->link[i].mass2->speedX) ;
- // dashpot
-
- x->link[i].mass1->forceX -= F;
- x->link[i].mass2->forceX += F;
- }
-
- for (i=0; i<x->nb_NLlink; i++)
- // compute forces generated by NLlinks (spring / dashpot)
- {
- L=x->NLlink[i].mass1->posX - x->NLlink[i].mass2->posX - x->NLlink[i].L0;
- if (L<x->NLlink[i].Lmax & L>x->NLlink[i].Lmin)
- {
- F = x->NLlink[i].K1 * pow(fabs(L) ,x->NLlink[i].Pow) ;
- if (L < 0) F *= -1;
- // spring
-
- F += x->NLlink[i].D1 * ( x->NLlink[i].mass1->speedX - x->NLlink[i].mass2->speedX) ;
- // dashpot
-
- x->NLlink[i].mass1->forceX -= F;
- x->NLlink[i].mass2->forceX += F;
- }
- }
- for (i=1; i<x->nb_mass; i++)
- {
- // compute new masses position
- // a mass does not move if M=0 (i.e : invM = 0)
- x->mass[i].speedX += x->mass[i].forceX * x->mass[i].invM;
- x->mass[i].forceX = 0;
- x->mass[i].forceX = random_bang_pmpd_tilde(x) * 1e-25;
- // only used for denormal problem
- // -ffast-math -O6 does not solve the problem
- x->mass[i].posX += x->mass[i].speedX ;
- }
- }
-
- for (i=0; i<x->nb_inlet; i++)
- // increase pointer to inlet vectors value
- in[i]++;
-
- for (i=0; i<x->nb_outPos; i++)
- x->outlet[x->outPos[i].nbr_outlet] += x->outPos[i].mass1->posX * x->outPos[i].influence;
- // compute output vector value
- for (i=0; i<x->nb_outSpeed; i++)
- x->outlet[x->outSpeed[i].nbr_outlet] += x->outSpeed[i].mass1->speedX * x->outSpeed[i].influence;
- // compute output vector value
-
- for (i=0; i<x->nb_outlet; i++)
- // send vector value to the vector pointer
- {
- *out[i]++ = x->outlet[i];
- x->outlet[i] = 0;
- }
- }
- return(w+3);
-}
-
-void pmpd_tilde_dsp(t_pmpd_tilde *x, t_signal **sp)
-{
- int i;
- for (i=0; i<x->nb_inlet; i++)
- x->inlet_vector[i] = sp[i]->s_vec;
-
- for (i=0; i<x->nb_outlet; i++)
- x->outlet_vector[i] = sp[i+x->nb_inlet]->s_vec;
-
- dsp_add(pmpd_tilde_perform, 2, x, sp[0]->s_n);
-}
-
-void pmpd_tilde_bang(t_pmpd_tilde *x)
-{
-// add a unity force to all masses
- int i;
- for (i=0;i < x->nb_mass; i++)
- x->mass[i].forceX += 1;
-}
-
-void pmpd_tilde_float(t_pmpd_tilde *x, t_float force)
-{
-// add a force to all masses
- int i;
- for (i=0;i < x->nb_mass; i++)
- x->mass[i].forceX += force;
-}
-
-void pmpd_tilde_forceX(t_pmpd_tilde *x, t_float nbr_mass, t_float force)
-{
-// add a force to a specific mass
- nbr_mass = max(0, min( x->nb_mass, (int)nbr_mass));
- x->mass[(int)nbr_mass].forceX += force;
-}
-
-void pmpd_tilde_posX(t_pmpd_tilde *x, t_float nbr_mass, t_float posX)
-{
-// move a mass to a certain position
- nbr_mass = max(0, min( x->nb_mass, (int)nbr_mass));
- x->mass[(int)nbr_mass].posX = posX;
-}
-
-
-void pmpd_tilde_mass(t_pmpd_tilde *x, t_float M, t_float posX)
-// add a mass
-//invM speedX posX force
-{
- if (M<=0)
- {
- M = 0;
- x->mass[x->nb_mass].invM = 0;
- }
- else
- x->mass[x->nb_mass].invM = 1/M;
-
- x->mass[x->nb_mass].speedX = 0;
- x->mass[x->nb_mass].posX = posX;
- x->mass[x->nb_mass].forceX = 0;
-
- x->nb_mass++ ;
- if (x->nb_mass == nb_max_mass) error("to many mass");
- x->nb_mass = min ( nb_max_mass -1, x->nb_mass );
-}
-
-void pmpd_tilde_link(t_pmpd_tilde *x, t_float mass_1, t_float mass_2, t_float K1, t_float D1)
-// add a link
-// *mass1, *mass2, K1, D1;
-{
- x->link[x->nb_link].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->link[x->nb_link].mass2 = &x->mass[max(0, min ( x->nb_mass, (int)mass_2))];
- x->link[x->nb_link].K1 = K1;
- x->link[x->nb_link].D1 = D1;
-
- x->nb_link++ ;
- if (x->nb_link == nb_max_link) error("to many link");
- x->nb_link = min ( nb_max_link -1, x->nb_link );
-}
-
-void pmpd_tilde_NLlink(t_pmpd_tilde *x, t_symbol *s, int argc, t_atom *argv)
-// t_float mass_1, t_float mass_2, t_float K1, t_float D1, t_float Pow, t_float Lmin, t_float Lmax, t_float L0
-// add a NLlink
-{
- if (argc == 8)
- {
- x->NLlink[x->nb_NLlink].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)atom_getfloatarg(0, argc, argv)))];
- x->NLlink[x->nb_NLlink].mass2 = &x->mass[max(0, min ( x->nb_mass, (int)atom_getfloatarg(1, argc, argv)))];
- x->NLlink[x->nb_NLlink].K1 = atom_getfloatarg(2, argc, argv);
- x->NLlink[x->nb_NLlink].D1 = atom_getfloatarg(3, argc, argv);
- x->NLlink[x->nb_NLlink].Pow = atom_getfloatarg(4, argc, argv);
- x->NLlink[x->nb_NLlink].L0 = atom_getfloatarg(5, argc, argv);
- x->NLlink[x->nb_NLlink].Lmin = atom_getfloatarg(6, argc, argv);
- x->NLlink[x->nb_NLlink].Lmax = atom_getfloatarg(7, argc, argv);
-
- x->nb_NLlink++ ;
- if (x->nb_NLlink == nb_max_link) error("to many NLlink");
- x->nb_NLlink = min ( nb_max_link -1, x->nb_NLlink );
- }
- else
- error("wrong argument number for NLlink");
-}
-
-void pmpd_tilde_inPos(t_pmpd_tilde *x, t_float nb_inlet, t_float mass_1, t_float influence)
-//add an input point
-// nbr_inlet, *mass1, influence;
-{
- x->inPos[x->nb_inPos].nbr_inlet = max(0, min( x->nb_inlet,(int)nb_inlet));
- x->inPos[x->nb_inPos].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->inPos[x->nb_inPos].influence = influence;
-
- x->nb_inPos++;
- if (x->nb_inPos == nb_max_in) error("to many inPos");
- x->nb_inPos = min ( nb_max_in - 1, x->nb_inPos );
-}
-void pmpd_tilde_inForce(t_pmpd_tilde *x, t_float nb_inlet, t_float mass_1, t_float influence)
-//add an input point
-// nbr_inlet, *mass1, influence;
-{
- x->inForce[x->nb_inForce].nbr_inlet = max(0, min( x->nb_inlet,(int)nb_inlet));
- x->inForce[x->nb_inForce].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->inForce[x->nb_inForce].influence = influence;
-
- x->nb_inForce++;
- if (x->nb_inForce == nb_max_in) error("to many inForce");
- x->nb_inForce = min ( nb_max_in - 1, x->nb_inForce );
-}
-
-void pmpd_tilde_outPos(t_pmpd_tilde *x, t_float nb_outlet, t_float mass_1, t_float influence)
-// add an output point
-// nbr_outlet, *mass1, influence;
-{
- x->outPos[x->nb_outPos].nbr_outlet = max(0, min( x->nb_outlet,(int)nb_outlet));
- x->outPos[x->nb_outPos].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->outPos[x->nb_outPos].influence = influence;
-
- x->nb_outPos++ ;
- if (x->nb_outPos == nb_max_out) error("to many outPos");
- x->nb_outPos = min ( nb_max_out - 1, x->nb_outPos );
-}
-
-void pmpd_tilde_outSpeed(t_pmpd_tilde *x, t_float nb_outlet, t_float mass_1, t_float influence)
-// add an output point
-// nbr_outlet, *mass1, influence;
-{
- x->outSpeed[x->nb_outSpeed].nbr_outlet = max(0, min( x->nb_outlet,(int)nb_outlet));
- x->outSpeed[x->nb_outSpeed].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
- x->outSpeed[x->nb_outSpeed].influence = influence;
-
- x->nb_outSpeed++ ;
- if (x->nb_outSpeed == nb_max_out) error("to many outSpeed");
- x->nb_outSpeed = min ( nb_max_out - 1, x->nb_outSpeed );
-}
-
-void pmpd_tilde_reset(t_pmpd_tilde *x)
-{
- x->nb_link = 0;
- x->nb_NLlink = 0;
- x->nb_mass = 0;
- x->nb_inPos= 0;
- x->nb_inForce= 0;
- x->nb_outSpeed= 0;
- x->nb_outPos= 0;
-}
-
-void *pmpd_tilde_new(t_symbol *s, int argc, t_atom *argv)
-{
- int i;
-
- t_pmpd_tilde *x = (t_pmpd_tilde *)pd_new(pmpd_tilde_class);
-
- pmpd_tilde_reset(x);
- makeseed_pmpd_tilde();
-
- x->nb_outlet= (int)atom_getfloatarg(1, argc, argv);
- x->nb_outlet= max(1, min(nb_max_outlet, x->nb_outlet) );
- for(i=0; i<x->nb_outlet; i++)
- outlet_new(&x->x_obj, &s_signal);
-
- x->nb_inlet = (int)atom_getfloatarg(0, argc, argv);
- x->nb_inlet= max(1, min(nb_max_inlet, x->nb_inlet) );
- for(i=0; i<x->nb_inlet-1; i++)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
-
- x->nb_loop = max (1, (int)atom_getfloatarg(2, argc, argv) );
-
- return (void *)x;
-}
-
-void pmpd_tilde_setup(void) {
- pmpd_tilde_class = class_new(gensym("pmpd~"), (t_newmethod)pmpd_tilde_new, 0, sizeof(t_pmpd_tilde), CLASS_DEFAULT, A_GIMME, 0);
-
- CLASS_MAINSIGNALIN(pmpd_tilde_class, t_pmpd_tilde, f);
-
- class_addbang(pmpd_tilde_class, pmpd_tilde_bang);
- class_addfloat(pmpd_tilde_class, (t_method)pmpd_tilde_float);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_mass, gensym("mass"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_link, gensym("link"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_NLlink, gensym("NLlink"), A_GIMME, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inPos, gensym("inPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inForce, gensym("inForce"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outPos, gensym("outPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outSpeed, gensym("outSpeed"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_posX, gensym("posX"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_forceX, gensym("forceX"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_reset, gensym("reset"), 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_dsp, gensym("dsp"), 0);
-}
diff --git a/src/tCircle2D.c b/src/tCircle2D.c
deleted file mode 100644
index e4ba448..0000000
--- a/src/tCircle2D.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tCircle2D_class;
-
-typedef struct _tCircle2D {
- t_object x_obj;
- t_float X, Y, Rmin, Rmax, distance_old;
- t_outlet *force_new, *distance, *vitesse; // outlet
-} t_tCircle2D;
-
-
-void tCircle2D_position2D(t_tCircle2D *x, t_float X, t_float Y)
-{
-
- t_float tmp, vitesse;
-
- tmp = sqrt((X-x->X)*(X-x->X) + (Y-x->Y)*(Y-x->Y));
-
- vitesse = tmp - x->distance_old ;
-
- x->distance_old = tmp;
-
- outlet_float(x->vitesse, vitesse);
-
- outlet_float(x->distance, tmp);
-
- if ( (tmp < x->Rmax) & (tmp >= x->Rmin))
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-}
-
-void tCircle2D_XY(t_tCircle2D *x, t_float X, t_float Y)
-{
- x->X= X;
- x->Y= Y;
-}
-
-void tCircle2D_X(t_tCircle2D *x, t_float X)
-{
- x->X= X;
-}
-
-void tCircle2D_Y(t_tCircle2D *x, t_float X)
-{
- x->Y= X;
-}
-
-void tCircle2D_Rmin(t_tCircle2D *x, t_float X)
-{
- x->Rmin= X;
-}
-
-void tCircle2D_Rmax(t_tCircle2D *x, t_float X)
-{
- x->Rmax= X;
-}
-
-void *tCircle2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tCircle2D *x = (t_tCircle2D *)pd_new(tCircle2D_class);
- x->force_new=outlet_new(&x->x_obj, 0);
- x->distance=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->distance_old = 0;
-
- if (argc>=4)
- x->Rmax = atom_getfloatarg(3, argc, argv);
- else
- x->Rmax = 1;
-
- if (argc>=3)
- x->Rmin = atom_getfloatarg(2, argc, argv);
- else
- x->Rmin = 0;
-
- if (argc>=2)
- x->Y = atom_getfloatarg(1, argc, argv);
- else
- x->Y = 0;
-
- if (argc>=1)
- x->X = atom_getfloatarg(0, argc, argv);
- else
- x->X = 0;
-
- return (x);
-}
-
-void tCircle2D_setup(void)
-{
-
- tCircle2D_class = class_new(gensym("tCircle2D"),
- (t_newmethod)tCircle2D_new,
- 0, sizeof(t_tCircle2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tCircle2D_new, gensym("pmpd.tCircle2D"), A_GIMME, 0);
-
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_XY, gensym("setXY"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_X, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_Y, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_Rmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(tCircle2D_class, (t_method)tCircle2D_Rmax, gensym("setRmax"), A_DEFFLOAT, 0);
-}
diff --git a/src/tCircle3D.c b/src/tCircle3D.c
deleted file mode 100644
index 6664d39..0000000
--- a/src/tCircle3D.c
+++ /dev/null
@@ -1,195 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tCircle3D_class;
-
-typedef struct _tCircle3D {
- t_object x_obj;
- t_float X, Y, Z, VX, VY, VZ, P, Rmin, Rmax, distance_old;
- t_outlet *force_new, *distance, *vitesse;// outlet
-} t_tCircle3D;
-
-void tCircle3D_position3D(t_tCircle3D *x, t_float X, t_float Y, t_float Z)
-{
-t_float d, tmp, profondeur, vitesse;
-
-
-
- tmp = sqrt (x->VX*x->VX + x->VY*x->VY + x->VZ*x->VZ);
- if (tmp != 0)
- {
- x->VX /= tmp;
- x->VY /= tmp;
- x->VZ /= tmp;
- }
- else
- {
- x->VX=1;
- x->VY=0;
- x->VZ=0;
- }
-
- d = x->VX * x->X + x->VY * x->Y + x->VZ * x->Z;
-
- profondeur = x->VX * X + x->VY * Y + x->VZ * Z - d;
-
- vitesse = profondeur - x->distance_old;
- x->distance_old = profondeur;
-
- outlet_float(x->vitesse, vitesse);
-
- outlet_float(x->distance, profondeur);
-
- if ( (profondeur < 0) & (profondeur > - x->P) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-
-}
-
-void tCircle3D_setXYZ(t_tCircle3D *x, t_float X, t_float Y, t_float Z)
-{
- x->X= X;
- x->Y= Y;
- x->Z= Z;
-}
-void tCircle3D_setVXYZ(t_tCircle3D *x, t_float X, t_float Y, t_float Z)
-{
- x->VX= X;
- x->VY= Y;
- x->VZ= Z;
-}
-
-void tCircle3D_setVX(t_tCircle3D *x, t_float X)
-{
- x->VX= X;
-}
-
-void tCircle3D_setVY(t_tCircle3D *x, t_float Y)
-{
- x->VY= Y;
-}
-
-void tCircle3D_setVZ(t_tCircle3D *x, t_float Z)
-{
- x->VZ= Z;
-}
-void tCircle3D_setX(t_tCircle3D *x, t_float X)
-{
- x->X= X;
-}
-
-void tCircle3D_setY(t_tCircle3D *x, t_float Y)
-{
- x->Y= Y;
-}
-
-void tCircle3D_setZ(t_tCircle3D *x, t_float Z)
-{
- x->Z= Z;
-}
-
-void tCircle3D_setP(t_tCircle3D *x, t_float X)
-{
- x->P= X;
-}
-
-void tCircle3D_setRmin(t_tCircle3D *x, t_float R)
-{
- x->Rmin = R;
-}
-
-void tCircle3D_setRmax(t_tCircle3D *x, t_float R)
-{
- x->Rmax = R;
-}
-
-
-void *tCircle3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tCircle3D *x = (t_tCircle3D *)pd_new(tCircle3D_class);
-
- x->force_new=outlet_new(&x->x_obj, 0);
- x->distance=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->distance_old = 0;
-
- if (argc>=9)
- x->P= atom_getfloatarg(8, argc, argv);
- else
- x->P= 10000;
-
- if (argc>=8)
- x->Z= atom_getfloatarg(7, argc, argv);
- else
- x->Rmax= 1;
-
- if (argc>=7)
- x->P= atom_getfloatarg(6, argc, argv);
- else
- x->Rmin= 0;
-
- if (argc>=6)
- x->Z= atom_getfloatarg(5, argc, argv);
- else
- x->Z= 0;
-
- if (argc>=5)
- x->Y= atom_getfloatarg(4, argc, argv);
- else
- x->Y= 0;
-
- if (argc>=4)
- x->X= atom_getfloatarg(3, argc, argv);
- else
- x->X= 0;
-
- if (argc>=3)
- x->VZ= atom_getfloatarg(2, argc, argv);
- else
- x->VZ= 0;
-
- if (argc>=2)
- x->VY= atom_getfloatarg(1, argc, argv);
- else
- x->VY= 0;
-
- if (argc>=1)
- x->VX= atom_getfloatarg(0, argc, argv);
- else
- x->VX= 1;
-
- return (x);
-}
-
-void tCircle3D_setup(void)
-{
-
- tCircle3D_class = class_new(gensym("tCircle3D"),
- (t_newmethod)tCircle3D_new,
- 0, sizeof(t_tCircle3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tCircle3D_new, gensym("pmpd.tCircle3D"), A_GIMME, 0);
-
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tCircle3D_class, (t_method)tCircle3D_setP, gensym("setPmax"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/tCube3D.c b/src/tCube3D.c
deleted file mode 100644
index ce0c434..0000000
--- a/src/tCube3D.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tCube3D_class;
-
-typedef struct _tCube3D {
- t_object x_obj;
- t_float Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
- //extrem = Xmin, Ymin, Xmax, Ymax;
- t_outlet *force_new;// outlet
-} t_tCube3D;
-
-void tCube3D_position3D(t_tCube3D *x, t_float X, t_float Y, t_float Z)
-{
-
- if ((X > x->Xmin) & (X < x->Xmax) & (Y > x->Ymin) & (Y < x->Ymax) & (Z > x->Zmin) & (Z < x->Zmax) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-}
-
-void tCube3D_Xmin(t_tCube3D *x, t_float X)
-{
- x->Xmin= X;
-}
-
-void tCube3D_Xmax(t_tCube3D *x, t_float X)
-{
- x->Xmax= X;
-}
-
-void tCube3D_Ymin(t_tCube3D *x, t_float X)
-{
- x->Ymin= X;
-}
-
-void tCube3D_Ymax(t_tCube3D *x, t_float X)
-{
- x->Ymax= X;
-}
-
-void tCube3D_Zmin(t_tCube3D *x, t_float X)
-{
- x->Zmin= X;
-}
-
-void tCube3D_Zmax(t_tCube3D *x, t_float X)
-{
- x->Zmax= X;
-}
-
-void *tCube3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tCube3D *x = (t_tCube3D *)pd_new(tCube3D_class);
- x->force_new=outlet_new(&x->x_obj, 0);
-
- if (argc>=6)
- x->Zmax = atom_getfloatarg(5, argc, argv);
- else
- x->Zmax = 1;
-
- if (argc>=5)
- x->Zmin = atom_getfloatarg(4, argc, argv);
- else
- x->Zmin = -1;
-
- if (argc>=4)
- x->Ymax = atom_getfloatarg(3, argc, argv);
- else
- x->Ymax = 1;
-
- if (argc>=3)
- x->Ymin = atom_getfloatarg(2, argc, argv);
- else
- x->Ymin = -1;
-
- if (argc>=2)
- x->Xmax = atom_getfloatarg(1, argc, argv);
- else
- x->Xmax = 1;
-
- if (argc>=1)
- x->Xmin = atom_getfloatarg(0, argc, argv);
- else
- x->Xmin = -1;
-
- return (x);
-}
-
-void tCube3D_setup(void)
-{
-
- tCube3D_class = class_new(gensym("tCube3D"),
- (t_newmethod)tCube3D_new,
- 0, sizeof(t_tCube3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tCube3D_new, gensym("pmpd.tCube3D"), A_GIMME, 0);
-
- class_addmethod(tCube3D_class, (t_method)tCube3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tCube3D_class, (t_method)tCube3D_Xmin, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(tCube3D_class, (t_method)tCube3D_Ymin, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(tCube3D_class, (t_method)tCube3D_Ymin, gensym("setZmin"), A_DEFFLOAT, 0);
- class_addmethod(tCube3D_class, (t_method)tCube3D_Xmax, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(tCube3D_class, (t_method)tCube3D_Ymax, gensym("setYmax"), A_DEFFLOAT, 0);
- class_addmethod(tCube3D_class, (t_method)tCube3D_Ymax, gensym("setZmax"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/tCylinder3D.c b/src/tCylinder3D.c
deleted file mode 100644
index 1ccf832..0000000
--- a/src/tCylinder3D.c
+++ /dev/null
@@ -1,218 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tCylinder3D_class;
-
-typedef struct _tCylinder3D {
- t_object x_obj;
- t_float X, Y, Z, VX, VY, VZ, Pmin, Pmax, Rmin, Rmax, position_old;
- t_outlet *force_new, *profondeur, *vitesse;// outlet
-} t_tCylinder3D;
-
-void tCylinder3D_position3D(t_tCylinder3D *x, t_float X, t_float Y, t_float Z)
-{
- t_float d, tmp, profondeur, Xb, Yb, Zb, rayon, vitesse;
-
- tmp = sqrt (x->VX*x->VX + x->VY*x->VY + x->VZ*x->VZ);
- if (tmp != 0)
- {
- x->VX /= tmp;
- x->VY /= tmp;
- x->VZ /= tmp;
- }
- else
- {
- x->VX=1;
- x->VY=0;
- x->VZ=0;
- }
-
- d = x->VX * x->X + x->VY * x->Y + x->VZ * x->Z;
-
- profondeur = x->VX * X + x->VY * Y + x->VZ * Z - d;
-
- Xb = X - x->X - profondeur * x->VX;
- Yb = Y - x->Y - profondeur * x->VY;
- Zb = Z - x->Z - profondeur * x->VZ;
-
- rayon = sqrt ( pow(Xb, 2) + pow(Yb, 2) + pow(Zb, 2) );
-
- if ( rayon != 0 )
- {
- Xb /= rayon; // normalisation
- Yb /= rayon;
- Zb /= rayon;
- }
-
- vitesse = rayon - x->position_old;
- x->position_old = rayon;
-
- outlet_float(x->vitesse, vitesse);
-
- outlet_float(x->profondeur, rayon);
-
- if ( (profondeur < x->Pmin) & (profondeur > x->Pmax) & (rayon < x->Rmax) & (rayon > x->Rmin) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-//C optimiser ca : pas faire le calcul de l'orientation du cylindre a chaques fois...
-
-}
-
-void tCylinder3D_setXYZ(t_tCylinder3D *x, t_float X, t_float Y, t_float Z)
-{
- x->X= X;
- x->Y= Y;
- x->Z= Z;
-}
-void tCylinder3D_setVXYZ(t_tCylinder3D *x, t_float X, t_float Y, t_float Z)
-{
- x->VX= X;
- x->VY= Y;
- x->VZ= Z;
-}
-
-void tCylinder3D_setVX(t_tCylinder3D *x, t_float X)
-{
- x->VX= X;
-}
-
-void tCylinder3D_setVY(t_tCylinder3D *x, t_float Y)
-{
- x->VY= Y;
-}
-
-void tCylinder3D_setVZ(t_tCylinder3D *x, t_float Z)
-{
- x->VZ= Z;
-}
-void tCylinder3D_setX(t_tCylinder3D *x, t_float X)
-{
- x->X= X;
-}
-
-void tCylinder3D_setY(t_tCylinder3D *x, t_float Y)
-{
- x->Y= Y;
-}
-
-void tCylinder3D_setZ(t_tCylinder3D *x, t_float Z)
-{
- x->Z= Z;
-}
-
-void tCylinder3D_setPmin(t_tCylinder3D *x, t_float X)
-{
- x->Pmin= X;
-}
-
-void tCylinder3D_setPmax(t_tCylinder3D *x, t_float X)
-{
- x->Pmax= X;
-}
-
-void tCylinder3D_setRmin(t_tCylinder3D *x, t_float R)
-{
- x->Rmin = R;
-}
-
-void tCylinder3D_setRmax(t_tCylinder3D *x, t_float R)
-{
- x->Rmax = R;
-}
-
-
-void *tCylinder3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tCylinder3D *x = (t_tCylinder3D *)pd_new(tCylinder3D_class);
-
- x->force_new=outlet_new(&x->x_obj, 0);
- x->profondeur=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->position_old = 0;
-
- if (argc>=10)
- x->Pmax= atom_getfloatarg(9, argc, argv);
- else
- x->Pmax= 1000;
-
- if (argc>=9)
- x->Pmin= atom_getfloatarg(8, argc, argv);
- else
- x->Pmin= -1000;
-
- if (argc>=8)
- x->Z= atom_getfloatarg(7, argc, argv);
- else
- x->Rmax= 1;
-
- if (argc>=7)
- x->Rmin= atom_getfloatarg(6, argc, argv);
- else
- x->Rmin= 0;
-
- if (argc>=6)
- x->Z= atom_getfloatarg(5, argc, argv);
- else
- x->Z= 0;
-
- if (argc>=5)
- x->Y= atom_getfloatarg(4, argc, argv);
- else
- x->Y= 0;
-
- if (argc>=4)
- x->X= atom_getfloatarg(3, argc, argv);
- else
- x->X= 0;
-
- if (argc>=3)
- x->VZ= atom_getfloatarg(2, argc, argv);
- else
- x->VZ= 0;
-
- if (argc>=2)
- x->VY= atom_getfloatarg(1, argc, argv);
- else
- x->VY= 0;
-
- if (argc>=1)
- x->VX= atom_getfloatarg(0, argc, argv);
- else
- x->VX= 1;
-
- return (x);
-}
-
-void tCylinder3D_setup(void)
-{
-
- tCylinder3D_class = class_new(gensym("tCylinder3D"),
- (t_newmethod)tCylinder3D_new,
- 0, sizeof(t_tCylinder3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tCylinder3D_new, gensym("pmpd.tCylinder3D"), A_GIMME, 0);
-
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setPmin, gensym("setPmin"), A_DEFFLOAT, 0);
- class_addmethod(tCylinder3D_class, (t_method)tCylinder3D_setPmax, gensym("setPmax"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/tLine2D.c b/src/tLine2D.c
deleted file mode 100644
index f440bfd..0000000
--- a/src/tLine2D.c
+++ /dev/null
@@ -1,137 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tLine2D_class;
-
-typedef struct _tLine2D {
- t_object x_obj;
- t_float X1, X2, Y1, Y2, P, P_old;
- //extrem = Xmin, Ymin, Xmax, Ymax;
- t_outlet *force_new;// outlet
- t_outlet *profondeur;// outlet
- t_outlet *vitesse;// outlet
-} t_tLine2D;
-
-void tLine2D_position2D(t_tLine2D *x, t_float X, t_float Y)
-{
- t_float a1, b1, c1, profondeur, tmp;
-
- b1 = x->X2 - x->X1;
- a1 = -x->Y2 + x->Y1;
-
- if (!((a1==0) & (b1==0)))
- {
- tmp = sqrt((a1*a1)+(b1*b1)); // = longueur du vecteur pour renormalisation
- a1 = a1/tmp;
- b1 = b1/tmp;
- c1 = a1*x->X1+b1*x->Y1;
-
- profondeur = ( (a1 * X) + (b1 * Y) ) - c1;
-
- tmp = profondeur - x->P_old;
-
- x->P_old = profondeur;
-
- outlet_float(x->vitesse, tmp);
-
- outlet_float(x->profondeur, profondeur);
-
- if ( ( profondeur < 0) & (profondeur > - x->P) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-
-}
-
-void tLine2D_Xmin(t_tLine2D *x, t_float X)
-{
- x->X1= X;
-}
-
-void tLine2D_Xmax(t_tLine2D *x, t_float X)
-{
- x->X2= X;
-}
-
-void tLine2D_Ymin(t_tLine2D *x, t_float X)
-{
- x->Y1= X;
-}
-
-void tLine2D_Ymax(t_tLine2D *x, t_float X)
-{
- x->Y2= X;
-}
-
-void tLine2D_P(t_tLine2D *x, t_float X)
-{
- x->P= X;
-}
-
-void *tLine2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tLine2D *x = (t_tLine2D *)pd_new(tLine2D_class);
-
- x->force_new=outlet_new(&x->x_obj, 0);
- x->profondeur=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->P_old=0;
-
- if (argc>=5)
- x->P = atom_getfloatarg(4, argc, argv);
- else
- x->P = 1;
-
- if (argc>=4)
- x->Y2 = atom_getfloatarg(3, argc, argv);
- else
- x->Y2 = 0;
-
- if (argc>=3)
- x->X2 = atom_getfloatarg(2, argc, argv);
- else
- x->X2 = 1;
-
- if (argc>=2)
- x->Y1 = atom_getfloatarg(1, argc, argv);
- else
- x->Y1 = 0;
-
-
- if (argc>=1)
- x->X1 = atom_getfloatarg(0, argc, argv);
- else
- x->X1 = -1;
-
- return (x);
-}
-
-void tLine2D_setup(void)
-{
-
- tLine2D_class = class_new(gensym("tLine2D"),
- (t_newmethod)tLine2D_new,
- 0, sizeof(t_tLine2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tLine2D_new, gensym("pmpd.tLine2D"), A_GIMME, 0);
-
- class_addmethod(tLine2D_class, (t_method)tLine2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tLine2D_class, (t_method)tLine2D_Xmin, gensym("setX1"), A_DEFFLOAT, 0);
- class_addmethod(tLine2D_class, (t_method)tLine2D_Ymin, gensym("setY1"), A_DEFFLOAT, 0);
- class_addmethod(tLine2D_class, (t_method)tLine2D_Xmax, gensym("setX2"), A_DEFFLOAT, 0);
- class_addmethod(tLine2D_class, (t_method)tLine2D_Ymax, gensym("setY2"), A_DEFFLOAT, 0);
- class_addmethod(tLine2D_class, (t_method)tLine2D_P, gensym("setPmax"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/tLink2D.c b/src/tLink2D.c
deleted file mode 100644
index c1e27ed..0000000
--- a/src/tLink2D.c
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tLink2D_class;
-
-typedef struct _tLink2D {
- t_object x_obj;
- t_float distance_old, position2Dx1, position2Dy1, position2Dx2, position2Dy2;
- t_outlet *force1;
- t_outlet *force2;
- t_outlet *force3;
- t_outlet *force4;
- t_symbol *x_sym; // receive
-} t_tLink2D;
-
-void tLink2D_reset(t_tLink2D *x)
-{
-}
-
-void tLink2D_resetF(t_tLink2D *x)
-{
-}
-
-void tLink2D_resetL(t_tLink2D *x)
-{
-}
-
-void tLink2D_setK(t_tLink2D *x, t_float K)
-{
-}
-
-void tLink2D_setL(t_tLink2D *x, t_float L)
-{
-}
-
-void tLink2D_setD(t_tLink2D *x, t_float D)
-{
-}
-
-void tLink2D_setD2(t_tLink2D *x, t_float D)
-{
-}
-
-void tLink2D_Lmin(t_tLink2D *x, t_float Lmin)
-{
-}
-
-void tLink2D_Lmax(t_tLink2D *x, t_float Lmax)
-{
-}
-
-void tLink2D_position2D(t_tLink2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->position2Dx1 = f1;
- x->position2Dy1 = f2;
-}
-
-void tLink2D_position2D2(t_tLink2D *x, t_floatarg f1, t_floatarg f2)
-{
- x->position2Dx2 = f1;
- x->position2Dy2 = f2;
-}
-
-void tLink2D_bang(t_tLink2D *x)
-{
- t_float vitesse, distance, orientation;
- t_atom force1[2];
-
- distance = sqrt ( pow((x->position2Dx2-x->position2Dx1), 2) + pow((x->position2Dy2-x->position2Dy1), 2) );
-
- vitesse = x->distance_old - distance;
-
- SETFLOAT(&(force1[0]), (x->position2Dx2 + x->position2Dx1)/ 2);
- SETFLOAT(&(force1[1]), (x->position2Dy2 + x->position2Dy1)/ 2);
-
- outlet_anything(x->force4, gensym("position2D"), 2, force1);
-
- if ((x->position2Dx2-x->position2Dx1) != 0)
- {
- orientation = 180/3.14159 * atan((float)(x->position2Dy2 - x->position2Dy1)/(x->position2Dx2 - x->position2Dx1));
- if ((x->position2Dx2 - x->position2Dx1)<0)
- orientation +=180;
- if (orientation<0)
- orientation +=360;
-
- outlet_float(x->force3, orientation);
- }
- else
- {
- if ((x->position2Dy2 - x->position2Dy1)<0)
- outlet_float(x->force3,270);
- else
- outlet_float(x->force3,90);
- }
-
- outlet_float(x->force2, vitesse);
-
- outlet_float(x->force1, distance);
-
- x->distance_old = distance;
-
-}
-
-
-static void tLink2D_free(t_tLink2D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *tLink2D_new(t_symbol *s)
-{
- t_tLink2D *x = (t_tLink2D *)pd_new(tLink2D_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("position2D"), gensym("position2D2"));
-
- x->force1=outlet_new(&x->x_obj, 0);
- x->force2=outlet_new(&x->x_obj, 0);
- x->force3=outlet_new(&x->x_obj, 0);
- x->force4=outlet_new(&x->x_obj, 0);
-
- x->distance_old = 0;
-
- return (x);
-}
-
-void tLink2D_setup(void)
-{
-
- tLink2D_class = class_new(gensym("tLink2D"),
- (t_newmethod)tLink2D_new,
- (t_method)tLink2D_free,
- sizeof(t_tLink2D),
- CLASS_DEFAULT, A_DEFSYM, 0);
-
- class_addcreator((t_newmethod)tLink2D_new, gensym("tLia2D"), A_DEFSYM, 0);
-
-
- class_addbang(tLink2D_class, tLink2D_bang);
-
- class_addmethod(tLink2D_class, (t_method)tLink2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_position2D2, gensym("position2D2"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
- // only for the object not to output erreor when having the same name as the link
- class_addmethod(tLink2D_class, (t_method)tLink2D_reset, gensym("reset"), 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_resetL, gensym("resetL"), 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_resetF, gensym("resetF"), 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_setD2, gensym("setD2"), A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_setK, gensym("setK"), A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_setL, gensym("setL"), A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_Lmin, gensym("setLmin"), A_DEFFLOAT, 0);
- class_addmethod(tLink2D_class, (t_method)tLink2D_Lmax, gensym("setLmax"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/tLink3D.c b/src/tLink3D.c
deleted file mode 100644
index b4f623c..0000000
--- a/src/tLink3D.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tLink3D_class;
-
-typedef struct _tLink3D {
- t_object x_obj;
- t_float distance_old, position2Dx1, position2Dy1, position2Dz1, position2Dx2, position2Dy2, position2Dz2;
- t_outlet *force1;
- t_outlet *force2;
- t_outlet *force3;
- t_outlet *force4;
- t_symbol *x_sym; // receive
-} t_tLink3D;
-
-void tLink3D_reset(t_tLink3D *x)
-{
-}
-
-void tLink3D_resetF(t_tLink3D *x)
-{
-}
-
-void tLink3D_resetL(t_tLink3D *x)
-{
-}
-
-
-void tLink3D_setK(t_tLink3D *x, t_float K)
-{
-}
-
-void tLink3D_setL(t_tLink3D *x, t_float L)
-{
-}
-
-void tLink3D_setD(t_tLink3D *x, t_float D)
-{
-}
-
-void tLink3D_setD2(t_tLink3D *x, t_float D)
-{
-}
-
-void tLink3D_Lmin(t_tLink3D *x, t_float Lmin)
-{
-}
-
-void tLink3D_Lmax(t_tLink3D *x, t_float Lmax)
-{
-}
-
-
-void tLink3D_position3D(t_tLink3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->position2Dx1 = f1;
- x->position2Dy1 = f2;
- x->position2Dz1 = f3;
-}
-
-void tLink3D_position3D2(t_tLink3D *x, t_floatarg f1, t_floatarg f2, t_floatarg f3)
-{
- x->position2Dx2 = f1;
- x->position2Dy2 = f2;
- x->position2Dz2 = f3;
-}
-
-void tLink3D_bang(t_tLink3D *x)
-{
- t_float vitesse, distance, orientation;
- t_atom force1[3];
-
- distance = sqrt ( pow((x->position2Dx2-x->position2Dx1), 2) + pow((x->position2Dy2-x->position2Dy1), 2) + pow((x->position2Dz2-x->position2Dz1), 2) );
-
- vitesse = x->distance_old - distance;
-
-
- SETFLOAT(&(force1[0]), (x->position2Dx2 + x->position2Dx1)/ 2);
- SETFLOAT(&(force1[1]), (x->position2Dy2 + x->position2Dy1)/ 2);
- SETFLOAT(&(force1[2]), (x->position2Dz2 + x->position2Dz1)/ 2);
-
- outlet_anything(x->force4, gensym("position3D"), 3, force1);
-
-
- SETFLOAT(&(force1[0]), (x->position2Dx2 - x->position2Dx1)/ distance);
- SETFLOAT(&(force1[1]), (x->position2Dy2 - x->position2Dy1)/ distance);
- SETFLOAT(&(force1[2]), (x->position2Dz2 - x->position2Dz1)/ distance);
-
- outlet_anything(x->force3, gensym("vector3D"), 3, force1);
-
- outlet_float(x->force2, vitesse);
-
- outlet_float(x->force1, distance);
-
- x->distance_old = distance;
-
-}
-
-
-static void tLink3D_free(t_tLink3D *x)
-{
- pd_unbind(&x->x_obj.ob_pd, x->x_sym);
-}
-
-void *tLink3D_new(t_symbol *s)
-{
-
- t_tLink3D *x = (t_tLink3D *)pd_new(tLink3D_class);
-
- x->x_sym = s;
- pd_bind(&x->x_obj.ob_pd, s);
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("position3D"), gensym("position3D2"));
-
- x->force1=outlet_new(&x->x_obj, 0);
- x->force2=outlet_new(&x->x_obj, 0);
- x->force3=outlet_new(&x->x_obj, 0);
- x->force4=outlet_new(&x->x_obj, 0);
-
- x->distance_old = 0;
-
- return (x);
-}
-
-void tLink3D_setup(void)
-{
-
- tLink3D_class = class_new(gensym("tLink3D"),
- (t_newmethod)tLink3D_new,
- (t_method)tLink3D_free,
- sizeof(t_tLink3D),
- CLASS_DEFAULT, A_DEFSYM, 0);
-
- class_addcreator((t_newmethod)tLink3D_new, gensym("tLia3D"), A_DEFSYM, 0);
-
- class_addbang(tLink3D_class, tLink3D_bang);
-
- class_addmethod(tLink3D_class, (t_method)tLink3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_position3D2, gensym("position3D2"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- // only for the object not to output erreor when having the same name as the link
- class_addmethod(tLink3D_class, (t_method)tLink3D_reset, gensym("reset"), 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_resetL, gensym("resetL"), 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_resetF, gensym("resetF"), 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_setD, gensym("setD"), A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_setD2, gensym("setD2"), A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_setK, gensym("setK"), A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_setL, gensym("setL"), A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_Lmin, gensym("setLmin"), A_DEFFLOAT, 0);
- class_addmethod(tLink3D_class, (t_method)tLink3D_Lmax, gensym("setLmax"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/tPlane3D.c b/src/tPlane3D.c
deleted file mode 100644
index 3213bea..0000000
--- a/src/tPlane3D.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tPlane3D_class;
-
-typedef struct _tPlane3D {
- t_object x_obj;
- t_float X, Y, Z, VX, VY, VZ, P, distance_old;
- t_outlet *force_new, *profondeur, *vitesse;// outlet
-} t_tPlane3D;
-
-
-void tPlane3D_position3D(t_tPlane3D *x, t_float X, t_float Y, t_float Z)
-{
-t_float d, tmp, profondeur, vitesse;
-
- tmp = sqrt (x->VX*x->VX + x->VY*x->VY + x->VZ*x->VZ);
- if (tmp != 0)
- {
- x->VX /= tmp;
- x->VY /= tmp;
- x->VZ /= tmp;
-
- }
- else
- {
- x->VX=1;
- x->VY=0;
- x->VZ=0;
- }
-
- d = x->VX * x->X + x->VY * x->Y + x->VZ * x->Z;
-
- profondeur = x->VX * X + x->VY * Y + x->VZ * Z - d;
-
- vitesse = profondeur - x->distance_old ;
-
- x->distance_old = profondeur;
-
- outlet_float(x->vitesse, vitesse);
-
- outlet_float(x->profondeur, profondeur);
-
-
- if ( (profondeur < 0) & (profondeur > - x->P) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-
-}
-
-void tPlane3D_setXYZ(t_tPlane3D *x, t_float X, t_float Y, t_float Z)
-{
- x->X= X;
- x->Y= Y;
- x->Z= Z;
-}
-void tPlane3D_setVXYZ(t_tPlane3D *x, t_float X, t_float Y, t_float Z)
-{
- x->VX= X;
- x->VY= Y;
- x->VZ= Z;
-}
-
-void tPlane3D_setVX(t_tPlane3D *x, t_float X)
-{
- x->VX= X;
-}
-
-void tPlane3D_setVY(t_tPlane3D *x, t_float Y)
-{
- x->VY= Y;
-}
-
-void tPlane3D_setVZ(t_tPlane3D *x, t_float Z)
-{
- x->VZ= Z;
-}
-void tPlane3D_setX(t_tPlane3D *x, t_float X)
-{
- x->X= X;
-}
-
-void tPlane3D_setY(t_tPlane3D *x, t_float Y)
-{
- x->Y= Y;
-}
-
-void tPlane3D_setZ(t_tPlane3D *x, t_float Z)
-{
- x->Z= Z;
-}
-
-void tPlane3D_setP(t_tPlane3D *x, t_float X)
-{
- x->P= X;
-}
-
-
-void *tPlane3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tPlane3D *x = (t_tPlane3D *)pd_new(tPlane3D_class);
-
- x->force_new=outlet_new(&x->x_obj, 0);
- x->profondeur=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->distance_old = 0;
-
- if (argc>=7)
- x->P= atom_getfloatarg(6, argc, argv);
- else
- x->P= 10000;
-
- if (argc>=6)
- x->Z= atom_getfloatarg(5, argc, argv);
- else
- x->Z= 0;
-
- if (argc>=5)
- x->Y= atom_getfloatarg(4, argc, argv);
- else
- x->Y= 0;
-
- if (argc>=4)
- x->X= atom_getfloatarg(3, argc, argv);
- else
- x->X= 0;
-
- if (argc>=3)
- x->VZ= atom_getfloatarg(2, argc, argv);
- else
- x->VZ= 0;
-
- if (argc>=2)
- x->VY= atom_getfloatarg(1, argc, argv);
- else
- x->VY= 0;
-
- if (argc>=1)
- x->VX= atom_getfloatarg(0, argc, argv);
- else
- x->VX= 1;
-
- return (x);
-}
-
-void tPlane3D_setup(void)
-{
-
- tPlane3D_class = class_new(gensym("tPlane3D"),
- (t_newmethod)tPlane3D_new,
- 0, sizeof(t_tPlane3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tPlane3D_new, gensym("pmpd.tPlane3D"), A_GIMME, 0);
-
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setVX, gensym("setVX"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setVY, gensym("setVY"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setVZ, gensym("setVZ"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setVXYZ, gensym("setVXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tPlane3D_class, (t_method)tPlane3D_setP, gensym("setPmax"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/tSeg2D.c b/src/tSeg2D.c
deleted file mode 100644
index 7345bd7..0000000
--- a/src/tSeg2D.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tSeg2D_class;
-
-typedef struct _tSeg2D {
- t_object x_obj;
- t_float X1, X2, Y1, Y2, P, P_old;
- t_outlet *force_new, *profondeur, *vitesse;// outlet
-} t_tSeg2D;
-
-void tSeg2D_position2D(t_tSeg2D *x, t_float X, t_float Y)
-{
- t_float a1, b1, c1, a2, b2, c2, a3, b3, c3, profondeur, tmp;
-
- b1 = x->X2 - x->X1;
- a1 = -x->Y2 + x->Y1;
-
- if (!((a1==0) & (b1==0)))
- {
- tmp = sqrt((a1*a1)+(b1*b1)); // = longueur du vecteur pour renormalisation
- a1 = a1/tmp;
- b1 = b1/tmp;
- c1 = a1*x->X1+b1*x->Y1;
-
- profondeur = ( (a1 * X) + (b1 * Y) ) - c1;
-
- tmp = profondeur - x->P_old;
-
- x->P_old = profondeur;
-
- a2 = b1;
- b2 = -a1;
- c2 = a2*x->X1+b2*x->Y1;
-
- a3 = a2;
- b3 = b2;
- c3 = a3*x->X2+b3*x->Y2;
-
- outlet_float(x->vitesse, tmp);
- outlet_float(x->profondeur, profondeur);
-
- if ( ( profondeur < 0) & (profondeur > - x->P) & (( (a2 * X) + (b2 * Y) ) > c2) & ( ((a3 * X) + (b3 * Y) ) < c3) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-
-}
-
-void tSeg2D_Xmin(t_tSeg2D *x, t_float X)
-{
- x->X1= X;
-}
-
-void tSeg2D_Xmax(t_tSeg2D *x, t_float X)
-{
- x->X2= X;
-}
-
-void tSeg2D_Ymin(t_tSeg2D *x, t_float X)
-{
- x->Y1= X;
-}
-
-void tSeg2D_Ymax(t_tSeg2D *x, t_float X)
-{
- x->Y2= X;
-}
-
-void tSeg2D_P(t_tSeg2D *x, t_float X)
-{
- x->P= X;
-}
-
-void *tSeg2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tSeg2D *x = (t_tSeg2D *)pd_new(tSeg2D_class);
- x->force_new = outlet_new(&x->x_obj, 0);
- x->profondeur =outlet_new(&x->x_obj, 0);
- x->vitesse = outlet_new(&x->x_obj, 0);
-
- x->P_old = 0;
-
- if (argc>=5)
- x->P = atom_getfloatarg(4, argc, argv);
- else
- x->P = 1;
-
- if (argc>=4)
- x->Y2 = atom_getfloatarg(3, argc, argv);
- else
- x->Y2 = 0;
-
- if (argc>=3)
- x->X2 = atom_getfloatarg(2, argc, argv);
- else
- x->X2 = 1;
-
- if (argc>=2)
- x->Y1 = atom_getfloatarg(1, argc, argv);
- else
- x->Y1 = 0;
-
- if (argc>=1)
- x->X1 = atom_getfloatarg(0, argc, argv);
- else
- x->X1 = -1;
-
- return (x);
-}
-
-void tSeg2D_setup(void)
-{
-
- tSeg2D_class = class_new(gensym("tSeg2D"),
- (t_newmethod)tSeg2D_new,
- 0, sizeof(t_tSeg2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tSeg2D_new, gensym("pmpd.tSeg2D"), A_GIMME, 0);
-
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_Xmin, gensym("setX1"), A_DEFFLOAT, 0);
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_Ymin, gensym("setY1"), A_DEFFLOAT, 0);
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_Xmax, gensym("setX2"), A_DEFFLOAT, 0);
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_Ymax, gensym("setY2"), A_DEFFLOAT, 0);
- class_addmethod(tSeg2D_class, (t_method)tSeg2D_P, gensym("setPmax"), A_DEFFLOAT, 0);
-
-}
diff --git a/src/tSphere3D.c b/src/tSphere3D.c
deleted file mode 100644
index 6ef9cfa..0000000
--- a/src/tSphere3D.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tSphere3D_class;
-
-typedef struct _tSphere3D {
- t_object x_obj;
- t_float X, Y, Z, Rmin, Rmax, position_old;
- t_outlet *force_new, *distance_out, *vitesse;// outlet
-} t_tSphere3D;
-
-void tSphere3D_position3D(t_tSphere3D *x, t_float X, t_float Y, t_float Z)
-{
-t_float distance, vitesse;
- distance = sqrt ( (X - x->X)*(X - x->X) + (Y - x->Y)*(Y - x->Y) + (Z - x->Z)*(Z - x->Z));
-
- vitesse = distance - x->position_old;
- x->position_old = distance;
-
- outlet_float(x->vitesse, vitesse);
-
- outlet_float(x->distance_out, distance);
-
- if ( (distance < x->Rmax) & (distance > x->Rmin) )
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-
-}
-
-void tSphere3D_setXYZ(t_tSphere3D *x, t_float X, t_float Y, t_float Z)
-{
- x->X= X;
- x->Y= Y;
- x->Z= Z;
-}
-
-void tSphere3D_setX(t_tSphere3D *x, t_float X)
-{
- x->X= X;
-}
-
-void tSphere3D_setY(t_tSphere3D *x, t_float Y)
-{
- x->Y= Y;
-}
-
-void tSphere3D_setZ(t_tSphere3D *x, t_float Z)
-{
- x->Z= Z;
-}
-
-void tSphere3D_setRmax(t_tSphere3D *x, t_float X)
-{
- x->Rmax= X;
-}
-
-void tSphere3D_setRmin(t_tSphere3D *x, t_float X)
-{
- x->Rmin= X;
-}
-
-
-
-void *tSphere3D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tSphere3D *x = (t_tSphere3D *)pd_new(tSphere3D_class);
-
- x->force_new=outlet_new(&x->x_obj, 0);
- x->distance_out=outlet_new(&x->x_obj, 0);
- x->vitesse=outlet_new(&x->x_obj, 0);
-
- x->position_old = 0;
-
-
- if (argc>=5)
- x->Rmax= atom_getfloatarg(4, argc, argv);
- else
- x->Rmax= 1;
-
- if (argc>=4)
- x->Rmin= atom_getfloatarg(3, argc, argv);
- else
- x->Rmin= 0;
-
- if (argc>=3)
- x->Z= atom_getfloatarg(2, argc, argv);
- else
- x->Z= 0;
-
- if (argc>=2)
- x->Y= atom_getfloatarg(1, argc, argv);
- else
- x->Y= 0;
-
- if (argc>=1)
- x->X= atom_getfloatarg(0, argc, argv);
- else
- x->X= 0;
-
- return (x);
-}
-
-void tSphere3D_setup(void)
-{
-
- tSphere3D_class = class_new(gensym("tSphere3D"),
- (t_newmethod)tSphere3D_new,
- 0, sizeof(t_tSphere3D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tSphere3D_new, gensym("pmpd.tSphere3D"), A_GIMME, 0);
-
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_position3D, gensym("position3D"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setX, gensym("setX"), A_DEFFLOAT, 0);
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setY, gensym("setY"), A_DEFFLOAT, 0);
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setZ, gensym("setZ"), A_DEFFLOAT, 0);
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setXYZ, gensym("setXYZ"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setRmax, gensym("setRmax"), A_DEFFLOAT, 0);
- class_addmethod(tSphere3D_class, (t_method)tSphere3D_setRmin, gensym("setRmin"), A_DEFFLOAT, 0);
-
-
-}
diff --git a/src/tSquare2D.c b/src/tSquare2D.c
deleted file mode 100644
index 4e14fa0..0000000
--- a/src/tSquare2D.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "m_pd.h"
-#include "math.h"
-
-static t_class *tSquare2D_class;
-
-typedef struct _tSquare2D {
- t_object x_obj;
- t_float Xmin, Xmax, Ymin, Ymax;
- //extrem = Xmin, Ymin, Xmax, Ymax;
- t_outlet *force_new;// outlet
-} t_tSquare2D;
-
-void tSquare2D_position2D(t_tSquare2D *x, t_float X, t_float Y)
-{
-
- if ((X > x->Xmin) & (X < x->Xmax) & (Y > x->Ymin) & (Y < x->Ymax))
- {
- outlet_float(x->force_new, 1);
- }
- else
- {
- outlet_float(x->force_new, 0);
- }
-}
-
-void tSquare2D_Xmin(t_tSquare2D *x, t_float X)
-{
- x->Xmin= X;
-}
-
-void tSquare2D_Xmax(t_tSquare2D *x, t_float X)
-{
- x->Xmax= X;
-}
-
-void tSquare2D_Ymin(t_tSquare2D *x, t_float X)
-{
- x->Ymin= X;
-}
-
-void tSquare2D_Ymax(t_tSquare2D *x, t_float X)
-{
- x->Ymax= X;
-}
-
-void *tSquare2D_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_tSquare2D *x = (t_tSquare2D *)pd_new(tSquare2D_class);
- x->force_new=outlet_new(&x->x_obj, 0);
-
- if (argc>=4)
- x->Ymax = atom_getfloatarg(3, argc, argv);
- else
- x->Ymax = 1;
-
- if (argc>=3)
- x->Ymin = atom_getfloatarg(2, argc, argv);
- else
- x->Ymin = -1;
-
- if (argc>=2)
- x->Xmax = atom_getfloatarg(1, argc, argv);
- else
- x->Xmax = 1;
-
- if (argc>=1)
- x->Xmin = atom_getfloatarg(0, argc, argv);
- else
- x->Xmin = -1;
-
- return (x);
-}
-
-void tSquare2D_setup(void)
-{
-
- tSquare2D_class = class_new(gensym("tSquare2D"),
- (t_newmethod)tSquare2D_new,
- 0, sizeof(t_tSquare2D),
- CLASS_DEFAULT, A_GIMME, 0);
-
- class_addcreator((t_newmethod)tSquare2D_new, gensym("pmpd.tSquare2D"), A_GIMME, 0);
-
- class_addmethod(tSquare2D_class, (t_method)tSquare2D_position2D, gensym("position2D"), A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(tSquare2D_class, (t_method)tSquare2D_Xmin, gensym("setXmin"), A_DEFFLOAT, 0);
- class_addmethod(tSquare2D_class, (t_method)tSquare2D_Ymin, gensym("setYmin"), A_DEFFLOAT, 0);
- class_addmethod(tSquare2D_class, (t_method)tSquare2D_Xmax, gensym("setXmax"), A_DEFFLOAT, 0);
- class_addmethod(tSquare2D_class, (t_method)tSquare2D_Ymax, gensym("setYmax"), A_DEFFLOAT, 0);
-
-
-}