15  return static_cast<int>(((
static_cast<double>(rand()) / (
static_cast<double>(RAND_MAX) + 1.0)) * d) + mi);
 
 
   23  ISmoother* smoother = MMgetPointer<ISmoother*>(m, MTOP(obj));
 
   24  SAFE_DELETE(smoother);
 
   25  MMsetPointer<ISmoother*>(m, MTOP(obj), 0);
 
   27  MMechostr(MSKDEBUG, 
"ObjSmoother destroyed.\n");
 
 
  134  MMechostr(MSKDEBUG, 
"_CRsmoother\n");
 
  136  int ibeta = MMpull(m);
 
  137  int ialpha = MMpull(m);
 
  138  int imethod = MMpull(m);
 
  139  int itype = MMpull(m);
 
  141  if ((ibeta == NIL) || (ialpha == NIL) || (imethod == NIL) || (itype == NIL))
 
  143    MMechostr(MSKDEBUG, 
"_CRsmoother: Some arguments are invalid\n");
 
  148  float beta = MTOF(ibeta);
 
  149  float alpha = MTOF(ialpha);
 
  150  int method = MTOI(imethod);
 
  151  int type = MTOI(itype);
 
  157    MMechostr(MSKDEBUG, 
"_CRsmoother: Method is not valid ! Please choose between SMOOTHER_METHOD_DOUBLEEXP and SMOOTHER_METHOD_LINEAR\n");
 
  189    MMechostr(MSKDEBUG, 
"_CRsmoother: Type is not valid ! Please choose between SMOOTHER_TYPE_FLOAT, SMOOTHER_TYPE_VEC2 and SMOOTHER_TYPE_VEC3\n");
 
  197    MMechostr(MSKDEBUG, 
"_CRsmoother: Couldn't malloc smoother\n");
 
  202  if ((MMpushPointer(m, smoother) != 0))
 
  204    SAFE_DELETE(smoother);
 
 
  222  MMechostr(MSKDEBUG, 
"_CLRsmoother");
 
  223  int ismoother = MMget(m, 0);
 
  224  if (ismoother == NIL)
 
  226    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  231  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  232  if (smootherOBJ == NULL)
 
 
  253  MMechostr(MSKDEBUG, 
"_DSsmoother\n");
 
  255  int obj = MMget(m, 0);
 
  264  MMset(m, 0, ITOM(0));
 
 
  279  int value = MMpull(m);
 
  280  int ismoother = MMget(m, 0);
 
  281  if (value == NIL || ismoother == NIL)
 
  283    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! value or smoother is NIL !\n");
 
  288  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  289  if (smootherOBJ == NULL)
 
  295  pushValue(smootherOBJ, MTOF(value), 0.0f, 0.0f);
 
 
  311  int value2 = MMpull(m);
 
  312  int value1 = MMpull(m);
 
  313  int ismoother = MMget(m, 0);
 
  314  if (value1 == NIL || value2 == NIL || ismoother == NIL)
 
  316    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! value or smoother is NIL !\n");
 
  321  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  322  if (smootherOBJ == NULL)
 
  328  pushValue(smootherOBJ, MTOF(value1), MTOF(value2), 0.0f);
 
 
  345  int value3 = MMpull(m);
 
  346  int value2 = MMpull(m);
 
  347  int value1 = MMpull(m);
 
  348  int ismoother = MMget(m, 0);
 
  349  if (value1 == NIL || value2 == NIL || value3 == NIL || ismoother == NIL)
 
  351    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! value or smoother is NIL !\n");
 
  356  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  357  if (smootherOBJ == NULL)
 
  363  pushValue(smootherOBJ, MTOF(value1), MTOF(value2), MTOF(value3));
 
 
  377  int ismoother = MMget(m, 0);
 
  378  if (ismoother == NIL)
 
  380    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  385  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  386  if (smootherOBJ == NULL)
 
  392  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  394  MMset(m, 0, FTOM(value1));
 
 
  408  int ismoother = MMget(m, 0);
 
  409  if (ismoother == NIL)
 
  411    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  416  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  417  if (smootherOBJ == NULL)
 
  423  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  425  int tupleSize = MMmalloc(m, 2, TYPETAB);
 
  426  if (tupleSize == NIL)
 
  432  MMstore(m, tupleSize, 0, FTOM(value1));
 
  433  MMstore(m, tupleSize, 1, FTOM(value2));
 
  434  MMset(m, 0, PTOM(tupleSize));
 
 
  448  int ismoother = MMget(m, 0);
 
  449  if (ismoother == NIL)
 
  451    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  456  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  457  if (smootherOBJ == NULL)
 
  463  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  466  int tupleSize = MMmalloc(m, 3, TYPETAB);
 
  467  if (tupleSize == NIL)
 
  473  MMstore(m, tupleSize, 0, FTOM(value1));
 
  474  MMstore(m, tupleSize, 1, FTOM(value2));
 
  475  MMstore(m, tupleSize, 2, FTOM(value3));
 
  476  MMset(m, 0, PTOM(tupleSize));
 
 
  490  int ismoother = MMget(m, 0);
 
  491  if (ismoother == NIL)
 
  493    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  498  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  499  if (smootherOBJ == NULL)
 
  505  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  507  MMset(m, 0, FTOM(value1));
 
 
  521  int ismoother = MMget(m, 0);
 
  522  if (ismoother == NIL)
 
  524    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  529  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  530  if (smootherOBJ == NULL)
 
  536  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  538  int tupleSize = MMmalloc(m, 2, TYPETAB);
 
  539  if (tupleSize == NIL)
 
  545  MMstore(m, tupleSize, 0, FTOM(value1));
 
  546  MMstore(m, tupleSize, 1, FTOM(value2));
 
  547  MMset(m, 0, PTOM(tupleSize));
 
 
  561  int ismoother = MMget(m, 0);
 
  562  if (ismoother == NIL)
 
  564    MMechostr(MSKDEBUG, 
"_CLRsmoother: error ! smoother is NIL !\n");
 
  569  ISmoother* smootherOBJ = MMgetPointer<ISmoother*>(m, MTOP(ismoother));
 
  570  if (smootherOBJ == NULL)
 
  576  float value1 = 0.0f, value2 = 0.0f, value3 = 0.0f;
 
  578  int tupleSize = MMmalloc(m, 3, TYPETAB);
 
  579  if (tupleSize == NIL)
 
  585  MMstore(m, tupleSize, 0, FTOM(value1));
 
  586  MMstore(m, tupleSize, 1, FTOM(value2));
 
  587  MMstore(m, tupleSize, 2, FTOM(value3));
 
  588  MMset(m, 0, PTOM(tupleSize));
 
 
  593  { 
"ObjSmoother", TYPTYPE, NULL, NULL },
 
  603  { 
"_CRsmoother", 5, 
"fun [Chn I I F F] ObjSmoother", 
_CRsmoother },
 
  604  { 
"_CLRsmoother", 1, 
"fun [ObjSmoother] ObjSmoother", 
_CLRsmoother },
 
  605  { 
"_DSsmoother", 1, 
"fun [ObjSmoother] I", 
_DSsmoother },
 
 
  627  MMechostr(MSKDEBUG, 
" > Loading MathToolkit\n");
 
  630  MMechostr(MSKDEBUG, 
" > Successfully Loaded\n\n");
 
 
#define SMOOTHER_TYPE_VEC2
 
