Class IntervalExtensions
Inheritance
IntervalExtensions
Assembly: Acoustics.Shared.dll
Syntax
public static class IntervalExtensions
Methods
|
Improve this Doc
View Source
Add(Interval<Double>, Interval<Double>)
Declaration
public static Interval<double> Add(this Interval<double> rangeA, Interval<double> rangeB)
Parameters
Returns
|
Improve this Doc
View Source
AsInterval<T>((T Minimum, T Maximum), Topology)
Declaration
public static Interval<T> AsInterval<T>(this (T Minimum, T Maximum) pair, Topology topology = Topology.LeftClosedRightOpen)
where T : struct, IComparable<T>, IFormattable
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
AsIntervalFromZero<T>(T, Topology)
Declaration
public static Interval<T> AsIntervalFromZero<T>(this T maximum, Topology topology = Topology.LeftClosedRightOpen)
where T : struct, IComparable<T>, IFormattable
Parameters
Type |
Name |
Description |
T |
maximum |
|
Topology |
topology |
|
Returns
Type Parameters
|
Improve this Doc
View Source
AsIntervalTo<T>(T, T, Topology)
Declaration
public static Interval<T> AsIntervalTo<T>(this T minimum, T maximum, Topology topology = Topology.LeftClosedRightOpen)
where T : struct, IComparable<T>, IFormattable
Parameters
Type |
Name |
Description |
T |
minimum |
|
T |
maximum |
|
Topology |
topology |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Center(Interval<Double>)
Declaration
public static double Center(this Interval<double> range)
Parameters
Returns
|
Improve this Doc
View Source
Center(Interval<TimeSpan>)
Declaration
public static TimeSpan Center(this Interval<TimeSpan> range)
Parameters
Returns
|
Improve this Doc
View Source
Clamp(Double, Interval<Double>)
Restricts a Double to be within a specified range.
Declaration
public static double Clamp(this double value, Interval<double> range)
Parameters
Type |
Name |
Description |
Double |
value |
The The value to clamp.
|
Interval<Double> |
range |
The interval to clamp the value to.
|
Returns
Type |
Description |
Double |
The Double representing the clamped value.
|
|
Improve this Doc
View Source
ClampvValue(Interval<Double>, Double)
Restricts a Double to be within a specified range.
Declaration
public static double ClampvValue(this Interval<double> range, double value)
Parameters
Type |
Name |
Description |
Interval<Double> |
range |
The interval to clamp the value to.
|
Double |
value |
The The value to clamp.
|
Returns
Type |
Description |
Double |
The Double representing the clamped value.
|
|
Improve this Doc
View Source
Divide(Interval<Double>, Interval<Double>)
Declaration
public static Interval<double> Divide(this Interval<double> rangeA, Interval<double> rangeB)
Parameters
Returns
|
Improve this Doc
View Source
Grow(Interval<Double>, Interval<Double>, Double, Nullable<Int32>)
Greedily grow the current interval to the new duration without exceeding the limits.
Will grow the range around the center of the current range if possible.
Will not fail, and will return as much range as possible, without exceeding limits.
Declaration
public static Interval<double> Grow(this Interval<double> range, Interval<double> limits, double growAmount, int? roundDigits = default(int? ))
Parameters
Returns
|
Improve this Doc
View Source
Invert(Interval<Double>)
Declaration
public static Interval<double> Invert(this Interval<double> range)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(Interval<Double>, Interval<Double>)
Declaration
public static Interval<double> Multiply(this Interval<double> rangeA, Interval<double> rangeB)
Parameters
Returns
|
Improve this Doc
View Source
Normalize(Double, Interval<Double>)
Normalizes a value as a unit value given the bounds of an interval.
Declaration
public static double Normalize(this double value, Interval<double> range)
Parameters
Type |
Name |
Description |
Double |
value |
The value to normalize.
|
Interval<Double> |
range |
The interval to use as the bounds.
|
Returns
Type |
Description |
Double |
A value scaled to [0,1]. The value may exceed the bounds [0,1]; i.e. the value is not clamped.
|
|
Improve this Doc
View Source
NormalizeValue(Interval<Double>, Double)
Normalizes a value as a unit value given the bounds of an interval.
Declaration
public static double NormalizeValue(this Interval<double> range, double value)
Parameters
Type |
Name |
Description |
Interval<Double> |
range |
The interval to use as the bounds.
|
Double |
value |
The value to normalize.
|
Returns
Type |
Description |
Double |
A value scaled to [0,1]. The value may exceed the bounds [0,1]; i.e. the value is not clamped.
|
|
Improve this Doc
View Source
Shift(Interval<Double>, Double)
Declaration
public static Interval<double> Shift(this Interval<double> range, double shift)
Parameters
Returns
|
Improve this Doc
View Source
Shift(Interval<TimeSpan>, TimeSpan)
Declaration
public static Interval<TimeSpan> Shift(this Interval<TimeSpan> range, TimeSpan shift)
Parameters
Returns
|
Improve this Doc
View Source
Size(Interval<Double>)
Declaration
public static double Size(this Interval<double> range)
Parameters
Returns
|
Improve this Doc
View Source
Size(Interval<TimeSpan>)
Declaration
public static TimeSpan Size(this Interval<TimeSpan> range)
Parameters
Returns
|
Improve this Doc
View Source
Subtract(Interval<Double>, Interval<Double>)
Declaration
public static Interval<double> Subtract(this Interval<double> rangeA, Interval<double> rangeB)
Parameters
Returns