# Rhino.Geometry.Curve.Split() does not respect t parameter

Simple problem, but seems to be a bug / design desicion?

So, when using a list of parameters to split a curve into multiple parts, I found that the `Curve.Split()` method will sort the parameters instead of using the original list…

For instance, when I give `tLst = {0.9, 0, 0.1, 0.2, 0.6, 0.8}`, this list will be sorted (see code below).
However, such action will destroy the resulted sequence when I apply the same approach to a set of two offset curves…

I’ve attached the code of the method below.

If this is your (McNeel) design decision, how can I maintain the sequence as the input parameter list?

Personally, I think this should be regarded as a bug…

``````  public Curve[] Split(IEnumerable<double> t)
{
Interval domain = Domain;
double min = domain.Min;
double max = domain.Max;
RhinoList<double> rhinoList = new RhinoList<double>(t);
rhinoList.Sort();
for (int num = rhinoList.Count - 1; num >= 0; num--)
{
if (rhinoList[num] < min)
{
rhinoList.RemoveAt(num);
}
else if (rhinoList[num] > max)
{
rhinoList.RemoveAt(num);
}
else if (num > 0 && rhinoList[num].Equals(rhinoList[num - 1]))
{
rhinoList.RemoveAt(num);
}
}

if (rhinoList.Count == 0)
{
return new Curve[0];
}

bool flag = false;
bool flag2 = false;
if (rhinoList[0] > min + 2.3283064365386963E-10)
{
flag = true;
rhinoList.Insert(0, min);
}

if (rhinoList[rhinoList.Count - 1] < max - 2.3283064365386963E-10)
{
flag2 = true;
}

RhinoList<Curve> rhinoList2 = new RhinoList<Curve>();
for (int i = 0; i < rhinoList.Count - 1; i++)
{
double num2 = rhinoList[i];
double num3 = rhinoList[i + 1];
if (num3 - num2 > 2.3283064365386963E-10)
{
Curve curve = Trim(num2, num3);
if (curve != null)
{
}
}
}

if (flag && flag2 && IsClosed)
{
Curve curve2 = rhinoList2[0];
Curve curve3 = rhinoList2[rhinoList2.Count - 1];
PolyCurve polyCurve = new PolyCurve();
polyCurve.Append(curve3);
polyCurve.Append(curve2);
polyCurve.RemoveNesting();
rhinoList2.RemoveAt(0);
rhinoList2[rhinoList2.Count - 1] = polyCurve;
}

if (rhinoList2.Count != 0)
{
return rhinoList2.ToArray();
}

return null;
}
``````

Hi @xliotx,

Knowing this is the behavior, you should be able remap the output curves, correct?

– Dale

Yes. But it is much easier to use `Trim[t0, t1]` and iterate over the list in my case then. Still `O(n)` stuff.

Will this bug be fixed? (It seems to be a legacy bug from a long time ago…)