in h3_faceijk.c [438:473]
void _hex2dToGeo(const Vec2d *v, int face, int res, int substrate, LatLng *g) {
// calculate (r, theta) in hex2d
double r = _v2dMag(v);
if (r < EPSILON) {
*g = faceCenterGeo[face];
return;
}
double theta = atan2(v->y, v->x);
// scale for current resolution length u
for (int i = 0; i < res; i++) r *= M_RSQRT7;
// scale accordingly if this is a substrate grid
if (substrate) {
r *= M_ONETHIRD;
if (isResolutionClassIII(res)) r *= M_RSQRT7;
}
r *= RES0_U_GNOMONIC;
// perform inverse gnomonic scaling of r
r = atan(r);
// adjust theta for Class III
// if a substrate grid, then it's already been adjusted for Class III
if (!substrate && isResolutionClassIII(res))
theta = _posAngleRads(theta + M_AP7_ROT_RADS);
// find theta as an azimuth
theta = _posAngleRads(faceAxesAzRadsCII[face][0] - theta);
// now find the point at (r,theta) from the face center
_geoAzDistanceRads(&faceCenterGeo[face], theta, r, g);
}