Beispiel #1
0
 private SkeletonPoint SubstractedPointsAt(JointType steady, JointType moving, int time)
 {
     if (!HasSkeleton(time))
     {
         throw new ArgumentException("No Skeleton at this Index");
     }
     return(SkeletonMath.SubstractPoints(person.GetLastSkeleton(time).GetPosition(moving), person.GetLastSkeleton(time).GetPosition(steady)));
 }
Beispiel #2
0
 /// <summary>
 /// The actual direction of movement to a relative point
 /// </summary>
 /// <param name="steady">The reference joint</param>
 /// <param name="moving">The joint for the direction</param>
 /// <returns>Enumerable of the directions</returns>
 public IEnumerable <Direction> GetRelativeMovement(JointType steady, JointType moving)
 {
     if (!HasSkeleton(1))
     {
         return(new List <Direction> {
             Direction.None
         });
     }
     return(SkeletonMath.DirectionTo(SkeletonMath.SubstractPoints(person.GetLastSkeleton(1).GetPosition(moving), person.GetLastSkeleton(1).GetPosition(steady)),
                                     SkeletonMath.SubstractPoints(person.CurrentSkeleton.GetPosition(moving), person.CurrentSkeleton.GetPosition(steady))));
 }
Beispiel #3
0
        /// <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));
        }