I am new to rendering and I would like to calcualte UV partial derivatives of a cylinder shape, which is parameterized by radius $R$ and length $L$.
Using cylindrical coordinate mapping, for a surface point $\mathbf{p}=(x,y,z)$, the UV map (normalized to $[0,1]$) is: $$ (u,v) = \Big(\frac{\phi}{2\pi}, \frac{z}{L}\Big)\qquad \text{where} \quad \phi = \arctan \frac{y}{x} $$ Then I compute the derivatives with respect to $\mathbf{p}$, that is: $$ \begin{aligned} \frac{\partial u}{\partial \mathbf{p}} & = \frac{1}{2\pi R^2} \Big( -y, x, 0\Big) = \frac{1}{2\pi R} \Big( -\sin\phi, \cos\phi, 0\Big)\\ \frac{\partial v}{\partial \mathbf{p}} &= \Big( 0, 0, \frac{1}{L}\Big) \end{aligned} $$ Or equivalently: $$ \begin{aligned} \frac{\partial \mathbf{p}}{\partial u} & = 2\pi R \Big( -\frac{1}{\sin\phi}, \frac{1}{\cos\phi}, 0\Big)\\ \frac{\partial \mathbf{p}}{\partial v} &= \Big( 0, 0, L\Big) \end{aligned} $$ Everything looks good until now.
Question
In pbrt-3, the relevant part of cylinder.cpp
is: (i) UV same as above; (ii) $\partial \mathbf{p}/\partial u$ however is different:
Float u = phi / phiMax;
Float v = (pHit.z - zMin) / (zMax - zMin);
// Compute cylinder $\dpdu$ and $\dpdv$
Vector3f dpdu(-phiMax * pHit.y, phiMax * pHit.x, 0);
Vector3f dpdv(0, 0, zMax - zMin);
What am I missing here?