Ejemplo n.º 1
0
 /// <summary>
 /// Median of the distance between two points
 /// Median over 3
 /// </summary>
 /// <param name="t1">Joint 1</param>
 /// <param name="t2">Joint 2</param>
 /// <returns>Distance in Meters</returns>
 public double GetDistanceMedian(JointType t1, JointType t2)
 {
     if (!HasSkeleton(2))
     {
         return(GetDistance(t1, t2));
     }
     return(SkeletonMath.Median(GetDistance(t1, t2), GetDistance(t1, t2, 1), GetDistance(t1, t2, 2)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get a joints absolute velocity. If theres not enough skeleton information,
 /// precision is decreased automatically.</summary>
 /// <param name="type">
 /// The JointType to get velocity from.</param>
 /// <returns>
 /// Returns the absolute velocity in meters</returns>
 public double GetAbsoluteVelocity(JointType type)
 {
     if (!HasSkeleton(1))
     {
         return(0);
     }
     if (!HasSkeleton(3))
     {
         return(SimpleAbsoluteVelocity(type, 0, 1));
     }
     return(SkeletonMath.Median(SimpleAbsoluteVelocity(type, 0, 1), SimpleAbsoluteVelocity(type, 1, 2), SimpleAbsoluteVelocity(type, 2, 3)));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the relative velocity of a joint referencing to a second one.</summary>
        /// <param name="steady">
        /// The referenctial JointType.</param>
        /// <param name="moving">
        /// The moving JointType of interest</param>
        /// <returns>
        /// Returns the relative velocity in meters</returns>
        public double GetRelativeVelocity(JointType steady, JointType moving)
        {
            if (!HasSkeleton(1))
            {
                return(0);
            }
            SkeletonPoint d0 = SubstractedPointsAt(steady, moving, 0);
            SkeletonPoint d1 = SubstractedPointsAt(steady, moving, 1);

            if (!HasSkeleton(3))
            {
                return(SkeletonMath.DistanceBetweenPoints(d0, d1) * 1000.0 / person.MillisBetweenFrames(1, 0));
            }
            SkeletonPoint d2 = SubstractedPointsAt(steady, moving, 2);
            SkeletonPoint d3 = SubstractedPointsAt(steady, moving, 3);

            return(SkeletonMath.Median(
                       SkeletonMath.DistanceBetweenPoints(d0, d1) * 1000.0 / person.MillisBetweenFrames(1, 0),
                       SkeletonMath.DistanceBetweenPoints(d1, d2) * 1000.0 / person.MillisBetweenFrames(2, 1),
                       SkeletonMath.DistanceBetweenPoints(d2, d3) * 1000.0 / person.MillisBetweenFrames(3, 2)
                       ));
        }