Ejemplo n.º 1
0
 /// <summary>
 /// Calculate the direction vector of the movement perming by the finger from the startFrame frame to the endFrame frame.
 /// </summary>
 /// <param name="pointableId">The id of the finger performing the movement.</param>
 /// <param name="startFrame">The frame containing the start position of the direction vector.</param>
 /// <param name="endFrame">The frame containing the end position of the direction vector.</param>
 /// <returns>The direction vector.</returns>
 public static Vector Direction(int pointableId, IFrame startFrame, IFrame endFrame)
 {
     Vector startPosition = startFrame.Finger(pointableId).TipPosition;
     Vector endPosition = endFrame.Finger(pointableId).TipPosition;
     return (endPosition - startPosition);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Calculate the speed of the finger between the startFrame frame and the endFrame frame in mm/s.
 /// </summary>
 /// <param name="finger">The finger which we want to calculate the speed.</param>
 /// <param name="startFrame">The start frame.</param>
 /// <param name="endFrame">The end frame.</param>
 /// <returns>The speed in mm/s.</returns>
 public static float Speed(int pointableId, IFrame startFrame, IFrame endFrame)
 {
     Vector startPosition = startFrame.Finger(pointableId).TipPosition;
     Vector endPosition = endFrame.Finger(pointableId).TipPosition;
     return ((endPosition - startPosition).Magnitude / (endFrame.Timestamp - startFrame.Timestamp)) * 1000000; // mm/s
 }