corrade-vassal – Blame information for rev 16

Subversion Repositories:
Rev:
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 {
16 eva 9 public static class Numerics
13 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>
14 zed 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>
16 eva 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 }
13 eva 30 }
31 }