in Transform360/Library/VideoFrameTransform.cpp [835:901]
void VideoFrameTransform::transformCubeFacePos(
float tx,
float ty,
float tz,
float *outX,
float *outY
) {
float x, y;
if (tz <= -kCubemapSideDistance) {
x = tx / tz;
y = ty / tz;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (5.0f + x / ctx_.input_expand_coef) / 6.0f;
*outY = (3.0f + y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
if (tz >= kCubemapSideDistance) {
x = tx / tz;
y = ty / tz;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (3.0f + x / ctx_.input_expand_coef) / 6.0f;
*outY = (3.0f - y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
if (tx <= -kCubemapSideDistance) {
x = tz / tx;
y = ty / tx;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (3.0f - x / ctx_.input_expand_coef) / 6.0f;
*outY = (1.0f + y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
if (tx >= kCubemapSideDistance) {
x = tz / tx;
y = ty / tx;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (1.0f - x / ctx_.input_expand_coef) / 6.0f;
*outY = (1.0f - y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
if (ty <= -kCubemapSideDistance) {
x = tx / ty;
y = tz / ty;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (1.0f - x / ctx_.input_expand_coef) / 6.0f;
*outY = (3.0f + y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
if (ty >= kCubemapSideDistance) {
x = tx / ty;
y = tz / ty;
if (x >= -1.0 && x <= 1.0 && y >= -1.0 && y <= 1.0) {
*outX = (5.0f + x / ctx_.input_expand_coef) / 6.0f;
*outY = (1.0f + y / ctx_.input_expand_coef) / 4.0f;
return;
}
}
// Return outside coordinates.
*outX = -1.0f;
*outY = 0.0f;
}