wasSharp – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
5 | eva | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
5 | /////////////////////////////////////////////////////////////////////////// |
||
6 | |||
7 | namespace wasSharp |
||
8 | { |
||
7 | office | 9 | public static class Numerics |
5 | eva | 10 | { |
11 | /////////////////////////////////////////////////////////////////////////// |
||
12 | // Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 // |
||
13 | /////////////////////////////////////////////////////////////////////////// |
||
14 | /// <summary> |
||
15 | /// Given a value in a source value range and a target range, map |
||
16 | /// the value from the source range into the target range. |
||
17 | /// </summary> |
||
6 | eva | 18 | /// <remarks> |
19 | /// value - the value to map |
||
20 | /// xMin - the lower bound of the source range |
||
21 | /// xMax - the upper bound of the source range |
||
22 | /// yMin - the lower bound of the target range |
||
23 | /// yMax - the upper bound of the target range |
||
24 | /// </remarks> |
||
25 | /// <returns>a value in x mapped in the range of y</returns> |
||
7 | office | 26 | public static double MapValueToRange(double value, double xMin, double xMax, double yMin, double yMax) |
27 | { |
||
28 | return yMin + (yMax - yMin)*(value - xMin)/(xMax - xMin); |
||
29 | } |
||
5 | eva | 30 | } |
31 | } |