Пример #1
0
        public void Remove(Pointable pointable)
        {
            Pointables.Remove(pointable);
            Finger f = pointable as Finger;

            if (f != null)
            {
                Fingers.Remove(f);
            }
            else
            {
                Tools.Remove(pointable as Tool);
            }
        }
        public Pointable(Pointable pointable, Frame frame, Hand hand)
        {
            IsTraveled = false;

            this.Frame                 = frame;
            this.Hand                  = hand;
            this.Id                    = pointable.Id;
            this.IsFinger              = pointable.IsFinger;
            this.IsTool                = pointable.IsTool;
            this.IsValid               = pointable.IsValid;
            this.Length                = pointable.Length;
            this.Width                 = pointable.Width;
            this.TimeVisible           = pointable.TimeVisible;
            this.TipPosition           = new Vector(pointable.TipPosition);
            this.TipVelocity           = new Vector(pointable.TipVelocity);
            this.StabilizedTipPosition = new Vector(pointable.StabilizedTipPosition);
            this.Direction             = new Vector(pointable.Direction);
            this.IsExtended            = pointable.IsExtended;
        }
Пример #3
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);
        }