corrade-vassal – Blame information for rev 13
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
13 | 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 | { |
||
9 | public class Numerics |
||
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> |
||
18 | /// <param name="value">the value to map</param> |
||
19 | /// <param name="xMin">the lower bound of the source range</param> |
||
20 | /// <param name="xMax">the upper bound of the source range</param> |
||
21 | /// <param name="yMin">the lower bound of the target range</param> |
||
22 | /// <param name="yMax">the upper bound of the target range</param> |
||
23 | public static double MapValueToRange(double value, double xMin, double xMax, double yMin, double yMax) |
||
24 | { |
||
25 | return yMin + ( |
||
26 | ( |
||
27 | yMax - yMin |
||
28 | ) |
||
29 | * |
||
30 | ( |
||
31 | value - xMin |
||
32 | ) |
||
33 | / |
||
34 | ( |
||
35 | xMax - xMin |
||
36 | ) |
||
37 | ); |
||
38 | } |
||
39 | } |
||
40 | } |