60
60
m[3][0] = m[3][1] = m[3][2] = 0.0;
63
void copy_m3_m3(float m1[][3], float m2[][3])
63
void copy_m3_m3(float m1[3][3], float m2[3][3])
65
65
/* destination comes first: */
66
66
memcpy(&m1[0], &m2[0], 9 * sizeof(float));
69
void copy_m4_m4(float m1[][4], float m2[][4])
69
void copy_m4_m4(float m1[4][4], float m2[4][4])
71
71
memcpy(m1, m2, 4 * 4 * sizeof(float));
74
void copy_m3_m4(float m1[][3], float m2[][4])
74
void copy_m3_m4(float m1[3][3], float m2[4][4])
76
76
m1[0][0] = m2[0][0];
77
77
m1[0][1] = m2[0][1];
143
143
/******************************** Arithmetic *********************************/
145
void mult_m4_m4m4(float m1[][4], float m3_[][4], float m2_[][4])
145
void mult_m4_m4m4(float m1[4][4], float m3_[4][4], float m2_[4][4])
147
147
float m2[4][4], m3[4][4];
176
void mul_m3_m3m3(float m1[][3], float m3_[][3], float m2_[][3])
176
void mul_m3_m3m3(float m1[3][3], float m3_[3][3], float m2_[3][3])
178
178
float m2[3][3], m3[3][3];
195
195
m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
198
void mul_m4_m4m3(float (*m1)[4], float (*m3_)[4], float (*m2_)[3])
198
void mul_m4_m4m3(float m1[4][4], float m3_[4][4], float m2_[3][3])
200
200
float m2[3][3], m3[4][4];
217
217
/* m1 = m2 * m3, ignore the elements on the 4th row/column of m3 */
218
void mult_m3_m3m4(float m1[][3], float m3[][4], float m2[][3])
218
void mult_m3_m3m4(float m1[3][3], float m3_[4][4], float m2_[3][3])
220
float m2[3][3], m3[4][4];
222
/* copy so it works when m1 is the same pointer as m2 or m3 */
220
226
/* m1[i][j] = m2[i][k] * m3[k][j] */
221
227
m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
222
228
m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
231
237
m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
234
void mul_m4_m3m4(float (*m1)[4], float (*m3)[3], float (*m2)[4])
240
void mul_m4_m3m4(float m1[4][4], float m3_[3][3], float m2_[4][4])
242
float m2[4][4], m3[3][3];
244
/* copy so it works when m1 is the same pointer as m2 or m3 */
236
248
m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
237
249
m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
238
250
m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
244
256
m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
247
void mul_serie_m3(float answ[][3],
248
float m1[][3], float m2[][3], float m3[][3],
249
float m4[][3], float m5[][3], float m6[][3],
250
float m7[][3], float m8[][3])
259
void mul_serie_m3(float answ[3][3],
260
float m1[3][3], float m2[3][3], float m3[3][3],
261
float m4[3][3], float m5[3][3], float m6[3][3],
262
float m7[3][3], float m8[3][3])
252
264
float temp[3][3];
280
void mul_serie_m4(float answ[][4], float m1[][4],
281
float m2[][4], float m3[][4], float m4[][4],
282
float m5[][4], float m6[][4], float m7[][4],
292
void mul_serie_m4(float answ[4][4], float m1[4][4],
293
float m2[4][4], float m3[4][4], float m4[4][4],
294
float m5[4][4], float m6[4][4], float m7[4][4],
285
297
float temp[4][4];
321
333
vec[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
324
void mul_v3_m4v3(float in[3], float mat[][4], const float vec[3])
336
void mul_v3_m4v3(float in[3], float mat[4][4], const float vec[3])
332
344
in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
347
void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
352
r[0] = mat[0][0] * x + mat[1][0] * vec[1];
353
r[1] = mat[0][1] * x + mat[1][1] * vec[1];
335
356
/* same as mul_m4_v3() but doesnt apply translation component */
336
void mul_mat3_m4_v3(float mat[][4], float vec[3])
357
void mul_mat3_m4_v3(float mat[4][4], float vec[3])
344
365
vec[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2];
347
void mul_project_m4_v3(float mat[][4], float vec[3])
368
void mul_project_m4_v3(float mat[4][4], float vec[3])
349
370
const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
350
371
mul_m4_v3(mat, vec);
392
413
mul_v4d_m4v4d(r, mat, r);
395
void mul_v3_m3v3(float r[3], float M[3][3], float a[3])
416
void mul_v3_m3v3(float r[3], float M[3][3], const float a[3])
397
418
r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
398
419
r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
399
420
r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
423
void mul_v2_m3v3(float r[2], float M[3][3], const float a[3])
425
r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
426
r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
402
429
void mul_m3_v3(float M[3][3], float r[3])
456
483
vec[2] = x * (double)mat[0][2] + y * (double)mat[1][2] + (double)mat[2][2] * vec[2];
459
void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
463
for (i = 0; i < 3; i++)
464
for (j = 0; j < 3; j++)
465
m1[i][j] = m2[i][j] + m3[i][j];
468
void add_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
472
for (i = 0; i < 4; i++)
473
for (j = 0; j < 4; j++)
474
m1[i][j] = m2[i][j] + m3[i][j];
477
void sub_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
481
for (i = 0; i < 3; i++)
482
for (j = 0; j < 3; j++)
483
m1[i][j] = m2[i][j] - m3[i][j];
486
void sub_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
490
for (i = 0; i < 4; i++)
491
for (j = 0; j < 4; j++)
492
m1[i][j] = m2[i][j] - m3[i][j];
486
void add_m3_m3m3(float m1[3][3], float m2[3][3], float m3[3][3])
490
for (i = 0; i < 3; i++)
491
for (j = 0; j < 3; j++)
492
m1[i][j] = m2[i][j] + m3[i][j];
495
void add_m4_m4m4(float m1[4][4], float m2[4][4], float m3[4][4])
499
for (i = 0; i < 4; i++)
500
for (j = 0; j < 4; j++)
501
m1[i][j] = m2[i][j] + m3[i][j];
504
void sub_m3_m3m3(float m1[3][3], float m2[3][3], float m3[3][3])
508
for (i = 0; i < 3; i++)
509
for (j = 0; j < 3; j++)
510
m1[i][j] = m2[i][j] - m3[i][j];
513
void sub_m4_m4m4(float m1[4][4], float m2[4][4], float m3[4][4])
517
for (i = 0; i < 4; i++)
518
for (j = 0; j < 4; j++)
519
m1[i][j] = m2[i][j] - m3[i][j];
522
float determinant_m3_array(float m[3][3])
524
return (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
525
m[1][0] * (m[0][1] * m[2][2] - m[0][2] * m[2][1]) +
526
m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
529
int invert_m3_ex(float m[3][3], const float epsilon)
534
success = invert_m3_m3_ex(tmp, m, epsilon);
540
int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon)
545
BLI_assert(epsilon >= 0.0f);
548
adjoint_m3_m3(m1, m2);
550
/* then determinant old matrix! */
551
det = determinant_m3_array(m2);
553
success = (fabsf(det) > epsilon);
555
if (LIKELY(det != 0.0f)) {
557
for (a = 0; a < 3; a++) {
558
for (b = 0; b < 3; b++) {
495
566
int invert_m3(float m[3][3])
512
583
adjoint_m3_m3(m1, m2);
514
585
/* then determinant old matrix! */
515
det = (m2[0][0] * (m2[1][1] * m2[2][2] - m2[1][2] * m2[2][1]) -
516
m2[1][0] * (m2[0][1] * m2[2][2] - m2[0][2] * m2[2][1]) +
517
m2[2][0] * (m2[0][1] * m2[1][2] - m2[0][2] * m2[1][1]));
519
success = (det != 0);
521
if (det == 0) det = 1;
523
for (a = 0; a < 3; a++) {
524
for (b = 0; b < 3; b++) {
586
det = determinant_m3_array(m2);
588
success = (det != 0.0f);
590
if (LIKELY(det != 0.0f)) {
592
for (a = 0; a < 3; a++) {
593
for (b = 0; b < 3; b++) {
592
664
return 0; /* No non-zero pivot */
593
665
for (k = 0; k < 4; k++) {
594
tempmat[i][k] = (float)(tempmat[i][k] / temp);
595
inverse[i][k] = (float)(inverse[i][k] / temp);
666
tempmat[i][k] = (float)((double)tempmat[i][k] / temp);
667
inverse[i][k] = (float)((double)inverse[i][k] / temp);
597
669
for (j = 0; j < 4; j++) {
599
671
temp = tempmat[j][i];
600
672
for (k = 0; k < 4; k++) {
601
tempmat[j][k] -= (float)(tempmat[i][k] * temp);
602
inverse[j][k] -= (float)(inverse[i][k] * temp);
673
tempmat[j][k] -= (float)((double)tempmat[i][k] * temp);
674
inverse[j][k] -= (float)((double)inverse[i][k] * temp);
898
void normalize_m3(float mat[][3])
970
void normalize_m3(float mat[3][3])
900
972
normalize_v3(mat[0]);
901
973
normalize_v3(mat[1]);
902
974
normalize_v3(mat[2]);
905
void normalize_m3_m3(float rmat[][3], float mat[][3])
977
void normalize_m3_m3(float rmat[3][3], float mat[3][3])
907
979
normalize_v3_v3(rmat[0], mat[0]);
908
980
normalize_v3_v3(rmat[1], mat[1]);
909
981
normalize_v3_v3(rmat[2], mat[2]);
912
void normalize_m4(float mat[][4])
984
void normalize_m4(float mat[4][4])
921
993
if (len != 0.0f) mat[2][3] /= len;
924
void normalize_m4_m4(float rmat[][4], float mat[][4])
928
len = normalize_v3_v3(rmat[0], mat[0]);
929
if (len != 0.0f) rmat[0][3] = mat[0][3] / len;
930
len = normalize_v3_v3(rmat[1], mat[1]);
931
if (len != 0.0f) rmat[1][3] = mat[1][3] / len;
932
len = normalize_v3_v3(rmat[2], mat[2]);
933
if (len != 0.0f) rmat[2][3] = mat[2][3] / len;
936
void adjoint_m3_m3(float m1[][3], float m[][3])
996
void normalize_m4_m4(float rmat[4][4], float mat[4][4])
998
copy_m4_m4(rmat, mat);
1002
void adjoint_m2_m2(float m1[2][2], float m[2][2])
1004
BLI_assert(m1 != m);
1006
m1[0][1] = -m[1][0];
1007
m1[1][0] = -m[0][1];
1011
void adjoint_m3_m3(float m1[3][3], float m[3][3])
1013
BLI_assert(m1 != m);
938
1014
m1[0][0] = m[1][1] * m[2][2] - m[1][2] * m[2][1];
939
1015
m1[0][1] = -m[0][1] * m[2][2] + m[0][2] * m[2][1];
940
1016
m1[0][2] = m[0][1] * m[1][2] - m[0][2] * m[1][1];
948
1024
m1[2][2] = m[0][0] * m[1][1] - m[0][1] * m[1][0];
951
void adjoint_m4_m4(float out[][4], float in[][4]) /* out = ADJ(in) */
1027
void adjoint_m4_m4(float out[4][4], float in[4][4]) /* out = ADJ(in) */
953
1029
float a1, a2, a3, a4, b1, b2, b3, b4;
954
1030
float c1, c2, c3, c4, d1, d2, d3, d4;
1017
float determinant_m4(float m[][4])
1093
float determinant_m4(float m[4][4])
1020
1096
float a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4, d1, d2, d3, d4;
1071
1147
copy_m4_m3(mat, tmat);
1074
void mat3_to_size(float size[3], float mat[][3])
1150
void mat3_to_size(float size[3], float mat[3][3])
1076
1152
size[0] = len_v3(mat[0]);
1077
1153
size[1] = len_v3(mat[1]);
1078
1154
size[2] = len_v3(mat[2]);
1081
void mat4_to_size(float size[3], float mat[][4])
1157
void mat4_to_size(float size[3], float mat[4][4])
1083
1159
size[0] = len_v3(mat[0]);
1084
1160
size[1] = len_v3(mat[1]);
1088
1164
/* this gets the average scale of a matrix, only use when your scaling
1089
1165
* data that has no idea of scale axis, examples are bone-envelope-radius
1090
1166
* and curve radius */
1091
float mat3_to_scale(float mat[][3])
1167
float mat3_to_scale(float mat[3][3])
1093
1169
/* unit length vector */
1094
1170
float unit_vec[3] = {0.577350269189626f, 0.577350269189626f, 0.577350269189626f};
1111
1187
/* rotation & scale are linked, we need to create the mat's
1112
1188
* for these together since they are related. */
1114
/* so scale doesnt interfear with rotation [#24291] */
1190
/* so scale doesn't interfere with rotation [#24291] */
1115
1191
/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
1116
1192
normalize_m3_m3(mat3_n, mat3);
1117
1193
if (is_negative_m3(mat3)) {
1134
1210
size[2] = mat3[2][2];
1137
void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[][4])
1213
void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[4][4])
1139
1215
float mat3[3][3]; /* wmat -> 3x3 */
1145
1221
copy_v3_v3(loc, wmat[3]);
1148
void scale_m3_fl(float m[][3], float scale)
1224
void mat4_to_loc_quat(float loc[3], float quat[4], float wmat[4][4])
1227
float mat3_n[3][3]; /* normalized mat3 */
1229
copy_m3_m4(mat3, wmat);
1230
normalize_m3_m3(mat3_n, mat3);
1232
/* so scale doesn't interfere with rotation [#24291] */
1233
/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
1234
if (is_negative_m3(mat3)) {
1235
negate_v3(mat3_n[0]);
1236
negate_v3(mat3_n[1]);
1237
negate_v3(mat3_n[2]);
1240
mat3_to_quat(quat, mat3_n);
1241
copy_v3_v3(loc, wmat[3]);
1244
void mat4_decompose(float loc[3], float quat[4], float size[3], float wmat[4][4])
1247
mat4_to_loc_rot_size(loc, rot, size, wmat);
1248
mat3_to_quat(quat, rot);
1251
void scale_m3_fl(float m[3][3], float scale)
1150
1253
m[0][0] = m[1][1] = m[2][2] = scale;
1151
1254
m[0][1] = m[0][2] = 0.0;
1163
1266
m[3][0] = m[3][1] = m[3][2] = 0.0;
1166
void translate_m4(float mat[][4], float Tx, float Ty, float Tz)
1269
void translate_m4(float mat[4][4], float Tx, float Ty, float Tz)
1168
1271
mat[3][0] += (Tx * mat[0][0] + Ty * mat[1][0] + Tz * mat[2][0]);
1169
1272
mat[3][1] += (Tx * mat[0][1] + Ty * mat[1][1] + Tz * mat[2][1]);
1170
1273
mat[3][2] += (Tx * mat[0][2] + Ty * mat[1][2] + Tz * mat[2][2]);
1173
void rotate_m4(float mat[][4], const char axis, const float angle)
1276
void rotate_m4(float mat[4][4], const char axis, const float angle)
1176
1279
float temp[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1213
void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], const float srcweight)
1316
void rotate_m2(float mat[2][2], const float angle)
1318
mat[0][0] = mat[1][1] = cosf(angle);
1319
mat[0][1] = sinf(angle);
1320
mat[1][0] = -mat[0][1];
1323
void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const float srcweight)
1215
1325
float srot[3][3], drot[3][3];
1216
1326
float squat[4], dquat[4], fquat[4];
1233
1343
mul_m3_m3m3(out, rmat, smat);
1236
void blend_m4_m4m4(float out[][4], float dst[][4], float src[][4], const float srcweight)
1346
void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const float srcweight)
1238
1348
float sloc[3], dloc[3], floc[3];
1239
1349
float srot[3][3], drot[3][3];
1255
1365
loc_quat_size_to_mat4(out, floc, fquat, fsize);
1258
int is_negative_m3(float mat[][3])
1368
int is_negative_m3(float mat[3][3])
1261
1371
cross_v3_v3v3(vec, mat[0], mat[1]);
1262
1372
return (dot_v3v3(vec, mat[2]) < 0.0f);
1265
int is_negative_m4(float mat[][4])
1375
int is_negative_m4(float mat[4][4])
1268
1378
cross_v3_v3v3(vec, mat[0], mat[1]);
1272
1382
/* make a 4x4 matrix out of 3 transform components */
1273
1383
/* matrices are made in the order: scale * rot * loc */
1274
// TODO: need to have a version that allows for rotation order...
1384
/* TODO: need to have a version that allows for rotation order... */
1276
1386
void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3])
1353
1463
/*********************************** Other ***********************************/
1355
void print_m3(const char *str, float m[][3])
1465
void print_m3(const char *str, float m[3][3])
1357
1467
printf("%s\n", str);
1358
1468
printf("%f %f %f\n", m[0][0], m[1][0], m[2][0]);
1364
void print_m4(const char *str, float m[][4])
1474
void print_m4(const char *str, float m[4][4])
1366
1476
printf("%s\n", str);
1367
1477
printf("%f %f %f %f\n", m[0][0], m[1][0], m[2][0], m[3][0]);
1397
1507
int i = 0, j = 0, k = 0, p, pp, iter;
1399
// Reduce A to bidiagonal form, storing the diagonal elements
1400
// in s and the super-diagonal elements in e.
1509
/* Reduce A to bidiagonal form, storing the diagonal elements
1510
* in s and the super-diagonal elements in e. */
1402
int nct = minf(m - 1, n);
1403
int nrt = maxf(0, minf(n - 2, m));
1512
int nct = min_ff(m - 1, n);
1513
int nrt = max_ff(0, min_ff(n - 2, m));
1405
1515
copy_m4_m4(A, A_);
1409
for (k = 0; k < maxf(nct, nrt); k++) {
1519
for (k = 0; k < max_ff(nct, nrt); k++) {
1412
// Compute the transformation for the k-th column and
1413
// place the k-th diagonal in s[k].
1414
// Compute 2-norm of k-th column without under/overflow.
1522
/* Compute the transformation for the k-th column and
1523
* place the k-th diagonal in s[k].
1524
* Compute 2-norm of k-th column without under/overflow. */
1416
1526
for (i = k; i < m; i++) {
1417
1527
s[k] = hypotf(s[k], A[i][k]);
1447
// Place the k-th row of A into e for the
1448
// subsequent calculation of the row transformation.
1557
/* Place the k-th row of A into e for the */
1558
/* subsequent calculation of the row transformation. */
1450
1560
e[j] = A[k][j];
1454
// Place the transformation in U for subsequent back
1564
/* Place the transformation in U for subsequent back
1565
* multiplication. */
1457
1567
for (i = k; i < m; i++)
1458
1568
U[i][k] = A[i][k];
1462
// Compute the k-th row transformation and place the
1463
// k-th super-diagonal in e[k].
1464
// Compute 2-norm without under/overflow.
1572
/* Compute the k-th row transformation and place the
1573
* k-th super-diagonal in e[k].
1574
* Compute 2-norm without under/overflow. */
1466
1576
for (i = k + 1; i < n; i++) {
1467
1577
e[k] = hypotf(e[k], e[i]);
1503
// Place the transformation in V for subsequent
1504
// back multiplication.
1613
/* Place the transformation in V for subsequent
1614
* back multiplication. */
1506
1616
for (i = k + 1; i < n; i++)
1507
1617
V[i][k] = e[i];
1511
// Set up the final bidiagonal matrix or order p.
1621
/* Set up the final bidiagonal matrix or order p. */
1623
p = min_ff(n, m + 1);
1515
1625
s[nct] = A[nct][nct];
1587
1697
while (p > 0) {
1590
// Test for maximum iterations to avoid infinite loop
1700
/* Test for maximum iterations to avoid infinite loop */
1591
1701
if (maxiter == 0)
1595
// This section of the program inspects for
1596
// negligible elements in the s and e arrays. On
1597
// completion the variables kase and k are set as follows.
1599
// kase = 1 if s(p) and e[k - 1] are negligible and k<p
1600
// kase = 2 if s(k) is negligible and k<p
1601
// kase = 3 if e[k - 1] is negligible, k<p, and
1602
// s(k), ..., s(p) are not negligible (qr step).
1603
// kase = 4 if e(p - 1) is negligible (convergence).
1705
/* This section of the program inspects for
1706
* negligible elements in the s and e arrays. On
1707
* completion the variables kase and k are set as follows.
1709
* kase = 1 if s(p) and e[k - 1] are negligible and k<p
1710
* kase = 2 if s(k) is negligible and k<p
1711
* kase = 3 if e[k - 1] is negligible, k<p, and
1712
* s(k), ..., s(p) are not negligible (qr step).
1713
* kase = 4 if e(p - 1) is negligible (convergence). */
1605
1715
for (k = p - 2; k >= -1; k--) {
1698
// Perform one qr step.
1808
/* Perform one qr step. */
1703
// Calculate the shift.
1813
/* Calculate the shift. */
1705
float scale = maxf(maxf(maxf(maxf(
1706
fabsf(s[p - 1]),fabsf(s[p - 2])),fabsf(e[p - 2])),
1707
fabsf(s[k])),fabsf(e[k]));
1815
float scale = max_ff(max_ff(max_ff(max_ff(
1816
fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])),
1817
fabsf(s[k])), fabsf(e[k]));
1708
1818
float invscale = 1.0f / scale;
1709
1819
float sp = s[p - 1] * invscale;
1710
1820
float spm1 = s[p - 2] * invscale;
1836
1946
mul_serie_m4(Ainv, U, Wm, V, NULL, NULL, NULL, NULL, NULL);
1949
void pseudoinverse_m3_m3(float Ainv[3][3], float A[3][3], float epsilon)
1951
/* try regular inverse when possible, otherwise fall back to slow svd */
1952
if (!invert_m3_m3(Ainv, A)) {
1953
float tmp[4][4], tmpinv[4][4];
1956
pseudoinverse_m4_m4(tmpinv, tmp, epsilon);
1957
copy_m3_m4(Ainv, tmpinv);