Click or drag to resize

CrestronEnvironmentScaleWithLimits(UInt32, UInt32, UInt32, UInt32, UInt32) Method

Scales a given input value that lies between a given set of input limits to an output value given a set of output limits. This version works on unsigned integer arguments.

Namespace: Crestron.SimplSharp
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public static uint ScaleWithLimits(
	uint InputValue,
	uint InputUpperBound,
	uint InputLowerBound,
	uint OutputUpperBound,
	uint OutputLowerBound
)

Parameters

InputValue  UInt32
The uint input value to be converted.
InputUpperBound  UInt32
The uint upper boundary of the domain from which the input value is to be converted.
InputLowerBound  UInt32
The uint lower boundary of the domain from which the input value is to be converted.
OutputUpperBound  UInt32
The uint upper boundary of the range into which the input value is to be converted.
OutputLowerBound  UInt32
The uint lower boundary of the range into which the input value is to be converted.

Return Value

UInt32

A scaled int value from the equation :

OutputValue = OutputLowerBound + (( (InputValue - InputLowerBound) * (OutputUpperBound - OutputLowerBound) ) / (InputUpperBound - InputLowerBound))

Exceptions
ExceptionCondition
ArgumentOutOfRangeException

Cause: InputLowerBound >= InputUpperBound

Cause: OutputLowerBound > OutputUpperBound

Cause: InputUpperBound == InputLowerBound.

Output overflow. (See message for overflow value.)

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also