//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)"); }
/// <summary> /// Inserts the elements of a collection into the <see cref="ISpread{T}"/> at the specified index. /// </summary> /// <param name="spread">The <see cref="ISpread{T}"/> to insert the items into.</param> /// <param name="index">The zero-based index at which the new elements should be inserted.</param> /// <param name="collection">The collection whose elements should be inserted into the <see cref="ISpread{T}"/>.</param> public static void InsertRange <T>(this ISpread <T> spread, int index, IEnumerable <T> collection) { foreach (var item in collection.Reverse()) { spread.Insert(index, item); } }
//called when data for any output pin is requested public void Evaluate(int SpreadMax) { if (FInput.IsChanged || FIterations.IsChanged) { FOutput.AssignFrom(FInput); for (int i = 0; i < FIterations[0]; i++) { int segCount = FOutput.SliceCount - 1; for (int k = 0; k < segCount * 4; k = k + 4) { Vector2D segStart = FOutput[k]; Vector2D segEnd = FOutput[k + 1]; Vector2D segThird = (segEnd - segStart) / 3; FOutput.Insert(k + 1, segStart + segThird); FOutput.Insert(k + 2, segStart + segThird + (VMath.RotateZ(VMath.DegToRad * 60) * segThird).xy); FOutput.Insert(k + 3, segStart + 2 * segThird); } } } }
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; } }