using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using bbiwarg.Detectors.Fingers;
using bbiwarg.Detectors.Palm;
using bbiwarg.Utility;

namespace bbiwarg.Detectors.Touch
{
    class PalmTouchDetector
    {
        public List<PalmTouchEvent> PalmTouchEvents { get; private set; }

        public PalmTouchDetector(List<TouchEvent> touchEvents, Quadrangle palmQuad)
        {
            PalmTouchEvents = new List<PalmTouchEvent>();

            foreach (TouchEvent touchEvent in touchEvents)
            {
                Vector2D relativePos = palmQuad.getRelativePosition(touchEvent.Position);
                if (relativePos.X >= 0 && relativePos.X <= 1.0 && relativePos.Y >= 0 && relativePos.Y <= 1.0)
                {
                    PalmTouchEvent pte = new PalmTouchEvent(touchEvent.Position, relativePos, touchEvent.FloodValue, touchEvent.Finger);
                    PalmTouchEvents.Add(pte);
                }
            }

        }
    }
}
