コード例 #1
0
 private static void SumWithFatherPosition(
     Dictionary <Microsoft.Kinect.JointType, Vector3D> jointVectors,
     List <PreposeGestures.JointType> targetCalculatedJoints,
     Microsoft.Kinect.JointType jointType)
 {
     if (targetCalculatedJoints.Contains((PreposeGestures.JointType)jointType))
     {
         jointVectors[jointType] +=
             jointVectors[(Microsoft.Kinect.JointType)JointTypeHelper.GetFather((PreposeGestures.JointType)jointType)];
     }
 }
コード例 #2
0
ファイル: Z3Body.cs プロジェクト: matheusberger/prepose
        //public Dictionary<JointType, double> GrabDistances(Z3Body that, List<JointType> joints)
        //{
        //    var distanceExprs = this.GrabDistancePoint3Ds(that, joints);
        //    var result = new Dictionary<JointType, double>();
        //    foreach (var jointType in joints)
        //        result.Add(jointType, Z3Math.GetRealValue(distanceExprs[jointType]));

        //    return result;
        //}

        //public List<JointType> GetList

        public Z3Point3D GetJointZ3Position(JointType jointType)
        {
            Z3Point3D result           = new Z3Point3D(0, 0, 0);
            JointType currentJointType = jointType;

            // SpineBase is the root of the coordinate system
            while (currentJointType != JointType.SpineBase)
            {
                result           = result + (this.Joints[currentJointType] * this.Norms[currentJointType]);
                currentJointType = JointTypeHelper.GetFather(currentJointType);
            }

            return(result);
        }
コード例 #3
0
        private static void AddZ3JointToVectors3D(
            Z3Body targetBody,
            IReadOnlyDictionary <Microsoft.Kinect.JointType, Microsoft.Kinect.Joint> baseJoints,
            Dictionary <Microsoft.Kinect.JointType, Vector3D> jointVectors,
            PreposeGestures.JointType jointType)
        {
            var vector3D = new Vector3D(
                targetBody.Joints[jointType].GetXValue(),
                targetBody.Joints[jointType].GetYValue(),
                -targetBody.Joints[jointType].GetZValue());

            //var norm = Z3Math.GetRealValue(targetBody.Norms[jointType]);
            var norm =
                new Vector3D(
                    baseJoints[(Microsoft.Kinect.JointType)jointType].Position.X - baseJoints[(Microsoft.Kinect.JointType)JointTypeHelper.GetFather(jointType)].Position.X,
                    baseJoints[(Microsoft.Kinect.JointType)jointType].Position.Y - baseJoints[(Microsoft.Kinect.JointType)JointTypeHelper.GetFather(jointType)].Position.Y,
                    baseJoints[(Microsoft.Kinect.JointType)jointType].Position.Z - baseJoints[(Microsoft.Kinect.JointType)JointTypeHelper.GetFather(jointType)].Position.Z).Length;

            vector3D = vector3D * norm;

            jointVectors.Add((Microsoft.Kinect.JointType)jointType, vector3D);
        }