public double getProtrudingDistance(Skeleton skeleton, ExerciseVariant exerciseVariant) { Joint handJoint = GetGloveJoint(skeleton, exerciseVariant); Joint shoulderJoint = GetShoulderJoint(skeleton, exerciseVariant); double protrudingLength = Math.Abs(MathsHelper.DistanceBetweenPoints(shoulderJoint, handJoint, Axis.X, Axis.Z)); return(protrudingLength); }
static public double getPlayerRotationAngle(Skeleton skeleton, ExerciseVariant exerciseVariant) { Joint ShoulderLeft = skeleton.Joints[JointType.ShoulderLeft]; Joint ShoulderRight = skeleton.Joints[JointType.ShoulderRight]; double hypotenuseLength = Math.Abs(MathsHelper.DistanceBetweenPoints(ShoulderLeft, ShoulderRight, Axis.X, Axis.Z)); double oppositeSideLength = MathsHelper.DistanceBetweenPoints(ShoulderLeft, ShoulderRight, Axis.Z); double playerRotationAngle = Math.Asin(oppositeSideLength / hypotenuseLength);// / Math.PI * 180; return(playerRotationAngle); }
public double getLiftDistance(Skeleton skeleton, ExerciseVariant exercisevarinat) { Joint firstPoint, secondPoint; switch (exercisevarinat) { case ExerciseVariant.HandLeft: firstPoint = skeleton.Joints[JointType.ShoulderLeft]; secondPoint = skeleton.Joints[JointType.WristLeft]; break; case ExerciseVariant.HandRight: default: firstPoint = skeleton.Joints[JointType.ShoulderRight]; secondPoint = skeleton.Joints[JointType.WristRight]; break; } return(MathsHelper.DistanceBetweenPoints(firstPoint, secondPoint, Axis.Y)); }