예제 #1
0
 /// <summary>
 /// Removes a range of elements from the <see cref="ISpread{T}"/>.
 /// </summary>
 /// <param name="spread">The <see cref="ISpread{T}"/> to remove the elements from.</param>
 /// <param name="index">The zero-based starting index of the range of elements to remove.</param>
 /// <param name="count">The number of elements to remove.</param>
 /// <remarks>The items are removed and all the elements following them in the <see cref="ISpread{T}"/> have their indexes reduced by count.</remarks>
 public static void RemoveRange <T>(this ISpread <T> spread, int index, int count)
 {
     for (int i = 0; i < count; i++)
     {
         spread.RemoveAt(index);
     }
 }
 //called when data for any output pin is requested
 public void Evaluate(int SpreadMax)
 {
     if (FAH[0])
     {
         if (FFilter[0])
         {
             if (!FOutput.Contains(FInput[0]))
             {
                 FOutput.Insert(0, FInput[0]);
             }
         }
         else
         {
             FOutput.Insert(0, FInput[0]);
         }
     }
     if (FCT[0])
     {
         FOutput.RemoveAt(FOutput.SliceCount - 1);
     }
     if (FReset[0])
     {
         FOutput.SliceCount = 0;
     }
     //FLogger.Log(LogType.Debug, "Logging to Renderer (TTY)");
 }
예제 #3
0
        void PacketHandler(Packet packet)
        {
            DidReceivePacket   = true;
            LastPacketReceived = packet.TimeStamp;

            Valid[0] = packet.GoodChecksum;

            if (Timings.SliceCount >= 10)
            {
                Timings.RemoveAt(0);
            }
            double millis = packet.TimeStamp.ToUniversalTime().Subtract(
                new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
                ).TotalMilliseconds;

            Timings.Add(millis);

            if (!packet.GoodChecksum)
            {
                FaultyMeasurement[0] = false;
                IsDirty[0]           = false;
                return;
            }

            FaultyMeasurement[0] = packet.FaultyMeasurement;
            IsDirty[0]           = packet.IsDirty;

            switch (packet.Response)
            {
            case 0x91:
                LogInfo("Reset");
                OnReset(packet);
                break;

            case 0x90:
                LogInfo("Power On");
                OnPowerOn(packet);
                break;

            case 0xA0:
                LogInfo("Confirm");
                OnConfirm(packet);
                break;

            case 0xB0:
                OnMeasurement(packet);
                break;

            case 0xB1:
                LogInfo("Status");
                OnStatus(packet);
                break;

            default:
                LogInfo("Unknown Packet: {0}", packet.Response.ToString("X"));
                break;
            }
        }
예제 #4
0
        public void OnImportsSatisfied()
        {
            PositionOut.SliceCount    = 0;
            IdOut.SliceCount          = 0;
            ContactAreaOut.SliceCount = 0;
            IsNewOut.SliceCount       = 0;
            FSubscription             = new Subscription <TouchDevice, TouchNotification>(
                touchDevice =>
            {
                return(touchDevice.Notifications);
            },
                (touchDevice, n) =>
            {
                var position           = new Vector2D(n.Position.X, n.Position.Y);
                var clientArea         = new Vector2D(n.ClientArea.Width, n.ClientArea.Height);
                var normalizedPosition = VMath.Map(position, Vector2D.Zero, clientArea, new Vector2D(-1, 1), new Vector2D(1, -1), TMapMode.Float);
                var contactArea        = new Vector2D(n.ContactArea.Width, n.ContactArea.Height);
                var index = IdOut.IndexOf(n.Id);
                switch (n.Kind)
                {
                case TouchNotificationKind.TouchDown:
                    if (index < 0)
                    {
                        IdOut.Add(n.Id);
                        PositionOut.Add(normalizedPosition);
                        ContactAreaOut.Add(contactArea);
                        IsNewOut.Add(true);
                    }
                    break;

                case TouchNotificationKind.TouchUp:
                    if (index >= 0)
                    {
                        IdOut.RemoveAt(index);
                        PositionOut.RemoveAt(index);
                        ContactAreaOut.RemoveAt(index);
                        IsNewOut.RemoveAt(index);
                    }
                    break;

                case TouchNotificationKind.TouchMove:
                    if (index >= 0)
                    {
                        PositionOut[index]    = normalizedPosition;
                        ContactAreaOut[index] = contactArea;
                        IsNewOut[index]       = false;
                    }
                    break;

                default:
                    throw new NotImplementedException();
                }
            },
                FScheduler
                );
        }
