CurveSampler.FindRangeContainingOffset

FindRangeContainingOffset<T>(this IEnumerable<(float Key, T Value)>, float)

Given a sequence of float+T pairs and an offset, it finds two consecutive values that contain offset between them.

public static (T A, T B, float Amount) FindRangeContainingOffset<T>(
    this IEnumerable<(float Key, T Value)> sequence, float offset)
ParameterDescription
TThe value type
sequenceA sequence of float+T pairs sorted in ascending order.
offsetthe offset to look for in the sequence.

Return Value

Two consecutive T values and a float amount to LERP amount.

See Also


FindRangeContainingOffset(IEnumerable<float>, float)

Given a sequence of offsets and an offset, it finds two consecutive offsets that contain offset between them.

public static (float A, float B, float Amount) FindRangeContainingOffset(
    IEnumerable<float> sequence, float offset)
ParameterTypeDescription
sequenceIEnumerable`1A sequence of offsets sorted in ascending order.
offsetSinglethe offset to look for in the sequence.

Return Value

Two consecutive offsets and a LERP amount.

See Also