using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using bbiwarg.Images;
using bbiwarg.Utility;
using bbiwarg.Output;
using bbiwarg.Recognition.HandRecognition;
using bbiwarg.Recognition.TouchRecognition;
using bbiwarg.Recognition.Tracking;
using Emgu.CV;

namespace bbiwarg.Recognition.FingerRecognition
{
    public class Finger : TrackableObject
    {
        public Vector2D TipPoint { get { return SliceTrail.StartSlice.Mid; } }
        public Vector2D HandPoint { get { return SliceTrail.EndSlice.Mid; } }
        public Vector2D MidPoint { get { return SliceTrail.MidSlice.Mid; } }
        public Vector2D Direction { get { return SliceTrail.FittedDirection; } }
        public LineSegment2D LineSegment { get { return SliceTrail.LineSegment; } }
        public FingerSliceTrail SliceTrail { get; private set; }
        public Hand Hand { get; set; }
        public Touch Touch { get; set; }

        public Finger(FingerSliceTrail sliceTrail)
            : base()
        {
            SliceTrail = sliceTrail;
        }

        public void reverse() {
            SliceTrail.reverse();
        }

        public Contour<Point> getContour(float margin) {
            return SliceTrail.getContour(margin);
        }
    }
}
