private IList <FingerPoint> MapFingerPoints(IList <FingerPoint> oldFingerPoints, IList <FingerPoint> newFingerPoints) { var idGenerator = new IdGenerator(); var distanceMap = new DistanceMap <FingerPoint, FingerPoint>(oldFingerPoints); distanceMap.Map(newFingerPoints); foreach (var tuple in distanceMap.MappedItems) { idGenerator.SetUsed(tuple.Item1.Id); tuple.Item2.Id = tuple.Item1.Id; tuple.Item2.FrameCount = tuple.Item1.FrameCount + 1; } foreach (var newFinger in distanceMap.UnmappedItems) { newFinger.Id = idGenerator.GetNextId(); } foreach (var discontinuedFinger in distanceMap.DiscontinuedItems) { discontinuedFinger.NegativeFrameCount++; } return(distanceMap.MappedItems.Select(i => i.Item2) .Union(distanceMap.UnmappedItems) .Union(distanceMap.DiscontinuedItems) .Where(i => i.NegativeFrameCount <= this.settings.FramesForDiscontinuedFingerPoint).ToList()); }
private IList <FingerPoint> MapFingerPoints(IList <FingerPoint> oldFingerPoints, IList <FingerPoint> newFingerPoints) { var idGenerator = new IdGenerator(); var distanceMap = new DistanceMap <FingerPoint, FingerPoint>(oldFingerPoints); distanceMap.Map(newFingerPoints); foreach (var tuple in distanceMap.MappedItems) { idGenerator.SetUsed(tuple.Item1.Id); tuple.Item2.Id = tuple.Item1.Id; } foreach (var newFinger in distanceMap.UnmappedItems) { newFinger.Id = idGenerator.GetNextId(); } return(distanceMap.MappedItems.Select(i => i.Item2).Union(distanceMap.UnmappedItems).ToList()); }
private IList<FingerPoint> MapFingerPoints(IList<FingerPoint> oldFingerPoints, IList<FingerPoint> newFingerPoints) { var idGenerator = new IdGenerator(); var distanceMap = new DistanceMap<FingerPoint, FingerPoint>(oldFingerPoints); distanceMap.Map(newFingerPoints); foreach (var tuple in distanceMap.MappedItems) { idGenerator.SetUsed(tuple.Item1.Id); tuple.Item2.Id = tuple.Item1.Id; } foreach (var newFinger in distanceMap.UnmappedItems) { newFinger.Id = idGenerator.GetNextId(); } return distanceMap.MappedItems.Select(i => i.Item2).Union(distanceMap.UnmappedItems).ToList(); }
private IList<FingerPoint> MapFingerPoints(IList<FingerPoint> oldFingerPoints, IList<FingerPoint> newFingerPoints) { var idGenerator = new IdGenerator(); var distanceMap = new DistanceMap<FingerPoint, FingerPoint>(oldFingerPoints); distanceMap.Map(newFingerPoints); foreach (var tuple in distanceMap.MappedItems) { idGenerator.SetUsed(tuple.Item1.Id); tuple.Item2.Id = tuple.Item1.Id; tuple.Item2.FrameCount = tuple.Item1.FrameCount + 1; } foreach (var newFinger in distanceMap.UnmappedItems) { newFinger.Id = idGenerator.GetNextId(); } foreach (var discontinuedFinger in distanceMap.DiscontinuedItems) { discontinuedFinger.NegativeFrameCount++; } return distanceMap.MappedItems.Select(i => i.Item2) .Union(distanceMap.UnmappedItems) .Union(distanceMap.DiscontinuedItems) .Where(i => i.NegativeFrameCount <= this.settings.FramesForDiscontinuedFingerPoint).ToList(); }