Difference between revisions of "SHIP:Sail:mapRange"

From Serious Documentation
Jump to: navigation, search
 
Line 51: Line 51:
 
|}
 
|}
  
[[Categories:Numeric Functions]]
+
[[Category:Numeric Functions]]

Latest revision as of 15:13, 10 October 2016


Function Returns Introduced Description
mapRange Integer v5.1.0 Maps a number from range A to range B.

See Also:

Prototype

Integer mapRange(Integer/Float n, Integer/Float A1, Integer/Float A2, Integer/Float B1, Integer/Float B2,);


Parameters/Return Value

Parameter Data Type Description
n Integer/Float Input number, relative to range A, to be mapped
A1 Integer/Float Endpoint 1 of range A
A2 Integer/Float Endpoint 2 of range A
B1 Integer/Float Endpoint 1 of range B
B2 Integer/Float Endpoint 2 of range B
Return Integer the mapped range B value of n

Detailed Description

The mapRange(in, A1, A2, B1, B2) takes an input, in, and places it on the range A, then translates it to range B. The resulting value is returned.

Examples

Example Result Notes
mapRange(3, 0, 10, 0, 50);
15
mapRange(13, 0, 50, 0, 10);
3
mapRange(6.6, 0, 10.0f, 0, 100.0f);
66