# Hyperbolic Uniformization Metrics

I have been working Euclidean Ricci Flow but have been having considerable trouble trying to implement the same discrete gradient descent functionality in hyperbolic space.

I am following the proposed algorithm at the end of "Computing Teichmuller Shape Space" but the algorithm fails very quickly due to the $\operatorname{acos}$ function's $[-1, +1]$ bounds.

If anyone could confirm that I am using the proper equations it would be very helpful.

Pre Processing (circle packing generation):  1) compute vertex radius $$\gamma_i = \frac{l_{ij} + l_{ki} - l_{jk}}{2}$$ where $l_{xy}$ is the euclidean distance between two points  2) compute edge weight $\Phi_{ij}$ vai the hyperbolic cosine law $$\cosh l_{ij} = \cosh \gamma_i \cosh \gamma_j + \sinh \gamma_i \sinh \gamma_j \cos\Phi_{ij}$$ as such I am using: $$\Phi_{ij} = \operatorname{acos}\frac{\cosh \gamma_i \cosh \gamma_j - \cosh l_{ij}}{-\sinh \gamma_i * \sinh \gamma_j}$$

Main Loop (gradient descent):  1) compute new edge length $l_{ij}$ using the inverse of the hyperbolic cosine law: $$l_{ij} = \operatorname{arccosh}(\cosh \gamma_i \cosh \gamma_j + \sinh \gamma_i \sinh \gamma_j \cos\Phi_{ij})$$

2) compute the corner angles $\theta_i^{jk}$ of every face using the hyperbolic cosine law: $$\theta_i^{jk} = \operatorname{acos}\left(\frac{\cosh l_{ij} \cosh l_{ki} - \cosh l_{jk}}{\sinh l_{ij} \sinh l_{ki}}\right)$$

3) compute the angle deficit at every vertex (easy)

4) update $y_i$ based on the difference of target and current gaussian curvature (easy)

5) loop while max error > allowed error (easy)

-