py api: add mathutils.Matrix adjugate(d) methods, also add adjoint_m2_m2() to BLI_math_matrix

This commit is contained in:
2012-10-29 03:36:55 +00:00
parent 5549904171
commit dbb40e805d
3 changed files with 106 additions and 12 deletions

View File

@@ -945,8 +945,18 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
if (len != 0.0f) rmat[2][3] = mat[2][3] / len;
}
void adjoint_m2_m2(float m1[][2], float m[][2])
{
BLI_assert(m1 != m);
m1[0][0] = m[1][1];
m1[0][1] = -m[1][0];
m1[1][0] = -m[0][1];
m1[1][1] = m[0][0];
}
void adjoint_m3_m3(float m1[][3], float m[][3])
{
BLI_assert(m1 != m);
m1[0][0] = m[1][1] * m[2][2] - m[1][2] * m[2][1];
m1[0][1] = -m[0][1] * m[2][2] + m[0][2] * m[2][1];
m1[0][2] = m[0][1] * m[1][2] - m[0][2] * m[1][1];