Normalize
(Engine-Level Function)
Description: | Returns a normalized value. |
Returns: | Nothing |
Usage: | Steady State only. |
Function Groups: | Graphics |
Related to: | Limit | Scale | Tag |
Format: | Normalize(Value, LowScale, HighScale) |
Parameters: |
Value |
Required. Any numeric expression which represents the value to normalize. |
LowScale |
Required. Any numeric expression, which represents the lowest normal scaled value of Value. This is not a limit. |
HighScale |
Required. Any numeric expression, which represents the highest normal scaled value of Value. This is not a limit. |
Comments: |
This function encapsulates an expression with low and high scale values. Typically, this is used in a trajectory, rotation or layered graphics function for scaling. The return value is a Normalize value. The function does not limit the value to be within the range defined by LowScale and HighScale, but rather, makes it such that when Value equals HighScale the object (if using in a layered graphics function) will fill its bounding box. If Value exceeds HighScale, the object will extend past its bounding box. For example: Valid(Normalize(Invalid, 1, 2)) will evaluate to 1 (true) and ValueType(Valid(Normalize(Invalid, 1, 2))) will evaluate to 21 - a normalize value. |
Example:
GUIRectangle(0, 100, 100, 0 { Bounding box of rectangle }, 1, 1, 1 { No scaling of left, bottom or right }, Normalize(reactorTemp, 0, 150), 1 { Scale top only, not whole object }, 0, 0 { No trajectory or rotation }, 1, 0 { Rectangle is visible; reserved }, 0, 0, 0 { Cannot be focused }, 12, 15 { Bright red outlined in white });
The variable reactorTemp will be scaled for upper and lower values of 0 and 150. As the value of reactorTemp changes, the top of the rectangle will move proportionately. If it exceeds 150, the top of the rectangle will move outside of the original bounding box.