/// <summary> /// Preprocesses the data. /// </summary> /// <param name="s">Specifies the state and data to use.</param> /// <param name="bUseRawInput">Specifies whether or not to use the raw data <i>true</i>, or a difference of the current and previous data <i>false</i> (default = <i>false</i>).</param> /// <param name="bDifferent">Returns whether or not the current state data is different from the previous - note this is only set when NOT using raw input, otherwise <i>true</i> is always returned.</param> /// <param name="bReset">Optionally, specifies to reset the last sd to null.</param> /// <returns>The preprocessed data is returned.</returns> public SimpleDatum Preprocess(StateBase s, bool bUseRawInput, out bool bDifferent, bool bReset = false) { bDifferent = false; SimpleDatum sd = new SimpleDatum(s.Data, true); if (!bUseRawInput) { if (bReset) { m_sdLast = null; } if (m_sdLast == null) { sd.Zero(); } else { bDifferent = sd.Sub(m_sdLast); } m_sdLast = new SimpleDatum(s.Data, true); } else { bDifferent = true; } sd.Tag = bReset; return(sd); }
/// <summary> /// Preprocesses the data. /// </summary> /// <param name="s">Specifies the state and data to use.</param> /// <param name="bUseRawInput">Specifies whether or not to use the raw data <i>true</i>, or a difference of the current and previous data <i>false</i> (default = <i>false</i>).</param> /// <param name="bDifferent">Returns whether or not the current state data is different from the previous - note this is only set when NOT using raw input, otherwise <i>true</i> is always returned.</param> /// <param name="bReset">Optionally, specifies to reset the last sd to null.</param> /// <returns>The preprocessed data is returned.</returns> public SimpleDatum Preprocess(StateBase s, bool bUseRawInput, out bool bDifferent, bool bReset = false) { bDifferent = false; SimpleDatum sd = new SimpleDatum(s.Data, true); if (!bUseRawInput) { if (bReset) { m_sdLast = null; } if (m_sdLast == null) { sd.Zero(); } else { bDifferent = sd.Sub(m_sdLast); } m_sdLast = new SimpleDatum(s.Data, true); } else { bDifferent = true; } sd.Tag = bReset; if (bReset) { m_rgX = new List <SimpleDatum>(); for (int i = 0; i < m_nFramesPerX * m_nStackPerX; i++) { m_rgX.Add(sd); } } else { m_rgX.Add(sd); m_rgX.RemoveAt(0); } SimpleDatum[] rgSd = new SimpleDatum[m_nStackPerX]; for (int i = 0; i < m_nStackPerX; i++) { int nIdx = ((m_nStackPerX - i) * m_nFramesPerX) - 1; rgSd[i] = m_rgX[nIdx]; } return(new SimpleDatum(rgSd.ToList(), true)); }
public SimpleDatum Preprocess(StateBase s, bool bUseRawInput) { SimpleDatum sd = new SimpleDatum(s.Data, true); if (bUseRawInput) return sd; if (m_sdLast == null) sd.Zero(); else sd.Sub(m_sdLast); m_sdLast = s.Data; return sd; }
public SimpleDatum Preprocess(StateBase s, bool bUseRawInput) { SimpleDatum sd = new SimpleDatum(s.Data, true); if (bUseRawInput) { return(sd); } if (m_sdLast == null) { sd.Zero(); } else { sd.Sub(m_sdLast); } m_sdLast = s.Data; return(sd); }