2
$\begingroup$

How does one translate coordinates from $[-1,1]$ to $[0,1]$? That is, 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?

  • 0
    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...2012-04-23
  • 0
    See also: http://math.stackexchange.com/questions/1130754/one-to-one-function-between-0-1-and-0-2-how-to-prove-or-disprove2015-02-17

1 Answers 1