Conformal mapping from quadrics to the plane

48 Views Asked by At

I am writing a raytracer (a type of 3D engine) to render quadrics, and I am working on rendering a one-sheeted hyperboloid defined by the zero set of $x^2-y^2+z^2=1$. I need 2D coordinates $a \in [0, 1]$ and $b \in (-\infty, \infty)$ on the surface of the hyperboloid so that I can draw a square grid on its surface.

The aforementioned hyperboloid is the surface of revolution of the rectangular hyperbola defined by $x^2- y^2=1$. Therefore, it can be parameterized by the following:

$\mathbf{S}(u,v)=\left< \cosh(u)\cos(v), \cosh(u)\sin(v),\sinh(u)\right>$, with $u \in (-\infty, \infty)$ and $v \in [0, 2 \pi]$.

I can thus obtain $u$ and $v$ from a given point $\mathbf{p} = \left<x,y,z\right>$ on the surface, then remapped to the coordinates $a$ and $b$ which lie in the desired ranges:

$a = \frac{1}{2\pi}\left(\pi+\tan^{-1}\left(\frac{z}{x}\right)\right),\\ b = \text{arsinh}(y)$

My thought was that this can be used directly as coordinates for the grid. However, when I implement this in code, the grid cells appear distorted, as in the first image. I would like to get something like the second image. texture coordinates desired outcome

Specifically, I need a conformal mapping from the aforementioned hyperboloid to the plane.

Also, is there a way to generalize this to other quadrics (i.e. the two-sheeted hyperboloid and paraboloid)?

1

There are 1 best solutions below

0
On

The given parameterization already has the favorable property of orthogonality of the coordinates: At each point the coordinate vector fields ${\bf S}_u$ and ${\bf S}_v$ are orthogonal. To find conformal coordinates ${\bf T}(u, v)$, it's enough to rescale the coordinate along the meridians ($u$)---that is, write $${\bf T}(u, v) = {\bf S}(f(u), v) = (\cosh f(u) \cos 2 \pi v, \cosh f(u) \sin 2 \pi v, \sinh f(u))$$ ---so that at each parallel (line of latitude) the scale factors in the $u$ and $v$ directions agree, that is, satisfy $|{\bf T}_u| = |{\bf T}_v|$.

Computing gives that the scale factors are $$|{\bf T}_u| = |f'(u)| \sqrt{2 \cosh^2 f(u) - 1} \qquad \textrm{and} \qquad |{\bf T}_v| = 2 \pi \cosh f(u),$$ so equating those quantities (and requiring $f'(u) > 0$) gives a separable ordinary differential equation, $$\frac{\sqrt{2 \cosh^2 f - 1}}{2 \pi \cosh f} df = du ;$$ We may as well impose the symmetry constraint $f(0) = 0$ as a boundary condition.

In summary, finding our conformal parameterization ${\bf T}$ is just a matter of solving this equation.

The left-hand side can be integrated in terms of elementary functions, but it's a little messy. Substituting $w = \sinh f, dw = \cosh f\,df$ gives $$\frac{1}{2 \pi} \int \frac{\sqrt{2 \cosh^2 f - 1}}{\cosh f} df = \frac{1}{2\pi} \int \frac{\sqrt{2 w^2 + 1}}{w^2 + 1}\,dw,$$ after which the Euler Substitution $\sqrt{2 w^2 + 1} = y - \sqrt{2} w$ rationalizes the integral: $$\frac{1}{\sqrt 2 \pi} \int \frac{(y^2 + 1)^2 dy}{y (y^4 + 6 y^2 + 1)} .$$ The partial fractions decomposition is favorable, $$\frac{1}{\sqrt 2 \pi} \int \left(\frac{1}{y} - \frac{4 y}{y^4 + 6 y^2 + 1}\right) \,dy,$$ and the second summand can be evaluated by applying the substitution $z = y^2$ and then using a standard hyperbolic substitution. The result is: $$u = \frac{1}{2 \pi} \left[\sqrt{2} \operatorname{arsinh} (\sqrt{2} \sinh f) + \operatorname{arcoth}\left(\sqrt{2} \cosh^2 f + \sinh f \sqrt{\cosh 2 f} + \sqrt{2}\right) - \operatorname{arsinh}1\right].$$ It's plausible that the $\operatorname{arcoth}$ term can be simplified, but either way it seems unlikely that $f$ can be expressed explicitly as a function of $u$ in terms of elementary functions.

All that said, as $u \to \pm \infty$, $f$ behaves approximately linearly: $$f(u) = \sqrt{2} \pi u \pm \frac{\sqrt{2} \operatorname{arsinh} 1 - \log 2}{2} + (\textrm{lower-order terms}) .$$ This behavior shouldn't be surprising, since points with large $u$ are far from the vertices of the generating hyperbola, where the tangent line approximation is very good.

Indeed, replacing $f(u)$ with $\sqrt{2} \pi u$ gives an approximation that is very nearly conformal except in the immediate vicinity of $u = 0$, so that approximation may be adequate for plotting purposes. In the below plot the red curve is the plot of $u$ as a function of $f$, and the blue line is the approximation $f(u) = \sqrt{2} \pi u$.

enter image description here

The below plot of the hyperboloid uses ${\bf T}$ with the approximation $f(u) = \sqrt 2 \pi u$ with $u \in \left[-\frac12, \frac12\right]$, and gridlines equally spaced in the $uv$-plane ($\Delta u = \Delta v \approx \frac1{20}$).

enter image description here

The same process to be applied to any surface of revolution using the usual angular and latitude coordinates.