private TouchPoint UpdateTouchPoint(TouchPoint tp, TuioCursor cursor) { tp.PreviousPoint = tp.CurrentPoint; tp.CurrentPoint = cursor.getPath().Last().ToPoint(GestureManager); tp.CurrentTimeMS = cursor.getTuioTime().getTotalMilliseconds(); tp.Distance = cursor.getTotalDistanceInPixel(this.GestureManager); tp.PathLength = cursor.getPath().Count; tp.DistanceRelative = cursor.getTotalDistance(); return(tp); }
private TouchPoint CreateTouchPoint(TuioCursor cursor) { TouchPoint tp = new TouchPoint { StartPoint = cursor.getPath().First().ToPoint(GestureManager), StartTimeMS = cursor.getStartTime().getTotalMilliseconds(), CurrentPoint = cursor.getPath().First().ToPoint(GestureManager), SessionID = cursor.getSessionID() }; return(UpdateTouchPoint(tp, cursor)); }
/// <summary> /// Berechnet die Summe der Entfernungen der Einzelsegmente eines TuioCursors. /// In anderen Worten, die bisher zurückgelegte Entfernung einer Berührung /// </summary> /// <param name="self">Der TuioCursor</param> /// <returns>Die berechnete Entfernung, in Pixel</returns> public static float getTotalDistanceInPixel(this TuioCursor self, GestureManager manager) { float dist = 0; TuioPoint last = null; foreach (TuioPoint tp in self.getPath()) { if (last != null) { dist += tp.GetPixelDistance(last, manager); } last = tp; } return(dist); }
/// <summary> /// Berechnet die Summe der Entfernungen der Einzelsegmente eines TuioCursors. /// In anderen Worten, die bisher zurückgelegte Entfernung einer Berührung /// </summary> /// <param name="self">Der TuioCursor</param> /// <returns>Die berechnete Entfernung, in Relation zur Bildschirmgröße (0 bis 1)</returns> public static float getTotalDistance(this TuioCursor self) { float dist = 0; TuioPoint last = null; List <TuioPoint> allPoints = self.getPath(); for (int i = 0; i < allPoints.Count; i++) { TuioPoint tp = allPoints[i]; if (last != null) { dist += tp.getDistance(last); } last = tp; } return(dist); }