  A new approach for constructing polar-like boundary-conforming coordinates
inside a toroid with strongly shaped cross-sections is presented. A coordinate
mapping is obtained through a variational approach, which involves identifying
extremal points of a proposed action in the mapping space from [0, 2{\pi}] x
[0, 2{\pi}] x [0, 1] to a toroidal domain in R3. This approach employs an
action built on the squared Jacobian and radial length. Extensive testing is
conducted on general toroidal boundaries using a global Fourier-Zernike basis
via action minimization. The results demonstrate successful coordinate
construction capable of accurately describing strongly shaped toroidal domains.
The coordinate construction is successfully applied to the computation of 3D
MHD equilibria in the GVEC code where the use of traditional coordinate
construction by interpolation from the boundary failed.
