/// <summary> /// Tos the vec4. /// </summary> /// <returns>The vec4.</returns> /// <param name="v">V.</param> private static Vector4 ToVec4(KinectV1::Microsoft.Kinect.Vector4 v) { return new Vector4(v.X, v.Y, v.Z, v.W); }
/// <summary> /// Creates the skeleton. /// </summary> /// <returns>The skeleton.</returns> /// <param name="initSkeleton">Init skeleton.</param> private ISkeleton CreateSkeleton(KinectV1::Microsoft.Kinect.Skeleton initSkeleton) { var s = new InMapSkeleton { ID = (uint)initSkeleton.TrackingId }; foreach (var jointMapping in mapping) { var joint = new OrientedJoint { JointType = jointMapping.Key, Point = ToVec3(initSkeleton.Joints[jointMapping.Value].Position), Orientation = ToVec4(initSkeleton.BoneOrientations[jointMapping.Value].AbsoluteRotation.Quaternion), Valid = initSkeleton.Joints[jointMapping.Value].TrackingState == JointTrackingState.Tracked }; s.UpdateSkeleton(joint.JointType, joint); } // TODO: iterate over all data in array s.Valid = initSkeleton.TrackingState == SkeletonTrackingState.Tracked; return s; }