Nikolay Sivov (@nsivov) commented about dlls/d2d1/factory.c:
- float a1, a2, c, e;
- TRACE("mat %p stub.\n", mat);
- /* 2x2 matrix, _31 and _32 are ignored. */
- a1 = m[0][0] * m[0][0] + m[1][0] * m[1][0];
- a2 = m[0][1] * m[0][1] + m[1][1] * m[1][1];
- c = m[0][0] * m[0][1] + m[1][0] * m[1][1];
- /* Maximum scale factor equals to the maximum of the singular values s1, s2 of the matrix M
- s_i^2 = e_i where e_i (e1, e2) are eugenvalues of (transpose(M) * M)
- e1 + e2 = trace(transpose(M) * M) = a1 + a2
- e1 * e2 = det(transpose(M) * M) = a1 * a2 - c ^ 2. */
- e = a1 + a2 + sqrtf((a1 - a2) * (a1 - a2) + 4 * c * c);
- return sqrtf(0.5f * e);
If there is an online page for this algebra, that matches this specific function, please link in a MR comment so it could be referred to later.