예제 #5
0
                #pragma warning restore
        #endregion fields & pins

        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FInput.IsChanged || FIndex.IsChanged)
            {
                FOutput.AssignFrom(FInput);
                foreach (int i in FIndex.Select(x => x % FInput.SliceCount).Distinct().OrderByDescending(x => x))
                {
                    FOutput.RemoveAt(i);
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="ISpread{T}"/>.
        /// </summary>
        /// <param name="spread">The <see cref="ISpread{T}"/> to remove the object from.</param>
        /// <param name="item">The object to remove.</param>
        /// <returns>
        /// true if item was successfully removed from the <see cref="ISpread{T}"/>; otherwise, false.
        /// This method also returns false if item is not found in the original <see cref="ISpread{T}"/>.
        /// </returns>
        /// <remarks>This is operation has a runtime of O(n).</remarks>
        public static bool Remove <T>(this ISpread <T> spread, T item)
        {
            for (int i = 0; i < spread.SliceCount; i++)
            {
                if (Comparer <T> .Default.Compare(spread[i], item) == 0)
                {
                    spread.RemoveAt(i);
                    return(true);
                }
            }

            return(false);
        }
예제 #7
0
        public void DoDestroy()
        {
            if (!FDestroyIds.IsNullOrEmpty())
            {
                canceledTask = false;
                bool badId = true;
                for (int i = 0; i < FDestroyIds.SliceCount; i = i)
                {
                    try
                    {
                        tweetIdToDestroy = Convert.ToInt64(FDestroyIds[i]);
                        badId            = false;
                    }
                    catch
                    {
                        FActionStatus[0] = "Tweet Id to destroy not recognised, you spineless turd";
                        FLogger.Log(LogType.Debug, "Tweet Id to destroy not recognised, you spineless turd");
                        badId = true;
                    }
                    if (!badId)
                    {
                        Tweet_Destroy(tweetIdToDestroy);
                        if (FDestroyIds.SliceCount > 1)
                        {
                            MakeTaskWait("Destroy");
                        }
                    }
                    else
                    {
                        FLogger.Log(LogType.Debug, "...still removing it from the published list ");
                        listTweetsPublished.RemoveAt(i);
                        numOfTweetsPublished = listTweetsPublished.Count;
                        FPublishedTweetId.RemoveAt(i);
                    }

                    if (!FMachineGun[0] || canceledTask)
                    {
                        break;
                    }
                }
                FAllActionDone[0] = true;
                FLogger.Log(LogType.Debug, "FINISHED! Whatever you did, you did well. I believe in you mate.");
            }
            else
            {
                FActionStatus[0] = "Tweet Id to destroy null or empty, dickhead.";
                FLogger.Log(LogType.Debug, "Tweet Id to destroy null or empty, dickhead.");
            }
        }
예제 #8
0
        public virtual void OnImportsSatisfied()
        {
            FGestureFilterKind = SetGestureKindFilter();

            PositionOut.SliceCount = 0;
            IdOut.SliceCount       = 0;
            DeviceIDOut.SliceCount = 0;

            FSubscription = new Subscription <GestureDevice, GestureNotification>(
                gestureDevice =>
            {
                return(gestureDevice.Notifications.Where(g => (g.Kind == FGestureFilterKind) || (g.Kind == GestureNotificationKind.GestureEnd)));
            },
                (gestureDevice, g) =>
            {
                var index         = IdOut.IndexOf(g.Id);
                var isFilterMatch = g.Kind == FGestureFilterKind;
                UseGesture(g, isFilterMatch, index);
                if (isFilterMatch)
                {
                    var position           = new Vector2D(g.Position.X, g.Position.Y);
                    var clientArea         = new Vector2D(g.ClientArea.Width, g.ClientArea.Height);
                    var normalizedPosition = VMath.Map(position, Vector2D.Zero, clientArea, new Vector2D(-1, 1), new Vector2D(1, -1), TMapMode.Float);

                    if (index < 0)
                    {
                        PositionOut.Add(normalizedPosition);
                        IdOut.Add(g.Id);
                        DeviceIDOut.Add(g.GestureDeviceID);
                    }
                    else
                    {
                        PositionOut[index] = normalizedPosition;
                        IdOut[index]       = g.Id;
                        DeviceIDOut[index] = g.GestureDeviceID;
                    }
                }
                else if (index >= 0)
                {
                    PositionOut.RemoveAt(index);
                    IdOut.RemoveAt(index);
                    DeviceIDOut.RemoveAt(index);
                }
            },
                FScheduler
                );
        }
예제 #9
0
 protected override void UseGesture(GestureNotification gesture, bool isFilterMatch, int index)
 {
     if (isFilterMatch)
     {
         double distance = (double)(gesture.Arguments & Const.ULL_ARGUMENTS_BIT_MASK);
         if (index < 0)
         {
             DistanceOut.Add(distance / (double)gesture.ClientArea.Height * 2);
         }
         else
         {
             DistanceOut[index] = distance / (double)gesture.ClientArea.Height * 2;
         }
     }
     else if (index >= 0)
     {
         DistanceOut.RemoveAt(index);
     }
 }
예제 #10
0
        protected override void UseGesture(GestureNotification gesture, bool isFilterMatch, int index)
        {
            if (isFilterMatch)
            {
                double rotate = (double)(gesture.Arguments & Const.ULL_ARGUMENTS_BIT_MASK);
                rotate = rotate / 65535.0 * 2 - 1;

                if (index < 0)
                {
                    RotateOut.Add(rotate);
                }
                else
                {
                    RotateOut[index] = rotate;
                }
            }
            else if (index >= 0)
            {
                RotateOut.RemoveAt(index);
            }
        }
예제 #11
0
        public static void UpdateBlobs(ISpread <Blob> allBlobs, ISpread <Blob> currentBlobs, int id)
        {
            Debug.WriteLine(allBlobs.SliceCount + " " + currentBlobs.SliceCount);
            for (var i = 0; i < currentBlobs.Count(); i++)
            {
                var found = false;

                for (var j = 0; j < allBlobs.Count(); j++)
                {
                    //Check if blob exists
                    if (currentBlobs[i].Id != allBlobs[j].Id)
                    {
                        continue;
                    }

                    //Check if blob not hited another object
                    if (allBlobs[j].HitId > 0 && allBlobs[j].HitId != id)
                    {
                        continue;
                    }

//					if (currentBlobs.SliceCount > 2)
//					{
//						Debug.WriteLine(allBlobs);
//					}

                    currentBlobs[i] = allBlobs[j];
                    found           = true;
                    break;
                }

                if (!found)
                {
                    currentBlobs.RemoveAt(i);
                }
            }
        }
예제 #12
0
        public void OnImportsSatisfied()
        {
            PositionPixelOut.SliceCount                  = 0;
            PositionInProjectionSpaceOut.SliceCount      = 0;
            PositionInNormalizedProjectionOut.SliceCount = 0;
            PositionOut.SliceCount    = 0;
            IdOut.SliceCount          = 0;
            PrimaryOut.SliceCount     = 0;
            ContactAreaOut.SliceCount = 0;
            IsNewOut.SliceCount       = 0;
            DeviceIDOut.SliceCount    = 0;

            FSubscription = new Subscription <TouchDevice, TouchNotification>(
                touchDevice =>
            {
                return(touchDevice.Notifications);
            },
                (touchDevice, n) =>
            {
                Vector2D inNormalizedProjection, inProjection;
                SpaceHelpers.MapFromPixels(n.Position, n.Sender, n.ClientArea,
                                           out inNormalizedProjection, out inProjection);
                var normalizedPosition = MouseExtensions.GetLegacyMousePositon(n.Position, n.ClientArea);
                var inPixels           = new Vector2D(n.Position.X, n.Position.Y);

                var contactArea = new Vector2D(n.ContactArea.Width, n.ContactArea.Height);
                var index       = IdOut.IndexOf(n.Id);
                var primary     = n.Primary;
                var deviceid    = n.TouchDeviceID;
                switch (n.Kind)
                {
                case TouchNotificationKind.TouchDown:
                    if (index < 0)
                    {
                        IdOut.Add(n.Id);
                        PositionPixelOut.Add(inPixels);
                        PositionInProjectionSpaceOut.Add(inProjection);
                        PositionInNormalizedProjectionOut.Add(inNormalizedProjection);
                        PositionOut.Add(normalizedPosition);
                        PrimaryOut.Add(primary);
                        ContactAreaOut.Add(contactArea);
                        IsNewOut.Add(true);
                        DeviceIDOut.Add(deviceid);
                    }
                    break;

                case TouchNotificationKind.TouchUp:
                    if (index >= 0)
                    {
                        IdOut.RemoveAt(index);
                        PositionPixelOut.RemoveAt(index);
                        PositionInProjectionSpaceOut.RemoveAt(index);
                        PositionInNormalizedProjectionOut.RemoveAt(index);
                        PositionOut.RemoveAt(index);
                        PrimaryOut.RemoveAt(index);
                        ContactAreaOut.RemoveAt(index);
                        IsNewOut.RemoveAt(index);
                        DeviceIDOut.RemoveAt(index);
                    }
                    break;

                case TouchNotificationKind.TouchMove:
                    if (index >= 0)
                    {
                        PositionPixelOut[index]                  = inPixels;
                        PositionInProjectionSpaceOut[index]      = inProjection;
                        PositionInNormalizedProjectionOut[index] = inNormalizedProjection;
                        PositionOut[index]    = normalizedPosition;
                        PrimaryOut[index]     = primary;
                        ContactAreaOut[index] = contactArea;
                        IsNewOut[index]       = false;
                    }
                    break;

                default:
                    throw new NotImplementedException();
                }
            },
                FScheduler
                );
        }
예제 #13
0
        public static void UpdateBlobs(ISpread<Blob> allBlobs, ISpread<Blob> currentBlobs, int id)
        {
            Debug.WriteLine(allBlobs.SliceCount + " " + currentBlobs.SliceCount);
            for (var i = 0; i < currentBlobs.Count(); i++)
            {
                var found = false;

                for (var j = 0; j < allBlobs.Count(); j++)
                {
                    //Check if blob exists
                    if (currentBlobs[i].Id != allBlobs[j].Id) continue;

                    //Check if blob not hited another object
                    if(allBlobs[j].HitId > 0 && allBlobs[j].HitId != id) continue;

            //					if (currentBlobs.SliceCount > 2)
            //					{
            //						Debug.WriteLine(allBlobs);
            //					}

                    currentBlobs[i] = allBlobs[j];
                    found = true;
                    break;
                }

                if(!found) currentBlobs.RemoveAt(i);
            }
        }
예제 #14
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FInputVertices.IsChanged || FTriangleIndices.IsChanged || FTetIndices.IsChanged || FRemoveBy.IsChanged || FRemoveRegion.IsChanged || FRegionMarkers.IsChanged)
            {
                List <int> deleteIndex   = new List <int>();
                List <int> NewTriIndices = new List <int>();
                List <int> NewTetIndices = new List <int>();


                if (FRemoveBy[0])
                {
                    for (int i = 0; i < FRegionMarkers.SliceCount; i++)
                    {
                        for (int j = 0; j < FRemoveRegion.SliceCount; j++)
                        {
                            if (FRegionMarkers[i] != FRemoveRegion[j])
                            {
                                //						for (int k = 0; k < 4; k++){
                                //							deleteIndex.Add(FTetIndices[i*4+k]);
                                //							}
                                NewTetIndices.Add(FTetIndices[i * 4]);
                                NewTetIndices.Add(FTetIndices[i * 4 + 1]);
                                NewTetIndices.Add(FTetIndices[i * 4 + 2]);
                                NewTetIndices.Add(FTetIndices[i * 4 + 3]);
                            }
                        }
                    }


                    for (int g = 0; g < FInputVertices.SliceCount; g++)
                    {
                        if (!NewTetIndices.Contains(g))
                        {
                            deleteIndex.Add(g);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < FRegionMarkers.SliceCount; i++)
                    {
                        for (int j = 0; j < FRemoveRegion.SliceCount; j++)
                        {
                            if (FRegionMarkers[i] == FRemoveRegion[j])
                            {
                                deleteIndex.Add(i);
                            }
                        }
                    }

                    for (int g = 0; g < FTetIndices.SliceCount / 4; g++)
                    {
                        if (!(deleteIndex.Contains(FTetIndices[g * 4]) || deleteIndex.Contains(FTetIndices[g * 4 + 1]) || deleteIndex.Contains(FTetIndices[g * 4 + 2]) || deleteIndex.Contains(FTetIndices[g * 4 + 3])))
                        {
                            NewTetIndices.Add(FTetIndices[g * 4]);
                            NewTetIndices.Add(FTetIndices[g * 4 + 1]);
                            NewTetIndices.Add(FTetIndices[g * 4 + 2]);
                            NewTetIndices.Add(FTetIndices[g * 4 + 3]);
                        }
                    }
                }

                for (int g = 0; g < FTriangleIndices.SliceCount / 3; g++)
                {
                    if (!(deleteIndex.Contains(FTriangleIndices[g * 3]) || deleteIndex.Contains(FTriangleIndices[g * 3 + 1]) || deleteIndex.Contains(FTriangleIndices[g * 3 + 2])))
                    {
                        NewTriIndices.Add(FTriangleIndices[g * 3]);
                        NewTriIndices.Add(FTriangleIndices[g * 3 + 1]);
                        NewTriIndices.Add(FTriangleIndices[g * 3 + 2]);
                    }
                }

                FTriangleIndicesOut.SliceCount = NewTriIndices.Count;
                FTriangleIndicesOut.AssignFrom(NewTriIndices);

                FTetIndicesOut.SliceCount = NewTetIndices.Count;
                FTetIndicesOut.AssignFrom(NewTetIndices);

                FRemovedIndices.SliceCount = deleteIndex.Count;
                FRemovedIndices.AssignFrom(deleteIndex);

                FOutputVertices.SliceCount = FInputVertices.SliceCount;
                FOutputVertices.AssignFrom(FInputVertices);

                deleteIndex.Reverse();

                for (int g = 0; g < FTriangleIndicesOut.SliceCount; g++)
                {
                    for (int h = 0; h < deleteIndex.Count; h++)
                    {
                        if (FTriangleIndicesOut[g] >= deleteIndex[h])
                        {
                            FTriangleIndicesOut[g] -= 1;
                        }
                    }
                }

                for (int g = 0; g < FTetIndicesOut.SliceCount; g++)
                {
                    for (int h = 0; h < deleteIndex.Count; h++)
                    {
                        if (FTetIndicesOut[g] >= deleteIndex[h])
                        {
                            FTetIndicesOut[g] -= 1;
                        }
                    }
                }

                for (int vecID = 0; vecID < deleteIndex.Count; vecID++)
                {
                    FOutputVertices.RemoveAt(deleteIndex[vecID]);
                }



                FSelect.SliceCount = FInputVertices.SliceCount;
                for (int i = 0; i < FInputVertices.SliceCount; i++)
                {
                    FSelect[i] = !deleteIndex.Contains(i);
                }
                //FLogger.Log(LogType.Debug, "hi tty!");
            }
        }
예제 #15
0
        public void Evaluate(int SpreadMax)
        {
            //return null if one of the control inputs is null
            if (FDoInsert.IsAnyEmpty(FReset))
            {
                FOutput.SliceCount = 0;
                return;
            }

            if (FReset[0])
            {
                FBuffer.Clear();
                FFramesRecorded.SliceCount = 0;
            }

            if (FRemove[0])
            {
                if (FFramesRecorded.SliceCount > 0)
                {
                    foreach (int i in FIndex.Select(x => x % FFramesRecorded.SliceCount).Distinct().OrderByDescending(x => x))
                    {
                        int offset = 0;
                        for (int j = 0; j < i; j++)
                        {
                            offset += FFramesRecorded[j];
                        }

                        if (FFramesRecorded.SliceCount > 1)
                        {
                            FBuffer.RemoveRange(offset, FFramesRecorded[i]);
                        }
                        else
                        {
                            FBuffer.RemoveRange(0, FFramesRecorded[i]);
                        }

                        FFramesRecorded.RemoveAt(i);
                    }
                }
            }

            if (FDoInsert[0])
            {
                // is empty, so insert new slice
                if (FFramesRecorded.SliceCount < 1)
                {
                    FFramesRecorded.Insert(0, 0);
                }
                // new slice for FFramesRecorded reqested
                else if (FDoSplit[0])
                {
                    // duplicate current slice and insert in old queue
                    if (FSplitDuplicate[0])
                    {
                        if (!FAppend[0])
                        {
                            FBuffer.Insert(0, FCopier.CopySpread(FInput));
                            FFramesRecorded[0]++;
                        }
                        else
                        {
                            // search beginning of last queue
                            int count = 0;
                            for (int i = 0; i < FFramesRecorded.SliceCount - 1; i++)
                            {
                                count += FFramesRecorded[i];
                            }

                            FBuffer.Insert(count, FCopier.CopySpread(FInput));
                            FFramesRecorded[FFramesRecorded.SliceCount - 1]++;
                        }
                    }
                    if (!FAppend[0])
                    {
                        FFramesRecorded.Insert(0, 0);
                    }
                    else
                    {
                        FFramesRecorded.Add(0);
                    }
                }

                if (!FAppend[0])
                {
                    FBuffer.Insert(0, FCopier.CopySpread(FInput));
                    FFramesRecorded[0]++;
                }
                else
                {
                    // search beginning of last queue
                    int count = 0;
                    for (int i = 0; i < FFramesRecorded.SliceCount - 1; i++)
                    {
                        count += FFramesRecorded[i];
                    }

                    FBuffer.Insert(count, FCopier.CopySpread(FInput));
                    FFramesRecorded[FFramesRecorded.SliceCount - 1]++;
                }
            }

            FOutput.AssignFrom(FBuffer);

            if (FOutput.SliceCount == 0)
            {
                FFramesRecorded.SliceCount = 0;
            }

            // combines all recorded queues to one big queue
            if (FConsolidate[0] == true)
            {
                int count = 0;

                foreach (int current in FFramesRecorded)
                {
                    count += current;
                }

                FFramesRecorded.SliceCount = 1;
                FFramesRecorded[0]         = count;
            }
        }
예제 #16
0
        public virtual void OnImportsSatisfied()
        {
            FGestureFilterKind = SetGestureKindFilter();

            PositionPixelOut.SliceCount                  = 0;
            PositionInProjectionSpaceOut.SliceCount      = 0;
            PositionInNormalizedProjectionOut.SliceCount = 0;
            PositionOut.SliceCount = 0;
            IdOut.SliceCount       = 0;
            DeviceIDOut.SliceCount = 0;

            FSubscription = new Subscription <GestureDevice, GestureNotification>(
                gestureDevice =>
            {
                return(gestureDevice.Notifications.Where(g => (g.Kind == FGestureFilterKind) || (g.Kind == GestureNotificationKind.GestureEnd)));
            },
                (gestureDevice, g) =>
            {
                var index         = IdOut.IndexOf(g.Id);
                var isFilterMatch = g.Kind == FGestureFilterKind;
                UseGesture(g, isFilterMatch, index);
                if (isFilterMatch)
                {
                    Vector2D inNormalizedProjection, inProjection;
                    SpaceHelpers.MapFromPixels(g.Position, g.Sender, g.ClientArea,
                                               out inNormalizedProjection, out inProjection);
                    var normalizedPosition = MouseExtensions.GetLegacyMousePositon(g.Position, g.ClientArea);
                    var inPixels           = new Vector2D(g.Position.X, g.Position.Y);

                    if (index < 0)
                    {
                        PositionPixelOut.Add(inPixels);
                        PositionInProjectionSpaceOut.Add(inProjection);
                        PositionInNormalizedProjectionOut.Add(inNormalizedProjection);
                        PositionOut.Add(normalizedPosition);

                        IdOut.Add(g.Id);
                        DeviceIDOut.Add(g.GestureDeviceID);
                    }
                    else
                    {
                        PositionPixelOut[index]                  = inPixels;
                        PositionInProjectionSpaceOut[index]      = inProjection;
                        PositionInNormalizedProjectionOut[index] = inNormalizedProjection;
                        PositionOut[index] = normalizedPosition;
                        IdOut[index]       = g.Id;
                        DeviceIDOut[index] = g.GestureDeviceID;
                    }
                }
                else if (index >= 0)
                {
                    PositionPixelOut.RemoveAt(index);
                    PositionInProjectionSpaceOut.RemoveAt(index);
                    PositionInNormalizedProjectionOut.RemoveAt(index);
                    PositionOut.RemoveAt(index);
                    IdOut.RemoveAt(index);
                    DeviceIDOut.RemoveAt(index);
                }
            },
                FScheduler
                );
        }
예제 #17
0
        public static void UpdateBlobs(ISpread<Blob> allBlobs, ISpread<Blob> currentBlobs, int id)
        {
            for (var i = 0; i < currentBlobs.Count(); i++)
            {
                var found = false;

                for (var j = 0; j < allBlobs.Count(); j++)
                {
                    //Check if blob exists
                    if (currentBlobs[i].Id != allBlobs[j].Id) continue;

                    //Check if blob not hited another object
                    //TODO: Find, if this needed or not.
                    //if(allBlobs[j].HitId > 0 && allBlobs[j].HitId != id) continue;

                    currentBlobs[i] = allBlobs[j];
                    found = true;
                    break;
                }

                if(!found) currentBlobs.RemoveAt(i);
            }
        }