From 71d54607000eb32907505407e34d1b0acc1f149e Mon Sep 17 00:00:00 2001 From: Cyrille Henry Date: Wed, 16 May 2007 09:49:51 +0000 Subject: add new get messages. this message allow to possibility to get the masses or link name (not there id) svn path=/trunk/externals/nusmuk/; revision=7672 --- msd.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'msd.h') diff --git a/msd.h b/msd.h index fdadb46..e4046a2 100644 --- a/msd.h +++ b/msd.h @@ -1257,7 +1257,7 @@ protected: for(typename IndexMap::iterator mit(mass); mit; ++mit) { SetSymbol(sortie[0],mit.data()->Id); for(int i = 0; i < N; ++i) SetFloat(sortie[1+i],mit.data()->pos[i]); - ToOutAnything(0,S_massesPos,1+N,sortie); + ToOutAnything(0,S_massesPosName,1+N,sortie); } } else if (auxtype == S_massesPosMean) { // get all masses positions mean @@ -1297,6 +1297,13 @@ protected: ToOutAnything(0,S_massesForces,1+N,sortie); } } + else if (auxtype == S_massesForcesName) { // get all masses forces + for(typename IndexMap::iterator mit(mass); mit; ++mit) { + SetSymbol(sortie[0],mit.data()->Id); + for(int i = 0; i < N; ++i) SetFloat(sortie[1+i],mit.data()->out_force[i]); + ToOutAnything(0,S_massesForcesName,1+N,sortie); + } + } else if (auxtype == S_massesForcesMean) { // get all masses forces mean for(int i = 0; i::iterator lit(link); lit; ++lit) { + SetSymbol(sortie[0],lit.data()->Id); + for(int i = 0; i < N; ++i) { + SetFloat(sortie[1+i],lit.data()->mass1->pos[i]); + SetFloat(sortie[1+N+i],lit.data()->mass2->pos[i]); + } + ToOutAnything(0,S_linksPosName,1+2*N,sortie); + } + } else if (auxtype == S_linksLenghts) { // get all links lenghts for(typename IndexMap::iterator lit(link); lit; ++lit) { SetInt(sortie[0],lit.data()->nbr); @@ -1378,6 +1395,13 @@ protected: ToOutAnything(0,S_massesSpeeds,1+N,sortie); } } + else if (auxtype == S_massesSpeedsName) { // get all masses speeds + for(typename IndexMap::iterator mit(mass); mit; ++mit) { + SetSymbol(sortie[0],mit.data()->Id); + for(int i = 0; i < N; ++i) SetFloat(sortie[1+i],mit.data()->speed[i]); + ToOutAnything(0,S_massesSpeedsName,1+N,sortie); + } + } else if (auxtype == S_massesSpeedsMean) { // get all masses forces mean for(int i = 0; i const t_symbol *msdN::S_massesPosName; template const t_symbol *msdN::S_massesPosNo; template const t_symbol *msdN::S_massesPosId; template const t_symbol *msdN::S_linksPos; +template const t_symbol *msdN::S_linksPosName; template const t_symbol *msdN::S_linksPosNo; template const t_symbol *msdN::S_linksPosId; template const t_symbol *msdN::S_linksLenghts; @@ -1913,11 +1944,13 @@ template const t_symbol *msdN::S_linksLenghtsStd; template const t_symbol *msdN::S_linksLenghtsNo; template const t_symbol *msdN::S_linksLenghtsId; template const t_symbol *msdN::S_massesForces; +template const t_symbol *msdN::S_massesForcesName; template const t_symbol *msdN::S_massesForcesMean; template const t_symbol *msdN::S_massesForcesStd; template const t_symbol *msdN::S_massesForcesNo; template const t_symbol *msdN::S_massesForcesId; template const t_symbol *msdN::S_massesSpeeds; +template const t_symbol *msdN::S_massesSpeedsName; template const t_symbol *msdN::S_massesSpeedsMean; template const t_symbol *msdN::S_massesSpeedsStd; template const t_symbol *msdN::S_massesSpeedsNo; -- cgit v1.2.1