Hey there!

If I understand the question correctly, you're just looking for a way to convert a value that falls in the range [0,1] to an "equivalent" value in the range [-1,1].

If that's the case, it's not too bad! Simply double your initial value (putting it into the range [0,2]), and then subtract 1.

This is a bit of a simplification of the general way to do this, which involves normalizing the value and then converting it to the new range. That looks something like this:

Where "a" is the original range (bounded by aMax and aMin and containing your original value, vA) and "b" is the target range (bounded by bMax and bMin and containing the value you're trying to get, vB).

The first part of the equation basically figures out how far along you are in the original range. It does this by subtracting the first range's offset from zero, then dividing by the size of that range. This basically gives you a "percent" to work with. That value gets multiplied by how big the target range is, and offset by the new range's offset.

Hope that helps!

Bryant

answered **
Apr 26 '19 at 07:47 PM **

Bryant_PSC

31
●
1
●
2
●
9