< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Interactivity.Components.InteractionObserverBase
Assembly: ReFlex.Core.Interactivity
File(s): D:\a\reflex\reflex\library\src\Core\Interactivity\Components\InteractionObserverBase.cs
Line coverage
83%
Covered lines: 282
Uncovered lines: 57
Coverable lines: 339
Total lines: 626
Line coverage: 83.1%
Branch coverage
78%
Covered branches: 104
Total branches: 133
Branch coverage: 78.1%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_Distance()100%11100%
get_MinDistance()100%11100%
get_MaxDistance()100%11100%
get_ExtremumTypeCheckNumSamples()100%11100%
set_ExtremumTypeCheckNumSamples(...)100%2283.33%
get_ExtremumTypeCheckRadius()100%11100%
set_ExtremumTypeCheckRadius(...)100%2283.33%
get_ExtremumTypeCheckFittingPercentage()100%11100%
get_ExtremumTypeCheckMethod()100%11100%
get_InteractionHistorySize()100%11100%
set_InteractionHistorySize(...)100%22100%
get_NumSmoothingFrames()100%210%
set_NumSmoothingFrames(...)100%44100%
get_MaxNumEmptyFramesBetween()100%210%
set_MaxNumEmptyFramesBetween(...)100%44100%
get_TouchMergeDistance2D()100%210%
set_TouchMergeDistance2D(...)100%22100%
get_DepthScale()100%210%
set_DepthScale(...)100%22100%
get_FilterType()100%210%
set_FilterType(...)100%22100%
get_MinAngle()100%11100%
get_MinConfidence()100%11100%
get_MaxConfidence()100%11100%
set_MaxConfidence(...)100%22100%
get_MeasurePerformance()100%11100%
get_FrameId()100%11100%
UpdateFrameId(...)100%210%
ReportPerformance(...)100%210%
CheckInitialState()100%210%
Update()100%2020100%
SelectSmoothedInteractions(...)100%11100%
ComputeSmoothingValue(...)100%22100%
ComputeExtremumType(...)77.14%443580.7%
ConvertDepthValue(...)85%212086.66%
ApplyConfidenceFilter(...)100%11100%
ComputeExtremumType(...)100%11100%
RemoveExtremumsBetweenTouches(...)80%1010100%
UpdatePerformanceMetrics(...)100%22100%
UpdateInteractionFrames(...)0%4260%
OnNewInteractions(...)100%22100%
CalculateAverageDistance()0%110100%
GetSample(...)100%11100%
GenerateSamples()100%22100%
UpdateSamples()100%22100%

File(s)

