Class EnumerableUtil
- Namespace
- Hi.Common.Collections
- Assembly
- HiGeom.dll
Utility class providing extension methods for enumerable collections.
public static class EnumerableUtil
- Inheritance
-
EnumerableUtil
- Inherited Members
Methods
GetIntensiveItems<TItem>(IEnumerable<TItem>, double, Func<TItem, double>)
Gets a collection of items with additional interpolated items inserted where the distance between consecutive items exceeds a specified resolution.
public static IEnumerable<TItem> GetIntensiveItems<TItem>(this IEnumerable<TItem> src, double resolution, Func<TItem, double> keyFunc) where TItem : IAdditionOperators<TItem, TItem, TItem>, ISubtractionOperators<TItem, TItem, TItem>, IMultiplyOperators<TItem, double, TItem>, IDivisionOperators<TItem, double, TItem>
Parameters
srcIEnumerable<TItem>The source collection.
resolutiondoubleThe maximum allowed distance between consecutive items.
keyFuncFunc<TItem, double>A function that extracts a double value from an item, used to measure the distance between items.
Returns
- IEnumerable<TItem>
A collection containing the original items and additional interpolated items where needed.
Type Parameters
TItemThe type of items in the collection, which must support arithmetic operations.
Remarks
This method ensures that the distance between consecutive items in the resulting collection does not exceed the specified resolution. When the distance between two consecutive items in the source collection exceeds the resolution, additional items are interpolated between them.