public ParameterizedMousePosition(Position.IVirtualMousePosition mousePos, int fakeTime) { m_mouse = mousePos; m_newPosition = mousePos.GetVirtualPointD(); m_newAcceleration = mousePos.GetAcceleration(); m_newVelocity = mousePos.GetVelocity(); m_newDisplacement = m_mouse.GetDisplacement(); m_fakeTime = fakeTime; }
public void Compute(Position.IVirtualMousePosition mousePosition, out bool filtersChanged) { int i = 0; PointD sumVel = mousePosition.GetVelocity(); PointD sumAccel = mousePosition.GetAcceleration(); PointD displ = mousePosition.GetDisplacement(); Position.ParameterizedMousePosition mp = new Position.ParameterizedMousePosition(mousePosition); int numInUse = 0;// instrumentation filtersChanged = false; // flag out if filter state changes for (i = 0; i < m_Filters.Count; i++) { if (m_Filters[i].Parameters.FilterEnabled ) { if (m_Filters[i].HitTest(mousePosition.GetVirtualPointD())) { if (!m_Filters[i].Parameters.InUse) m_Filters[i].Parameters.UseCounter++; if (!m_Filters[i].Parameters.InUse) filtersChanged = true; m_Filters[i].Parameters.InUse = true; numInUse++;// instrumentation PointD vel = m_Filters[i].GetVelocity(mp); if (!(double.IsNaN(vel.X) || double.IsInfinity(vel.X) || double.IsNaN(vel.Y) || double.IsNaN(vel.Y))) { sumVel += vel; mp.SetVelocity(sumVel); } } else { if (m_Filters[i].Parameters.InUse) filtersChanged = true; m_Filters[i].Parameters.InUse = false; } } } m_maxNumInUse = Math.Max(numInUse, m_maxNumInUse); // instrumentation m_computedAcceleration = sumAccel; m_computedVelocity = sumVel; }