blob: adbe90a609954e30ca5540a5847ee3189b30cf53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}
}
}
|