TouchEvent.cs 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using bbiwarg.Detectors.Fingers;
  7. namespace bbiwarg.Detectors.Touch
  8. {
  9. class TouchEvent
  10. {
  11. private int x;
  12. private int y;
  13. private float touchValue;
  14. private Finger finger;
  15. public TouchEvent(int x, int y, float touchValue, Finger finger) {
  16. this.x = x;
  17. this.y = y;
  18. this.touchValue = touchValue;
  19. this.finger = finger;
  20. }
  21. public int getX() {
  22. return x;
  23. }
  24. public int getY() {
  25. return y;
  26. }
  27. public float getTouchValue() {
  28. return touchValue;
  29. }
  30. public float getDistanceTo(TouchEvent te) {
  31. int xDiff = x - te.getX();
  32. int yDiff = y - te.getY();
  33. float distance = (float)Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
  34. return distance;
  35. }
  36. }
  37. }