Guest User

Untitled

a guest
Jun 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. private bool checkForGap(TuioCursor cur)
  2. {
  3. TuioPoint thisFirstPoint = this.path.First();
  4. TuioPoint thisLastPoint = this.path.Last();
  5. TuioPoint curFirstPoint = cur.getPath().First();
  6. TuioPoint curLastPoint = cur.getPath().Last();
  7.  
  8. float distanceStartEnd = thisLastPoint.getDistance(curFirstPoint);
  9. float distanceStartStart = thisFirstPoint.getDistance(curFirstPoint);
  10. float distanceEndEnd = thisLastPoint.getDistance(curLastPoint);
  11.  
  12. long timeDiffStartEnd = Math.Abs(thisLastPoint.getTuioTime().getTotalMilliseconds() - curFirstPoint.getTuioTime().getTotalMilliseconds());
  13. long timeDiffStartStart = Math.Abs(thisFirstPoint.getTuioTime().getTotalMilliseconds() - curFirstPoint.getTuioTime().getTotalMilliseconds());
  14. long timeDiffEndEnd = Math.Abs(thisLastPoint.getTuioTime().getTotalMilliseconds() - curLastPoint.getTuioTime().getTotalMilliseconds());
  15.  
  16. //Check if Cursor is within timelimit
  17. //überflüßig wegen ThreadWarteZeit?
  18. if (timeDiffStartEnd > MAX_TIME && timeDiffStartStart > MAX_TIME && timeDiffEndEnd > MAX_TIME)
  19. {
  20. Console.WriteLine("Timeout ID" + this.s_id);
  21. wait = false;
  22. }
  23. else
  24. {
  25. if (distanceStartEnd <= MAX_GAP_PIXEL)
  26. {
  27. tproc.setGap(cur.getSessionID(), s_id);
  28. this.maxIDGap = cur.getSessionID() + 5;
  29. return true;
  30. }
  31. else if (distanceStartStart <= MAX_DISTANCE_MULTIGESTURE)
  32. {
  33. Console.WriteLine("MultiGesture Start - Start");
  34. Console.WriteLine(this.s_id + " " + cur.getSessionID());
  35. multiGesture = true;
  36. tproc.addMultiGesture(cur.getSessionID(), s_id);
  37. return true;
  38. }
  39. else if (distanceEndEnd <= MAX_DISTANCE_MULTIGESTURE)
  40. {
  41. Console.WriteLine("MultiGesture End - End");
  42. Console.WriteLine(this.s_id + " " + cur.getSessionID());
  43. multiGesture = true;
  44. tproc.addMultiGesture(cur.getSessionID(), s_id);
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
Add Comment
Please, Sign In to add comment