Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add a scale_linear function, for linear interpolation between and inp…
…ut domain and output range
- Loading branch information
1 parent
bedd99e
commit 23a7ebf
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h3>scale_linear() function</h3> | ||
Transforms a given value from an input domain to an output range using linear interpolation. | ||
|
||
<p><h4>Syntax</h4> | ||
scale_linear(<i>val</i>,<i>domain_min</i>,<i>domain_max</i>,<i>range_min</i>,<i>range_max</i>)</p> | ||
|
||
<p><h4>Arguments</h4> | ||
<!-- List args for functions here--> | ||
<i> val</i> → is a value in the input domain. The function will return a corresponding scaled value in the output range.<br> | ||
<i> domain_min, domain_max</i> → specify the input domain, the smallest and largest values the input <i>val</i> should take.<br> | ||
<i> range_min, range_max</i> → sepcify the output range, the smallest and largest values which should be output by the function.<br> | ||
|
||
<h4>Example</h4> | ||
<!-- Show example of function.--> | ||
scale_linear(5,0,10,0,100) → 50<br> | ||
scale_linear(0.2,0,1,0,360) → 72 <i>(eg, scaling a value between 0 and 1 to an angle between 0 and 360)</i><br> | ||
scale_linear(1500,1000,10000,9,20) → 10.22 <i>(eg, scaling a population which varies between 1000 and 10000 to a font size between 9 and 20)</i><br> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters