diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-27 01:17:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-27 01:17:10 +0400 |
commit | 56a47b611403dfa4d9c400cf7b2432560f4152ef (patch) | |
tree | 12e968ca5d57b9d4d41fa90287fed4d0272f01b7 /source/blender/bmesh/intern/bmesh_polygon.c | |
parent | a2552c5836a548bc36e3f733f842c7ace551aa38 (diff) |
avoid calling axis_dominant_v3_to_m3 twice from BM_face_legal_splits
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 3f12db46b4c..0183f90c344 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -1027,11 +1027,13 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, */ void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) { + const int len2 = len * 2; BMLoop *l; float v1[3], v2[3], v3[3] /*, v4[3 */, no[3], mid[3], *p1, *p2, *p3, *p4; float out[3] = {-FLT_MAX, -FLT_MAX, 0.0f}; + float axis_mat[3][3]; float (*projverts)[3] = BLI_array_alloca(projverts, f->len); - float (*edgeverts)[3] = BLI_array_alloca(edgeverts, len * 2); + float (*edgeverts)[3] = BLI_array_alloca(edgeverts, len2); float fac1 = 1.0000001f, fac2 = 0.9f; //9999f; //0.999f; int i, j, a = 0, clen; @@ -1053,8 +1055,15 @@ void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) } calc_poly_normal(no, projverts, f->len); - poly_rotate_plane(no, projverts, f->len); - poly_rotate_plane(no, edgeverts, len * 2); + if (axis_dominant_v3_to_m3(axis_mat, no)) { + for (i = 0; i < f->len; i++) { + mul_m3_v3(axis_mat, projverts[i]); + } + + for (i = 0; i < len2; i++) { + mul_m3_v3(axis_mat, edgeverts[i]); + } + } for (i = 0, l = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l = l->next) { p1 = projverts[i]; |