in Transform360/Library/VideoFrameTransform.cpp [154:182]
static double getEffectiveRatio(double angularDist, double offset, double fov) {
double majorAxisScaling;
if (angularDist - kEpsilon > fov / 2) {
if (angularDist + fov / 2 > M_PI) {
double edge1 = samplingArc(offset,
(2 * M_PI - angularDist - fov / 2) * 2) / 2;
double edge2 = samplingArc(offset, (angularDist - fov / 2) * 2) / 2;
majorAxisScaling = (2 * M_PI - edge1 - edge2) / fov;
} else {
majorAxisScaling = (samplingArc(offset, 2 * angularDist + fov) -
samplingArc(offset, 2 * angularDist - fov)) / 2 / fov;
}
} else {
majorAxisScaling = (samplingArc(offset, 2 * angularDist + fov) +
samplingArc(offset, fov - 2 * angularDist)) / 2 / fov;
}
double distToCoVertex = angularDistance(
angularDist,
0.5 * fov,
0.0,
0.0);
double minorAxisScaling = samplingArc(
offset, distToCoVertex * 2) / (distToCoVertex * 2);
return min(
majorAxisScaling * minorAxisScaling * sphericalArea(fov) / kSphereArea,
1.0);
}