FingerSlice.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using bbiwarg.Utility;
  7. namespace bbiwarg.Recognition.FingerRecognition
  8. {
  9. /// <summary>
  10. /// A Finger consists of multiple FingerSlices, each one represented by a line preferrably orthogonal to the fingers direction.
  11. /// </summary>
  12. public class FingerSlice
  13. {
  14. /// <summary>
  15. /// the point in the middle of the slice
  16. /// </summary>
  17. public Vector2D Mid { get; private set; }
  18. /// <summary>
  19. /// the start point of the slice
  20. /// </summary>
  21. public Vector2D Start { get; private set; }
  22. /// <summary>
  23. /// the end point of the slice
  24. /// </summary>
  25. public Vector2D End { get; private set; }
  26. /// <summary>
  27. /// the line segment connecting start and end
  28. /// </summary>
  29. public LineSegment2D LineSegment { get; private set; }
  30. /// <summary>
  31. /// the direction of the slice
  32. /// </summary>
  33. public Vector2D Direction { get { return LineSegment.Direction; } }
  34. /// <summary>
  35. /// the length of the slice (in pixels)
  36. /// </summary>
  37. public float Length { get { return LineSegment.Length; } }
  38. /// <summary>
  39. /// Initializes a new instance of the FingerSlice class.
  40. /// </summary>
  41. /// <param name="start">The start point</param>
  42. /// <param name="end">The end point</param>
  43. public FingerSlice(Vector2D start, Vector2D end)
  44. {
  45. Start = start;
  46. End = end;
  47. Mid = (start + end) / 2;
  48. LineSegment = new LineSegment2D(Start, End);
  49. }
  50. }
  51. }