From 42dc1d36235292786322d28340a81c6cb3fd46c0 Mon Sep 17 00:00:00 2001 From: hurter Date: Wed, 31 Aug 2011 16:25:05 +0000 Subject: --- Data/MathTools.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Data/MathTools.cs (limited to 'Data/MathTools.cs') diff --git a/Data/MathTools.cs b/Data/MathTools.cs new file mode 100644 index 0000000..adbe90a --- /dev/null +++ b/Data/MathTools.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Data +{ + public class MathTools + { + + static public float GenericScaleF(float input, float i1, float o1, float i2, float o2) + { + if (i2 == i1) return ((o2 + o1) / 2.0f); + float a = (o2 - o1) / (i2 - i1); + float b = o1 - a * i1; + return (a * input + b); + } + } +} -- cgit v1.1