Calculate UV Coordinates of a disk (annulus) from parametric form

1k Views Asked by At

Given a point on a disk (or rather a annulus in this case) I want to calculate the corresponding uv-coordinates, well only the v-coordinate.

Given the parametric equation for a annulus, as defined by the book "physically based rendering theory" (pbrt-v3) is: $$ \begin{align}\\ \phi &= u \phi_{max} \\ x &= ((1-v)r_i + vr) \cos \phi \\ y &= ((1-v)r_i + vr) \sin \phi \\ z &= h \end{align}$$

Where $r_i$ is the inner-radius, $r$ is the outer radius, $\phi_{max}$ is for a partial disk and $h$ is the height. since the example is taken from a book I know the answer:

$$ v = 1 - \frac{ \sqrt{x^2 + y^2} - r_i}{r - r_i}$$

However I have trouble to derive this equation from the parametric from given above:

\begin{align} x &= ((1-v)r_i +vr) \cos \phi \iff \frac{x}{\cos\phi (r - r_i)} - \frac{r_i}{r - r_i} \\ \end{align}

since $\cos \phi = \frac{y}{r}$, further $ r = \sqrt{x^2 + y^2} $, in this case since we already assume that point is on the annulus (which itself lies in the xy-plane).

$$ \iff \frac{xr -y r_i}{y(r - ri)} $$

This is the point I am stuck at, I hope someone can point me in the right direction or even solve to get to the equation above.

1

There are 1 best solutions below

1
On BEST ANSWER

Whenever you see a sine and cosine of the same angle, each multiplied by the same factor, think about whether you can use the formula $\sin^2 \phi + \cos^2 \phi = 1.$

In this case, if you just take your formulas for $x$ and $y,$ square both sides, and add, you get \begin{align} x^2 + y^2 &= ((1-v)r_i + vr)^2 \cos^2 \phi + ((1-v)r_i + vr)^2 \sin^2 \phi\\ &= ((1-v)r_i + vr)^2 (\cos^2 \phi + \sin^2 \phi)\\ &= ((1-v)r_i + vr)^2 . \end{align}

I suppose $r,$ $r_i,$ and $v$ have all been defined in such a way that $(1-v)r_i +vr$ is guaranteed not to be negative (for example, we may have required $r \geq 0,$ $r_i \geq 0,$ and $0 \leq v \leq 1$). If so, you can conclude that $$ \sqrt{x^2 + y^2} = (1-v)r_i + vr, $$ and now you have a single equation in one unknown, $v,$ which you can solve by simple algebraic manipulation.


By the way, notice in this problem that it is not true that $r = \sqrt{x^2 + y^2}.$ That equation would be true if we called $(r,\theta)$ the polar coordinates of the point with Cartesian coordinates $(x,y),$ but it is clear that in this problem the symbol $r$ is being used for something completely different.