当前位置: 首页>>代码示例>>C#>>正文


C# HierarchyNode.GetTypeNode方法代码示例

本文整理汇总了C#中HierarchyNode.GetTypeNode方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.GetTypeNode方法的具体用法?C# HierarchyNode.GetTypeNode怎么用?C# HierarchyNode.GetTypeNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HierarchyNode的用法示例。


在下文中一共展示了HierarchyNode.GetTypeNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBoneMatrixByBvhName

        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;

//.........这里部分代码省略.........
开发者ID:scherbinin,项目名称:Kinect,代码行数:101,代码来源:BoneMapperBvhToKinect.cs


注:本文中的HierarchyNode.GetTypeNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。