public static Matrix4 GetBoneMatrixByBvhName(Skeleton skeleton, HierarchyNode node) { //Итого 20 костей + 1 для поворота рутового креста: 20*3 + 3 = 63 угла + 3 декартовы координаты для положения рутового креса /* Правила для левой ноги * 0. bvh:Hips(рутовый крест) == kineck: (0,0,0) * 1. bhv: LeftCross-LeftHips(половина нижней части таза) == kinect: HipCenter-HipRight * 2. bvh:LeftHip-LeftKnee(Тазовая кость) == kinect:HipRight-KneeRight * 3. bvh:LeftKnee-LeftAnkle(Голень) == kinect:KneeRight-AnkleRight * 4. bvh:LeftAnkle-EndSite(ступня) == kinect:AnkleRight-FootRight * * Правила для правой ноги * 5. bvh:RightCross-RightHips(половина нижней части таза) == kinect: HipCenter-HipLeft * 6. bvh:RightHip-RightKnee(Тазовая кость) == kinect:HipLeft-KneeLeft * 7. bvh:RightKnee-RighAnkle(Голень) == kinect:KneeLeft-AnkleLeft * 8. bvh:RightAnkle-EndSite(ступня) == kinect:AnkleLeft-FootLeft * * Корпус * 9. bvh:UpCross-Chest(верхняя часть таза) == kinect:HipCenter-Spine * 10. bvh:Chest(спина) == kinect:Spine-ShoulderCenter * * Правила для левой руки * 11. bvh:LeftCollar-LeftShoulder(лева ключица) == kineck:ShoulderCenter-ShoulderRight * 12. bvh:LeftShoulder-LeftElbow(Трицепс) == kinect:ShoulderRight-ElbowRight * 13. bvh:LeftElbow-LeftWrist(Предплечье) == kinect:ElbowRight-WristRight * 14. bvh:LeftWrist-EndSite(Кисть) == kinect: WristRight-HandRight * * Правила для правой руки * 15. bvh:RightCollar-RightShoulder(лева ключица) == kineck:ShoulderCenter-ShoulderLeft * 16. bvh:RightShoulder-RightElbow(Трицепс) == kinect:ShoulderLeft-ElbowLeft * 17. bvh:RightElbow-RighttWrist(Предплечье) == kinect:ElbowLeft-WristLeft * 18.bvh:RightWrist-EndSite(Кисть) == kinect: WristLeft-HandLeft * * * Правила для Шея и голова * 19. bvh:Neck-Head(шея) == kinect:ShoulderCenter-Head * 20. bhv:Head-EndSite(верхняя часть головы) == kinect: (x,y,z)=(0,0,0) */ //0 //if (node.GetTypeNode() == ConstBodyPoints.Hips) // return GetZeroBoneOrientation(JointType.HipCenter); if (node.GetTypeNode() == ConstBodyPoints.Hips) //return GetHipBoneOrientation(skeleton.Joints).HierarchicalRotation.Matrix; return FindBone(JointType.HipCenter, JointType.HipCenter, skeleton.BoneOrientations).AbsoluteRotation.Matrix; //1 if (node.GetTypeNode() == ConstBodyPoints.LeftCross) return FindBone(JointType.HipCenter, JointType.HipLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //2 if (node.GetTypeNode() == ConstBodyPoints.LeftHip) { return FindBone(JointType.HipLeft, JointType.KneeLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //var mat = FindBone(JointType.HipRight, JointType.KneeRight, skeleton.BoneOrientations).AbsoluteRotation.Matrix; //mat.M32 += (float)0.463; //return mat; } //3 if (node.GetTypeNode() == ConstBodyPoints.LeftKnee) return FindBone(JointType.KneeLeft, JointType.AnkleLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //4 if (node.GetTypeNode() == ConstBodyPoints.LeftAnkle) return FindBone(JointType.AnkleLeft, JointType.FootLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //5 if (node.GetTypeNode() == ConstBodyPoints.RightCross) return FindBone(JointType.HipCenter, JointType.HipRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //6 if (node.GetTypeNode() == ConstBodyPoints.RightHip) { return FindBone(JointType.HipRight, JointType.KneeRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //var mat = FindBone(JointType.HipLeft, JointType.KneeLeft, skeleton.BoneOrientations).AbsoluteRotation.Matrix; //mat.M32 += (float)0.416; //return mat; } //7 if (node.GetTypeNode() == ConstBodyPoints.RightKnee) return FindBone(JointType.KneeRight, JointType.AnkleRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //8 if (node.GetTypeNode() == ConstBodyPoints.RightAnkle) return FindBone(JointType.AnkleRight, JointType.FootRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //9 if (node.GetTypeNode() == ConstBodyPoints.UpCross) return FindBone(JointType.HipCenter, JointType.Spine, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //10 if (node.GetTypeNode() == ConstBodyPoints.Chest) return FindBone(JointType.Spine, JointType.ShoulderCenter, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //11 if (node.GetTypeNode() == ConstBodyPoints.LeftCollar) return FindBone(JointType.ShoulderCenter, JointType.ShoulderLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //12 if (node.GetTypeNode() == ConstBodyPoints.LeftShoulder) return FindBone(JointType.ShoulderLeft, JointType.ElbowLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //13 if (node.GetTypeNode() == ConstBodyPoints.LeftElbow) return FindBone(JointType.ElbowLeft, JointType.WristLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //14 if (node.GetTypeNode() == ConstBodyPoints.LeftWrist) return FindBone(JointType.WristLeft, JointType.HandLeft, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //15 if (node.GetTypeNode() == ConstBodyPoints.RightCollar) return FindBone(JointType.ShoulderCenter, JointType.ShoulderRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //16 if (node.GetTypeNode() == ConstBodyPoints.RightShoulder) return FindBone(JointType.ShoulderRight, JointType.ElbowRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //17 if (node.GetTypeNode() == ConstBodyPoints.RightElbow) return FindBone(JointType.ElbowRight, JointType.WristRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //18 if (node.GetTypeNode() == ConstBodyPoints.RightWrist) return FindBone(JointType.WristRight, JointType.HandRight, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //19 if (node.GetTypeNode() == ConstBodyPoints.Neck) return FindBone(JointType.ShoulderCenter, JointType.Head, skeleton.BoneOrientations).HierarchicalRotation.Matrix; //20 if (node.GetTypeNode() == ConstBodyPoints.Head) return GetZeroBoneOrientation(JointType.ShoulderCenter).HierarchicalRotation.Matrix; throw new Exception("Кость " + node.GetTypeNode() + " не определена"); }