Exemplo n.º 1
0
        /// <summary>
        /// 在連續的 frames 中,從 frames[begin] 開始,找出指定的 pointable 之 tracjection
        /// </summary>
        /// <param name="frames">連續的 frames</param>
        /// <param name="begin">開始 index</param>
        /// <param name="pointable">指定的 pointable</param>
        /// <returns></returns>
        private MTrajection <Pointable> ExtractPointableTrajection(List <Frame> frames, int begin, Pointable pointable)
        {
            MTrajection <Pointable> result = new MTrajection <Pointable>();

            result.Begin    = begin;
            result.Elements = new List <Pointable>();
            for (int i = begin; i < frames.Count; i++)
            {
                Pointable p = frames[i].Pointable(pointable.Id);
                if (i == begin && p != null && p != pointable)
                {
                    Console.WriteLine(String.Format("from frame[{0}] at frame[{1}] error", begin, i));
                }
                if (p == null ||
                    p.IsTraveled == true)
                {
                    break;
                }
                p.IsTraveled = true;
                result.Elements.Add(p);
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 在連續的 frames 中,從 frames[begin] 開始,找出指定的 hand 之 tracjection
        /// </summary>
        /// <param name="frames"></param>
        /// <param name="begin"></param>
        /// <param name="hand"></param>
        /// <returns></returns>
        private MTrajection <Hand> ExtractHandTrajection(List <Frame> frames, int begin, Hand hand)
        {
            MTrajection <Hand> result = new MTrajection <Hand>();

            result.Begin    = begin;
            result.Elements = new List <Hand>();
            for (int i = begin; i < frames.Count; i++)
            {
                Hand h = frames[i].Hand(hand.Id);
                if (i == begin && h != null && h != hand)
                {
                    Console.WriteLine(String.Format("hand from frame[{0}] at frame[{1}] error", begin, i));
                }
                if (h == null ||
                    h.IsTraveled == true)
                {
                    break;
                }
                h.IsTraveled = true;
                result.Elements.Add(h);
            }
            return(result);
        }