Volume Control
Application-specific hotkeys for Windows
VolumeControl.TypeExtensions.MathExt Class Reference

Methods for various mathematics operations not covered by Math More...

Collaboration diagram for VolumeControl.TypeExtensions.MathExt:

Static Public Member Functions

static T Clamp< T > (T value, T min, T max)
 Clamps value within the range ( min - max ) More...
 
static int Scale (int input, int inRangeMin, int inRangeMax, int outRangeMin, int outRangeMax)
 Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ). More...
 
static int Scale (int input,(int, int) inRange,(int, int) outRange)
 Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ). More...
 
static long Scale (long input, long inRangeMin, long inRangeMax, long outRangeMin, long outRangeMax)
 Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ). More...
 
static long Scale (long input,(long, long) inRange,(long, long) outRange)
 Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ). More...
 
static float Scale (float input, float inRangeMin, float inRangeMax, float outRangeMin, float outRangeMax)
 Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ). More...
 
static float Scale (float input,(float, float) inRange,(float, float) outRange)
 Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ). More...
 
static double Scale (double input, double inRangeMin, double inRangeMax, double outRangeMin, double outRangeMax)
 Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ). More...
 
static double Scale (double input,(double, double) inRange,(double, double) outRange)
 Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ). More...
 

Detailed Description

Methods for various mathematics operations not covered by Math

Member Function Documentation

◆ Clamp< T >()

static T VolumeControl.TypeExtensions.MathExt.Clamp< T > ( value,
min,
max 
)
static

Clamps value within the range ( min - max )

The min and max boundary values are inclusive.

Template Parameters
TAny numerical type.
Parameters
valueThe value to clamp.
minThe minimum allowable value.
Must be less than max , or an exception will be thrown.
maxThe maximum allowable value.
Must be greater than min , or an exception will be thrown.
Exceptions
ArgumentOutOfRangeExceptionmin is greater than max .
Returns
value between min and max .
Type Constraints
T :IComparable 
T :IComparable<T> 
T :IConvertible 
T :IEquatable<T> 
T :ISpanFormattable 
T :IFormattable 

◆ Scale() [1/8]

static double VolumeControl.TypeExtensions.MathExt.Scale ( double  input,
double  inRangeMin,
double  inRangeMax,
double  outRangeMin,
double  outRangeMax 
)
static

Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ).

Parameters
inputThe input number
inRangeMinThe minimum boundary of the range that input is within.
inRangeMaxThe maximum boundary of the range that input is within.
outRangeMinThe minimum boundary of the output range.
outRangeMaxThe minimum boundary of the output range.
Returns
Equivalent value of input were it to be within the range ( outRangeMin - outRangeMax )

◆ Scale() [2/8]

static double VolumeControl.TypeExtensions.MathExt.Scale ( double  input,
(double, double)  inRange,
(double, double)  outRange 
)
static

Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ).

See Scale(double,double,double,double,double) for an overload that doesn't use tuples.

Parameters
inputThe input number
inRangeThe range that input is within.
outRangeThe range to translate input to.
Returns
Equivalent value of input were it to be within the range ( outRange .Item1 - outRange .Item2 )

◆ Scale() [3/8]

static float VolumeControl.TypeExtensions.MathExt.Scale ( float  input,
float  inRangeMin,
float  inRangeMax,
float  outRangeMin,
float  outRangeMax 
)
static

Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ).

Parameters
inputThe input number
inRangeMinThe minimum boundary of the range that input is within.
inRangeMaxThe maximum boundary of the range that input is within.
outRangeMinThe minimum boundary of the output range.
outRangeMaxThe minimum boundary of the output range.
Returns
Equivalent value of input were it to be within the range ( outRangeMin - outRangeMax )

◆ Scale() [4/8]

static float VolumeControl.TypeExtensions.MathExt.Scale ( float  input,
(float, float)  inRange,
(float, float)  outRange 
)
static

Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ).

See Scale(float,float,float,float,float) for an overload that doesn't use tuples.

Parameters
inputThe input number
inRangeThe range that input is within.
outRangeThe range to translate input to.
Returns
Equivalent value of input were it to be within the range ( outRange .Item1 - outRange .Item2 )

◆ Scale() [5/8]

static int VolumeControl.TypeExtensions.MathExt.Scale ( int  input,
int  inRangeMin,
int  inRangeMax,
int  outRangeMin,
int  outRangeMax 
)
static

Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ).

Parameters
inputThe input number
inRangeMinThe minimum boundary of the range that input is within.
inRangeMaxThe maximum boundary of the range that input is within.
outRangeMinThe minimum boundary of the output range.
outRangeMaxThe minimum boundary of the output range.
Returns
Equivalent value of input were it to be within the range ( outRangeMin - outRangeMax )

◆ Scale() [6/8]

static int VolumeControl.TypeExtensions.MathExt.Scale ( int  input,
(int, int)  inRange,
(int, int)  outRange 
)
static

Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ).

See Scale(int, int, int, int, int) for an overload that doesn't use tuples.

Parameters
inputThe input number
inRangeThe range that input is within.
outRangeThe range to translate input to.
Returns
Equivalent value of input were it to be within the range ( outRange .Item1 - outRange .Item2 )

◆ Scale() [7/8]

static long VolumeControl.TypeExtensions.MathExt.Scale ( long  input,
long  inRangeMin,
long  inRangeMax,
long  outRangeMin,
long  outRangeMax 
)
static

Accepts input , a number in the range ( inRangeMin - inRangeMax ), and translates it to be within the range ( outRangeMin - outRangeMax ).

Parameters
inputThe input number
inRangeMinThe minimum boundary of the range that input is within.
inRangeMaxThe maximum boundary of the range that input is within.
outRangeMinThe minimum boundary of the output range.
outRangeMaxThe minimum boundary of the output range.
Returns
Equivalent value of input were it to be within the range ( outRangeMin - outRangeMax )

◆ Scale() [8/8]

static long VolumeControl.TypeExtensions.MathExt.Scale ( long  input,
(long, long)  inRange,
(long, long)  outRange 
)
static

Accepts input , a number in the range ( inRange .Item1 - inRange .Item2 ), and translates it to be within the range ( outRange .Item1 - outRange .Item2 ).

See Scale(long, long, long, long, long) for an overload that doesn't use tuples.

Parameters
inputThe input number
inRangeThe range that input is within.
outRangeThe range to translate input to.
Returns
Equivalent value of input were it to be within the range ( outRange .Item1 - outRange .Item2 )

The documentation for this class was generated from the following file: