< Summary - ReFlex - Library

Information
Class: ReFlex.Server.Data.Config.SmoothingParameter
Assembly: ReFlex.Server.Data
File(s): D:\a\reflex\reflex\library\src\Server\Data\Config\SmoothingParameter.cs
Line coverage
47%
Covered lines: 18
Uncovered lines: 20
Coverable lines: 38
Total lines: 80
Line coverage: 47.3%
Branch coverage
55%
Covered branches: 10
Total branches: 18
Branch coverage: 55.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

D:\a\reflex\reflex\library\src\Server\Data\Config\SmoothingParameter.cs

#LineLine coverage
 1using ReFlex.Core.Interactivity.Util;
 2
 3namespace ReFlex.Server.Data.Config
 4{
 5    public struct SmoothingParameter
 6    {
 547        public int InteractionHistorySize { get; set; }
 8
 549        public int NumSmoothingSamples { get; set; }
 10
 11        private double? _contactRetentionSeconds;
 12        private double? _legacyRetentionSeconds;
 13
 14        /// <summary>Retention after a completed observation no longer detects a contact.</summary>
 15        public double ContactRetentionSeconds
 16        {
 6217            get => _contactRetentionSeconds ?? _legacyRetentionSeconds ?? .1;
 3018            set => _contactRetentionSeconds = double.IsFinite(value) && value >= 0 ? value :
 3019                throw new ArgumentOutOfRangeException(nameof(value));
 20        }
 21
 22        private double? _observationTimeoutSeconds;
 23        /// <summary>Maximum sensor/processing silence and acceptable observation age. Separate from missing-contact ret
 24        public double ObservationTimeoutSeconds
 25        {
 3226            get => _observationTimeoutSeconds ?? 1;
 2227            set => _observationTimeoutSeconds = double.IsFinite(value) && value >= 0 ? value :
 2228                throw new ArgumentOutOfRangeException(nameof(value));
 29        }
 30
 31        /// <summary>Deserialization-only migration of legacy configuration, assuming 30 Hz.
 32        /// Explicit seconds take precedence regardless of JSON property order. Never serialized.</summary>
 1633        public int MaxNumEmptyFramesBetween { set => _legacyRetentionSeconds = Math.Max(0, value) / 30.0; }
 34
 35        private float? _confidenceGainPerSecond;
 36        private float? _confidenceDecayPerSecond;
 37        public float ConfidenceGainPerSecond
 38        {
 4239            get => _confidenceGainPerSecond ?? 30;
 2240            set => _confidenceGainPerSecond = float.IsFinite(value) && value >= 0 ? value :
 2241                throw new ArgumentOutOfRangeException(nameof(value));
 42        }
 43        public float ConfidenceDecayPerSecond
 44        {
 4245            get => _confidenceDecayPerSecond ?? 30;
 2246            set => _confidenceDecayPerSecond = float.IsFinite(value) && value >= 0 ? value :
 2247                throw new ArgumentOutOfRangeException(nameof(value));
 48        }
 49
 5450        public float TouchMergeDistance2D { get; set; }
 51
 5452        public float DepthScale { get; set; }
 53
 5454        public FilterType Type { get; set; }
 55
 56        public SmoothingParameter(int historySize = 0, int numSmoothing = 0, float distance2D = 64f, double contactReten
 057        {
 058            this = default;
 059            InteractionHistorySize = historySize;
 060            NumSmoothingSamples = numSmoothing;
 061            TouchMergeDistance2D = distance2D;
 062            ContactRetentionSeconds = contactRetentionSeconds;
 063            Type = type;
 064            DepthScale = depthScale;
 065        }
 66
 67        public string GetSmoothingSettingsString()
 068        {
 069            var result = $"=====  {nameof(SmoothingParameter)}  ====={Environment.NewLine}";
 070            result += $"  {nameof(InteractionHistorySize)}: {InteractionHistorySize} | ";
 071            result += $"  {nameof(NumSmoothingSamples)}: {NumSmoothingSamples} | ";
 072            result += $"  {nameof(TouchMergeDistance2D)}: {TouchMergeDistance2D} | ";
 073            result += $"  {nameof(ContactRetentionSeconds)}: {ContactRetentionSeconds} | ";
 074            result += $"  {nameof(ObservationTimeoutSeconds)}: {ObservationTimeoutSeconds} | ";
 075            result += $"  {nameof(DepthScale)}: {DepthScale} | ";
 076            result += $"  {nameof(Type)}: {Type}{Environment.NewLine}";
 077            return result;
 078        }
 79    }
 80}