D:\a\reflex\reflex\library\src\Core\Interactivity\Components\InteractionObserverBase.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Diagnostics;
 4using System.Linq;
 5using System.Threading.Tasks;
 6using ReFlex.Core.Common.Components;
 7using ReFlex.Core.Common.Interfaces;
 8using ReFlex.Core.Common.Util;
 9using ReFlex.Core.Interactivity.Interfaces;
 10using ReFlex.Core.Interactivity.Util;
 11using Math = System.Math;
 12
 13namespace ReFlex.Core.Interactivity.Components
 14{
 15    public abstract class InteractionObserverBase : IInteractionObserver, IPerformanceReporter
 16    {
 17        #region Fields
 18
 4619        private readonly Stopwatch _stopWatch = new();
 20
 21        private readonly InteractionSmoothingBehaviour _smoothingBehaviour;
 4622        private int _numSmoothingFrames = 5;
 4623        private int _historySize = 25;
 4624        private int _maxNumEmptyFramesBetween = 3;
 4625        private float _touchMergeDistance2d = 64f;
 4626        private float _depthScale = 100.0f;
 27        private FilterType _filterType;
 28        private float _maxConfidence;
 29        private int _extremumTypeCheckRadius;
 30        private int _extremumTypeCheckNumSamples;
 31
 4632        private Tuple<int, int>[] _fixedSamples = Array.Empty<Tuple<int, int>>();
 4633        private Tuple<int, int>[] _stochasticSamples = Array.Empty<Tuple<int, int>>();
 34
 35        #endregion
 36
 37        #region Properties
 38
 39        /// <summary>
 40        /// Gets or sets the distance.
 41        /// </summary>
 42        /// <value>
 43        /// The distance.
 44        /// </value>
 23845        public float Distance { get; set; }
 46
 47        /// <summary>
 48        /// Gets or sets the minimum depth.
 49        /// </summary>
 50        /// <value>
 51        /// The maximum depth.
 52        /// </value>
 18053        public float MinDistance { get; set; }
 54
 55        /// <summary>
 56        /// Gets or sets the maximum depth.
 57        /// </summary>
 58        /// <value>
 59        /// The maximum depth.
 60        /// </value>
 8261        public float MaxDistance { get; set; }
 62
 63        /// <summary>
 64        /// defines how many points should be checked to determine the type of the extremum
 65        /// </summary>
 66        public int ExtremumTypeCheckNumSamples
 67        {
 108068            get => _extremumTypeCheckNumSamples;
 69            set
 3870            {
 3871                if (_extremumTypeCheckNumSamples == value)
 072                    return;
 3873                _extremumTypeCheckNumSamples = value;
 3874                UpdateSamples();
 3875            }
 76        }
 77
 78        /// <summary>
 79        /// The pixel radius in which the points are sampled for deriving the type of the local extremum
 80        /// </summary>
 81        public int ExtremumTypeCheckRadius
 82        {
 131283            get => _extremumTypeCheckRadius;
 84            set
 3885            {
 3886                if (_extremumTypeCheckRadius == value)
 087                    return;
 3888                _extremumTypeCheckRadius = value;
 3889                UpdateSamples();
 3890            }
 91        }
 92
 93        /// <summary>
 94        /// Which ratio of "correctly aligned" points should match to distinguish between Undefined or Minimum/Maximum ?
 95        /// </summary>
 8096        public float ExtremumTypeCheckFittingPercentage { get; set; }
 97
 98        /// <summary>
 99        /// Defines how neighboring the points are sampled for determining the type of extremum.
 100        /// </summary>
 134101        public ExtremumTypeCheckMethod ExtremumTypeCheckMethod { get; set; }
 102
 103        public int InteractionHistorySize
 104        {
 46105            get => _historySize;
 106            set
 36107            {
 36108                _historySize = value;
 36109                if (_smoothingBehaviour != null)
 36110                {
 36111                    _smoothingBehaviour.NumFramesHistory = value;
 112                    // update depending smoothing/filter values
 36113                    NumSmoothingFrames = _numSmoothingFrames;
 36114                    MaxNumEmptyFramesBetween = _maxNumEmptyFramesBetween;
 36115                }
 36116            }
 117        }
 118
 119        public int NumSmoothingFrames
 120        {
 0121            get => _numSmoothingFrames;
 122            set
 72123            {
 72124                _numSmoothingFrames = value;
 72125                if (_smoothingBehaviour != null)
 72126                    _smoothingBehaviour.NumFramesSmoothing = value < _smoothingBehaviour.NumFramesHistory
 72127                        ? _smoothingBehaviour.NumFramesHistory
 72128                        : value;
 72129            }
 130        }
 131
 132        // TODO: write tests for negative (!) values and values larger than history
 133        public int MaxNumEmptyFramesBetween
 134        {
 0135            get => _maxNumEmptyFramesBetween;
 136            set
 44137            {
 44138                _maxNumEmptyFramesBetween = value;
 44139                if (_smoothingBehaviour != null)
 44140                    _smoothingBehaviour.MaxNumEmptyFramesBetween = value < _smoothingBehaviour.NumFramesHistory
 44141                        ? _smoothingBehaviour.NumFramesHistory
 44142                        : value;
 44143            }
 144        }
 145
 146        public float TouchMergeDistance2D
 147        {
 0148            get => _touchMergeDistance2d;
 149            set
 36150            {
 36151                _touchMergeDistance2d = value;
 36152                if (_smoothingBehaviour != null)
 36153                    _smoothingBehaviour.TouchMergeDistance2D = value;
 36154            }
 155        }
 156
 157        public float DepthScale
 158        {
 0159            get => _depthScale;
 160            set
 8161            {
 8162                _depthScale = value;
 8163                if (_smoothingBehaviour != null)
 8164                    _smoothingBehaviour.DepthScale = value;
 8165            }
 166        }
 167
 168        public FilterType FilterType
 169        {
 0170            get => _filterType;
 171            set
 28172            {
 28173                _filterType = value;
 28174                if (_smoothingBehaviour != null)
 28175                    _smoothingBehaviour.UpdateFilterType(_filterType);
 28176            }
 177        }
 178
 179
 180        /// <summary>
 181        /// Gets or sets the minimum angle.
 182        /// </summary>
 183        /// <value>
 184        /// The minimum angle.
 185        /// </value>
 8186        public virtual float MinAngle { get; set; }
 187
 188        /// <summary>
 189        /// Gets or sets the minimum confidence.
 190        /// </summary>
 191        /// <value>
 192        /// The minimum confidence.
 193        /// </value>
 60194        public virtual float MinConfidence { get; set; }
 195
 196        /// <summary>
 197        /// Gets or sets the maximum confidence.
 198        /// </summary>
 199        /// <value>
 200        /// The maximum confidence.
 201        /// </value>
 202        public virtual float MaxConfidence
 203        {
 36204            get => _maxConfidence;
 205            set
 36206            {
 36207                _maxConfidence = value;
 36208                if (_smoothingBehaviour != null)
 36209                    _smoothingBehaviour.MaxConfidence = (int) MaxConfidence;
 36210            }
 211        }
 212
 260213        public bool MeasurePerformance { get; set; }
 214
 36215        protected int FrameId { get; private set; }
 216
 217        #region Abstract Members
 218
 219        public abstract ObserverType Type { get; }
 220        public abstract PointCloud3 PointCloud { get; set; }
 221        public abstract VectorField2 VectorField { get; set; }
 222
 223        public event EventHandler<IList<Interaction>> NewInteractions;
 224
 225        public event EventHandler<PerformanceDataItem> PerformanceDataUpdated;
 226
 227        public event EventHandler<IList<InteractionFrame>> InteractionHistoryUpdated;
 228
 229        #endregion
 230
 231        #region Constructor
 232
 46233        protected InteractionObserverBase()
 46234        {
 46235            _smoothingBehaviour = new InteractionSmoothingBehaviour(InteractionHistorySize);
 46236        }
 237
 238        #endregion
 239
 240        public void UpdateFrameId(int frameId)
 0241        {
 0242            FrameId = frameId;
 0243        }
 244
 245        #endregion
 246
 247        protected abstract Task<Tuple<IEnumerable<Interaction>, ProcessPerformance>> Analyze(ProcessPerformance performa
 248
 0249        protected virtual Task ReportPerformance(ProcessPerformance performance) => Task.CompletedTask;
 250
 251        protected virtual Task<ProcessingResult> CheckInitialState()
 0252        {
 0253          return Task.FromResult(new ProcessingResult(ProcessServiceStatus.Available));
 0254        }
 255
 256        public virtual async Task<ProcessingResult> Update()
 36257        {
 36258            var processResult = await CheckInitialState();
 259
 36260            if (processResult.ServiceStatus != ProcessServiceStatus.Available)
 12261            {
 12262              UpdatePerformanceMetrics(new ProcessPerformance(), DateTime.Now.Ticks);
 12263              return processResult;
 264            }
 265
 24266            var processingDateTime = DateTime.Now.Ticks;
 267
 24268            if (MeasurePerformance)
 2269            {
 2270              _stopWatch.Start();
 2271            }
 272
 24273            var processed = await Analyze(processResult.PerformanceMeasurement);
 274
 24275            var candidates = processed.Item1;
 24276            var perfItem = processed.Item2;
 277
 24278            if (MeasurePerformance)
 2279            {
 2280                _stopWatch.Stop();
 2281                perfItem.Update = _stopWatch.Elapsed - perfItem.Preparation;
 2282                _stopWatch.Reset();
 2283            }
 284
 24285            if (MeasurePerformance)
 2286            {
 2287                _stopWatch.Start();
 2288            }
 289
 24290            var interactions =  ConvertDepthValue(candidates.ToList());
 291
 24292            if (MeasurePerformance)
 2293            {
 2294                _stopWatch.Stop();
 2295                perfItem.ConvertDepthValue = _stopWatch.Elapsed;
 2296                _stopWatch.Reset();
 2297            }
 298
 24299            if (MeasurePerformance)
 2300            {
 2301              _stopWatch.Start();
 2302            }
 303
 24304            var processedInteractions = ComputeExtremumType(interactions, PointCloud.AsJaggedArray());
 305
 24306            var cleanedUpInteractions = RemoveExtremumsBetweenTouches(processedInteractions);
 307
 24308            if (MeasurePerformance)
 2309            {
 2310              _stopWatch.Stop();
 2311              perfItem.ComputeExtremumType = _stopWatch.Elapsed;
 2312              _stopWatch.Reset();
 2313            }
 314
 315
 24316            if (MeasurePerformance)
 2317            {
 2318                _stopWatch.Start();
 2319            }
 320
 24321            var frame = ComputeSmoothingValue(cleanedUpInteractions);
 322
 24323            if (MeasurePerformance)
 2324            {
 2325                _stopWatch.Stop();
 2326                perfItem.Smoothing = _stopWatch.Elapsed;
 2327                _stopWatch.Reset();
 2328            }
 329
 24330            var confidentInteractions = ApplyConfidenceFilter(SelectSmoothedInteractions(frame.Interactions));
 331
 332            // Populate optional remote stage timings before publishing the shared dictionary.
 24333            var reportTask = MeasurePerformance ? ReportPerformance(perfItem) : Task.CompletedTask;
 24334            processResult.PerformanceMeasurement = perfItem;
 24335            UpdatePerformanceMetrics(perfItem, processingDateTime);
 336
 24337            OnNewInteractions(confidentInteractions.ToList());
 338
 24339            await reportTask;
 340
 24341            return processResult;
 36342        }
 343
 344        /// <summary>Limits the smoothed output without changing the tracking history.</summary>
 345        protected virtual IEnumerable<Interaction> SelectSmoothedInteractions(IEnumerable<Interaction> interactions)
 20346            => interactions;
 347
 348        protected InteractionFrame ComputeSmoothingValue(IList<Interaction> rawInteractions)
 24349        {
 24350            var result = _smoothingBehaviour.Update(rawInteractions);
 24351            InteractionHistoryUpdated?.Invoke(this, _smoothingBehaviour.InteractionsFramesCache);
 352
 24353            return result;
 24354        }
 355
 356        protected virtual ExtremumDescription ComputeExtremumType(Point3[][] pointsArray, int xPos, int yPos)
 54357        {
 54358            if (ExtremumTypeCheckMethod == ExtremumTypeCheckMethod.Global)
 20359            {
 360                // Global skips neighbourhood validation, but retains the same sensor-depth
 361                // convention as the spatial classifier: pushes are minima, pulls maxima.
 20362                var depth = pointsArray[xPos][yPos].Z;
 20363                var type = !float.IsFinite(depth) || depth == Distance ? ExtremumType.Undefined
 20364                    : depth < Distance ? ExtremumType.Minimum : ExtremumType.Maximum;
 20365                return new ExtremumDescription
 20366                {
 20367                    Type = type,
 20368                    NumFittingPoints = type == ExtremumType.Undefined ? 0 : ExtremumTypeCheckNumSamples,
 20369                    PercentageFittingPoints = type == ExtremumType.Undefined ? 0 : 1.0f
 20370                };
 371            }
 372
 34373            var xMax = pointsArray.Length - 1;
 34374            var yMax = xMax > 0 ? pointsArray[0].Length - 1 : 0;
 375
 376            // refZ is the absolute distance from sensor
 34377            var refZ = Math.Abs(pointsArray[xPos][yPos].Z);
 378
 34379            var numCloser = 0;
 34380            var numFarther = 0;
 381
 382            Tuple<int, int>[] samples;
 34383            switch (ExtremumTypeCheckMethod)
 384            {
 385                case ExtremumTypeCheckMethod.StochasticStatic:
 0386                    samples = _stochasticSamples;
 0387                    break;
 388                case ExtremumTypeCheckMethod.StochasticDynamic:
 0389                    samples = GenerateSamples();
 0390                    break;
 391                case ExtremumTypeCheckMethod.Global:
 0392                    throw new ArgumentException("invalid Method 'Global' at this point.");
 393                case ExtremumTypeCheckMethod.FixedRadius:
 394                default:
 34395                    samples = _fixedSamples;
 34396                    break;
 397            }
 398
 612399            for (var i = 0; i < samples.Length; i++)
 272400            {
 272401                var sample = GetSample(pointsArray, xPos, yPos, samples, i, xMax, yMax);
 272402                if (Math.Abs(sample.Z) > refZ)
 176403                    numFarther++;
 404                else
 96405                    numCloser++;
 272406            }
 407
 408
 34409            var ratioMax = ExtremumTypeCheckNumSamples > 0 ? (float)numCloser / ExtremumTypeCheckNumSamples : 0;
 34410            var ratioMin = ExtremumTypeCheckNumSamples > 0 ? (float)numFarther / ExtremumTypeCheckNumSamples : 0;
 411
 34412            if (numCloser > numFarther && ratioMax > ExtremumTypeCheckFittingPercentage)
 12413            {
 12414                return new ExtremumDescription
 12415                {
 12416                    Type = ExtremumType.Maximum,
 12417                    NumFittingPoints = numCloser,
 12418                    PercentageFittingPoints = ratioMax
 12419                };
 420            }
 421
 22422            if (numFarther > numCloser && ratioMin > ExtremumTypeCheckFittingPercentage)
 22423            {
 22424                return new ExtremumDescription
 22425                {
 22426                    Type = ExtremumType.Minimum,
 22427                    NumFittingPoints = numFarther,
 22428                    PercentageFittingPoints = ratioMin
 22429                };
 430            }
 431
 0432            return new ExtremumDescription
 0433            {
 0434                Type = ExtremumType.Undefined,
 0435                NumFittingPoints = Math.Max(numCloser, numFarther),
 0436                PercentageFittingPoints = Math.Max(ratioMin, ratioMax)
 0437            };
 438
 54439        }
 440
 441        protected List<Interaction> ConvertDepthValue(List<Interaction> interactions)
 32442        {
 32443            var result = new List<Interaction>();
 444
 224445            foreach (var item in interactions)
 64446            {
 64447                if (item?.Position == null || !float.IsFinite(item.Position.Z) ||
 64448                    Math.Abs(item.Position.Z - Distance) <= MinDistance)
 22449                    continue;
 450
 42451                if (item.Position.Z < Distance)
 28452                {
 28453                    item.Type = InteractionType.Push;
 28454                    var depth = (Distance - item.Position.Z - MinDistance) / (MinDistance - MaxDistance);
 455
 28456                    if (depth > 0)
 0457                        continue;
 458
 28459                    if (depth < -1)
 0460                        depth = -1;
 461
 28462                    item.Position.Z = depth;
 28463                }
 464                else
 14465                {
 14466                    item.Type = InteractionType.Pull;
 14467                    var depth = (item.Position.Z - MinDistance - Distance) / (MaxDistance - MinDistance);
 468
 14469                    if (depth < 0)
 0470                        continue;
 471
 14472                    if (depth > 1)
 0473                        depth = 1;
 474
 14475                    item.Position.Z = depth;
 14476                }
 477
 42478                result.Add(item);
 42479            }
 480
 32481            return result;
 32482        }
 483
 484        protected IEnumerable<Interaction> ApplyConfidenceFilter(IEnumerable<Interaction> interactions)
 24485        {
 56486            return interactions.ToArray().Where(item => item.Confidence > MinConfidence);
 24487        }
 488
 489        protected List<Interaction> ComputeExtremumType(List<Interaction> interactions, Point3[][] pointsArray)
 24490        {
 24491            interactions.ForEach(interaction =>
 58492                interaction.ExtremumDescription = ComputeExtremumType(pointsArray, (int)interaction.Position.X, (int)int
 493
 24494            return interactions;
 24495        }
 496
 497        /// <summary>
 498        /// generic approach: removes all maximums below the surface and all minimums above the surface. Removal is base
 499        /// Points witch <see cref="ExtremumType.Undefined"/> are also removed.
 500        /// </summary>
 501        /// <param name="interactions">the list of preprocessed interactions with valid ExtremumDescription</param>
 502        /// <returns></returns>
 503        protected List<Interaction> RemoveExtremumsBetweenTouches(List<Interaction> interactions)
 24504        {
 24505          return interactions.Where((touch) =>
 24506            // invalid or undefined ExtremumType
 34507            touch.ExtremumDescription != null && touch.ExtremumDescription.Type != ExtremumType.Undefined &&
 34508            // minimums below the surface
 34509            ((touch.Position.Z < 0 && touch.ExtremumDescription.Type == ExtremumType.Minimum) ||
 34510             // maximums above the surface
 34511             (touch.Position.Z > 0 && touch.ExtremumDescription.Type == ExtremumType.Maximum))
 24512
 24513          ).ToList();
 24514        }
 515
 516        protected void UpdatePerformanceMetrics(ProcessPerformance perfItem, long startTime)
 36517        {
 36518            var pData = new PerformanceDataItem
 36519            {
 36520                FrameId = Convert.ToInt32(FrameId),
 36521                FrameStart = startTime,
 36522                FrameEnd = DateTime.Now.Ticks,
 36523                Process = perfItem,
 36524                Stage = PerformanceDataStage.ProcessingData
 36525            };
 526
 36527            PerformanceDataUpdated?.Invoke(this, pData);
 36528        }
 529
 530        protected void UpdateInteractionFrames(List<Interaction> cleanedUpInteractions, InteractionFrame currentFrame)
 0531        {
 0532          currentFrame.Interactions.ForEach((interaction) =>
 0533          {
 0534            if (cleanedUpInteractions.FirstOrDefault((i) => i.TouchId == interaction.TouchId) == null)
 0535            {
 0536              if (interaction.Confidence > 0)
 0537                interaction.Confidence--;
 0538            }
 0539          });
 540
 0541          currentFrame.Interactions.RemoveAll((interaction) => interaction.Confidence <= 0);
 542
 0543          _smoothingBehaviour.UpdateCachedFrame(currentFrame);
 0544          InteractionHistoryUpdated?.Invoke(this, _smoothingBehaviour.InteractionsFramesCache);
 0545        }
 546
 24547        protected void OnNewInteractions(List<Interaction> args) => NewInteractions?.Invoke(this, args);
 548
 549        /// <summary>
 550        /// Calculates the average distance for the currently stored PointCloud.
 551        /// </summary>
 552        /// <returns></returns>
 553        public float CalculateAverageDistance()
 0554        {
 0555            var sum = 0f;
 0556            var points = PointCloud?.AsArray();
 557
 0558            if (points == null)
 0559                return sum;
 560
 0561            var numValidSamples = 0;
 562
 0563            for (var i = 0; i < points.Length; ++i)
 0564            {
 0565                if (!points[i].IsValid || points[i].IsFiltered)
 0566                    continue;
 567
 0568                numValidSamples++;
 0569                sum += points[i].Z;
 0570            }
 571
 0572            return (float) decimal.Round((decimal) (sum / numValidSamples), 2);
 0573        }
 574
 575        private static Point3 GetSample(Point3[][] pointsArray, int xPos, int yPos, Tuple<int, int>[] samples, int i, in
 272576        {
 272577            var xIdx = xPos + samples[i].Item1;
 272578            xIdx = Math.Min(Math.Max(xIdx, 0), xMax);
 579
 272580            var yIdx = yPos + samples[i].Item2;
 272581            yIdx = Math.Min(Math.Max(yIdx, 0), yMax);
 272582            var sample = pointsArray[xIdx][yIdx];
 583
 272584            return sample;
 272585        }
 586
 587        private Tuple<int, int>[] GenerateSamples()
 76588        {
 76589            var result = new List<Tuple<int, int>>();
 590
 76591            var rnd = new Random();
 592
 76593            var min = (int)Math.Floor(0.5f * ExtremumTypeCheckRadius);
 76594            var max = ExtremumTypeCheckRadius;
 595
 920596            for (var i = 0; i < ExtremumTypeCheckNumSamples; i++)
 384597            {
 384598                var xStochastic = rnd.Next(min, max);
 384599                var yStochastic = rnd.Next(min, max);
 600
 384601                result.Add(new Tuple<int, int>(xStochastic, yStochastic));
 384602            }
 603
 76604            return result.ToArray();
 76605        }
 606
 607        private void UpdateSamples()
 76608        {
 76609            var samplesFixed = new List<Tuple<int, int>>();
 610
 920611            for (var i = 0; i < ExtremumTypeCheckNumSamples; i++)
 384612            {
 384613                var p = (float)i / ExtremumTypeCheckRadius;
 384614                var xFixed = (int) Math.Floor(ExtremumTypeCheckRadius * Math.Cos(p * 2 * Math.PI));
 384615                var yFixed = (int) Math.Floor(ExtremumTypeCheckRadius * Math.Sin(p * 2 * Math.PI));
 616
 384617                samplesFixed.Add(new Tuple<int, int>(xFixed, yFixed));
 384618            }
 76619            _fixedSamples = samplesFixed.ToArray();
 620
 76621            _stochasticSamples = GenerateSamples();
 76622        }
 623
 624
 625    }
 626}

Methods/Properties

.ctor()
get_Distance()
get_MinDistance()
get_MaxDistance()
get_ExtremumTypeCheckNumSamples()
set_ExtremumTypeCheckNumSamples(System.Int32)
get_ExtremumTypeCheckRadius()
set_ExtremumTypeCheckRadius(System.Int32)
get_ExtremumTypeCheckFittingPercentage()
get_ExtremumTypeCheckMethod()
get_InteractionHistorySize()
set_InteractionHistorySize(System.Int32)
get_NumSmoothingFrames()
set_NumSmoothingFrames(System.Int32)
get_MaxNumEmptyFramesBetween()
set_MaxNumEmptyFramesBetween(System.Int32)
get_TouchMergeDistance2D()
set_TouchMergeDistance2D(System.Single)
get_DepthScale()
set_DepthScale(System.Single)
get_FilterType()
set_FilterType(ReFlex.Core.Interactivity.Util.FilterType)
get_MinAngle()
get_MinConfidence()
get_MaxConfidence()
set_MaxConfidence(System.Single)
get_MeasurePerformance()
get_FrameId()
UpdateFrameId(System.Int32)
ReportPerformance(ReFlex.Core.Common.Util.ProcessPerformance)
CheckInitialState()
Update()
SelectSmoothedInteractions(System.Collections.Generic.IEnumerable`1<ReFlex.Core.Common.Components.Interaction>)
ComputeSmoothingValue(System.Collections.Generic.IList`1<ReFlex.Core.Common.Components.Interaction>)
ComputeExtremumType(ReFlex.Core.Common.Components.Point3[][],System.Int32,System.Int32)
ConvertDepthValue(System.Collections.Generic.List`1<ReFlex.Core.Common.Components.Interaction>)
ApplyConfidenceFilter(System.Collections.Generic.IEnumerable`1<ReFlex.Core.Common.Components.Interaction>)
ComputeExtremumType(System.Collections.Generic.List`1<ReFlex.Core.Common.Components.Interaction>,ReFlex.Core.Common.Components.Point3[][])
RemoveExtremumsBetweenTouches(System.Collections.Generic.List`1<ReFlex.Core.Common.Components.Interaction>)
UpdatePerformanceMetrics(ReFlex.Core.Common.Util.ProcessPerformance,System.Int64)
UpdateInteractionFrames(System.Collections.Generic.List`1<ReFlex.Core.Common.Components.Interaction>,ReFlex.Core.Common.Components.InteractionFrame)
OnNewInteractions(System.Collections.Generic.List`1<ReFlex.Core.Common.Components.Interaction>)
CalculateAverageDistance()
GetSample(ReFlex.Core.Common.Components.Point3[][],System.Int32,System.Int32,System.Tuple`2<System.Int32,System.Int32>[],System.Int32,System.Int32,System.Int32)
GenerateSamples()
UpdateSamples()