#define SMOOTHER_TYPE_VEC3
 
#define SMOOTHER_TYPE_FLOAT
 
#define SMOOTHER_TYPE_UNDEFINED
 
#define SMOOTHER_METHOD_LINEAR
 
#define SMOOTHER_METHOD_UNDEFINED
 
#define SMOOTHER_METHOD_DOUBLEEXP
 
static const BtQuaternion IDENTITY
 
Double Exponential smoother.
 
virtual void clearValues()=0
 
virtual int getSmootherType()=0
 
int _PUSHsmootherValue3(mmachine m)
_PUSHsmootherValue3 : Push a new vector3 value to ObjSmoother
 
int _GETsmootherExtrapolatedValue3(mmachine m)
_GETsmootherExtrapolatedValue3 : Get an extrapolated value from smoother as a tuple of 3 float
 
int _CLRsmoother(mmachine m)
_CLRsmoother : Clears smoother state
 
int _PUSHsmootherValue1(mmachine m)
_PUSHsmootherValue1 : Push a new value to ObjSmoother
 
int _PUSHsmootherValue2(mmachine m)
_PUSHsmootherValue2 : Push a new vector2 value to ObjSmoother
 
int _GETsmootherSmoothedValue2(mmachine m)
_GETsmootherSmoothedValue2 : Get last smoothed value from smoother as a tuple of 2 float
 
int _GETsmootherSmoothedValue1(mmachine m)
_GETsmootherSmoothedValue1 : Get last smoothed value from smoother as simple float
 
int _GETsmootherExtrapolatedValue2(mmachine m)
_GETsmootherExtrapolatedValue2 : Get an extrapolated value from smoother as a tuple of 2 float
 
int _GETsmootherExtrapolatedValue1(mmachine m)
_GETsmootherExtrapolatedValue1 : Get an extrapolated value from smoother as simple float
 
int _CRsmoother(mmachine m)
_CRsmoother : Create a new Smoother object
 
int _GETsmootherSmoothedValue3(mmachine m)
_GETsmootherSmoothedValue3 : Get last smoothed value from smoother as a tuple of 3 float
 
int _DSsmoother(mmachine m)
_DSsmoother : Destroys a Smoother object