示例#1
0
文件: Checker.cs 项目: JastAir/Kinect
        /// <summary>
        /// Relative movement over a timespawn
        /// Low tolerance, but movement has to be constant
        /// </summary>
        /// <param name="steady">The reference joint</param>
        /// <param name="moving">The joint to get the direction from</param>
        /// <param name="duration">Timespawn in frames</param>
        /// <returns>Enumerable of the directions</returns>
        public IEnumerable <Direction> GetSteadyRelativeMovement(JointType steady, JointType moving, int duration)
        {
            List <SkeletonPoint> from = new List <SkeletonPoint>(), to = new List <SkeletonPoint>();

            if (duration < 1)
            {
                throw new ArgumentException("Duration must be at least 1");
            }
            for (int i = 0; i < duration && HasSkeleton(i); i++)
            {
                to.Add(SkeletonMath.SubstractPoints(person.GetLastSkeleton(i).GetPosition(moving), person.GetLastSkeleton(i).GetPosition(steady)));
                from.Add(SkeletonMath.SubstractPoints(person.GetLastSkeleton(i + 1).GetPosition(moving), person.GetLastSkeleton(i + 1).GetPosition(steady)));
            }
            return(SkeletonMath.SteadyDirectionTo(from, to));
        }
示例#2
0
文件: Checker.cs 项目: JastAir/Kinect
        /// <summary>
        /// The relative position over a timespawn
        /// Low tolerance, but the position has to be constant
        /// </summary>
        /// <param name="from">Source of the direction</param>
        /// <param name="to">target of the direction</param>
        /// <param name="duration">Timespawn in frames</param>
        /// <returns>Enumerable of the directions</returns>
        public IEnumerable <Direction> GetSteadyPosition(JointType from, JointType to, int duration)
        {
            List <SkeletonPoint> origin = new List <SkeletonPoint>(), target = new List <SkeletonPoint>();

            if (duration < 0)
            {
                throw new ArgumentException("Duration must be at least 1");
            }
            for (int i = 0; i <= duration && HasSkeleton(i); i++)
            {
                target.Add(person.GetLastSkeleton(i).GetPosition(to));
                origin.Add(person.GetLastSkeleton(i).GetPosition(from));
            }
            return(SkeletonMath.SteadyDirectionTo(origin, target));
        }
示例#3
0
文件: Checker.cs 项目: JastAir/Kinect
        /// <summary>
        /// Direction of a joint over a span of frames
        /// Low tolerance, but movement has to be constant
        /// </summary>
        /// <param name="type">the joint</param>
        /// <param name="duration">number of frames</param>
        /// <returns>Enumerable of the directions</returns>
        public IEnumerable <Direction> GetSteadyAbsoluteMovement(JointType type, int duration)
        {
            List <SkeletonPoint> from = new List <SkeletonPoint>(), to = new List <SkeletonPoint>();

            if (duration < 1)
            {
                throw new ArgumentException("Duration must be at least 1");
            }
            for (int i = 0; i < duration && HasSkeleton(i); i++)
            {
                to.Add(person.GetLastSkeleton(i).GetPosition(type));
                from.Add(person.GetLastSkeleton(i + 1).GetPosition(type));
            }
            return(SkeletonMath.SteadyDirectionTo(from, to));
        }