コード例 #1
0
        /// <summary>
        /// Returns the current value of the feature. If the hand joints are not populated with
        /// valid data (for instance, due to a disconnected hand), the method will return null;
        /// </summary>
        public float?GetFeatureValue(TransformConfig config,
                                     TransformFeature transformFeature)
        {
            if (!IsHandDataValid())
            {
                return(null);
            }

            return(TransformFeatureValueProvider.GetValue(transformFeature,
                                                          _jointData, config));
        }
コード例 #2
0
        public void RegisterConfig(TransformConfig transformConfig, TransformJointData jointData,
                                   Func <float> timeProvider)
        {
            bool containsKeyAlready = _idToTransformStateInfo.ContainsKey(transformConfig.InstanceId);

            Assert.IsFalse(containsKeyAlready,
                           "Trying to register multiple configs with the same id into " +
                           "TransformFeatureStateCollection.");

            var featureStateProvider = new FeatureStateProvider <TransformFeature, string>
                                       // note that jointData and transformConfig are reference types (classes), because they can change
                                       // during run time
                                           ((feature) => TransformFeatureValueProvider.GetValue(feature, jointData, transformConfig),
                                           feature => (int)feature,
                                           timeProvider);
            TransformStateInfo newTransfState = new TransformStateInfo(transformConfig, featureStateProvider);

            featureStateProvider.InitializeThresholds(transformConfig.FeatureThresholds);
            _idToTransformStateInfo.Add(transformConfig.InstanceId, newTransfState);
        }