algorithmic modeling for Rhino
private void RunScript(int ShiftVal, List Pts, ref object A)
{
//shifted list in2 step **
List outPts = new List();
//step1
for (int i = ShiftVal;(i <= Pts.Count - 1);i++)
{
outPts.Insert((i - ShiftVal), Pts[i]);
}
//step2
for (int i = 0;(i <= ShiftVal - 1);i++)
{
outPts.Insert(((Pts.Count ) - ShiftVal) + i, Pts[i]);
}
A = outPts;
}
Tags:
static T[] CircularShift<T>(IList<T> input, int shift)
{
int l = input.Count;
if(shift < 0)
shift = (shift % l) + l;
T[] result = new T[l];
for(int i = 0; i < l; i++)
{
result[i] = input[(shift + i) % l];
}
return result;
}
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by