/// <summary> /// Relative position to the shoulder center joint in world coordinates. /// </summary> /// <param name="rect"></param> /// <param name="depthData"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="skeleton"></param> /// <param name="mapper"></param> /// <returns></returns> public static Vector3D RelativePosToShoulder(SkeletonPoint point, Skeleton skeleton) { var shoulderCenterJoint = SkeletonUtil.GetJoint(skeleton, JointType.ShoulderCenter); var relPos = SkeletonUtil.Sub(point, shoulderCenterJoint.Position); return(relPos); }
public static Vector3D PointDirection(SkeletonPoint hand, SkeletonPoint elbow) { var dir = SkeletonUtil.Sub(hand, elbow); var angle = new Vector3D(); // Angle in radians, between -pi and pi. angle.X = Math.Atan2(dir.X, dir.Z); angle.Y = Math.Atan2(dir.Y, dir.Z); return(angle); }