Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Greetings to everyone!

I've been searching around and thinking about how one translates coordinates from $[-1,1]$ to $[0,1]$ with little success. I am hoping someone here could help me with my little "quest". Suppose we have an ordered pair $(x,y)$ which lies between $[-1,1]$ and want to push into the range delimited by $[0,1]$.

A lot of places does the transformation something like this:

$f(u) = ((u_1 + 1)/2)i + ((u_2 +1)/2)j$

I'm not even sure if I may express it this way (?), here's the usual expression:

$$x = (c_x + 1) / 2$$ $$y = (c_y + 1) / 2$$

I can see that that the addition of $1$ will force all the possible inputs into the $[0,2]$ range and that the division by the maximum of the range will force it to be expressed as a part of the whole, the whole being the dimensionless $1$, effectively expressing all values in the range of $[0,1]$.

Is this all there is to this? Just a heuristic, trial and error technique until you get what you want? Or is there a more obvious, better, formalized way?

share|improve this question
    
Looks good to me. $x=\left( (c_x+1)/2 \right)^m$, with $m\in\Bbb{N}_+$ would also do, but why not keeping simple things simple... –  draks ... Apr 23 '12 at 14:00

1 Answer 1

Yes, $t\mapsto (t+1)/2$ transforms $[-1,1]$ to $[0,1]$. That's all there is to it.

For the general case of transforming $[a,b]$ to $[c,d]$, you can write $t\mapsto ut+v$ and solve $ua+v=c$ and $ub+v=d$ to find $u$ and $v$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.