pcut_uwp/PCUT/DeepNestLib.Core/Extensions.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2024-08-21 16:02:56 +00:00
using System;
using System.Collections.Generic;
namespace DeepNestLib
{
public static class Extensions
{
public static T[] splice<T>(this T[] p, int a, int b)
{
List<T> ret = new List<T>();
for (int i = 0; i < p.Length; i++)
{
if (i >= a && i < (a + b)) continue;
ret.Add(p[i]);
}
return ret.ToArray();
}
public static List<List<ClipperLib.IntPoint>> splice(this List<List<ClipperLib.IntPoint>> p, int a, int b)
{
List<List<ClipperLib.IntPoint>> ret = new List<List<ClipperLib.IntPoint>>();
for (int i = a; i < (a + b); i++)
{
if (i >= a && i < (a + b)) continue;
ret.Add(p[i]);
}
return ret;
}
public static NFP[] splice(this NFP[] p, int a, int b)
{
List<NFP> ret = new List<NFP>();
for (int i = 0; i < p.Length; i++)
{
if (i >= a && i < (a + b)) continue;
ret.Add(p[i]);
}
return ret.ToArray();
}
}
}