diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-14 15:09:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-14 15:29:31 +0300 |
commit | 2cffd6649b0e9b646bc090e4bba90e9873fb2982 (patch) | |
tree | a09d92b8b332ec417a826937bf298c283a5dc3d4 /source/blender/blenlib/intern | |
parent | 655f498ca7acc94df01200452d70507dc5027096 (diff) |
Match face tessellation order in edimode
add a negated version of axis_dominant_v3_to_m3
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 7329a1177a8..f40f1cc3f97 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2402,6 +2402,25 @@ void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3]) BLI_assert((fabsf(dot_m3_v3_row_z(r_mat, normal) - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || is_zero_v3(normal)); } +/** + * Same as axis_dominant_v3_to_m3, but flips the normal + */ +void axis_dominant_v3_to_m3_negate(float r_mat[3][3], const float normal[3]) +{ + BLI_ASSERT_UNIT_V3(normal); + + negate_v3_v3(r_mat[2], normal); + ortho_basis_v3v3_v3(r_mat[0], r_mat[1], r_mat[2]); + + BLI_ASSERT_UNIT_V3(r_mat[0]); + BLI_ASSERT_UNIT_V3(r_mat[1]); + + transpose_m3(r_mat); + + BLI_assert(!is_negative_m3(r_mat)); + BLI_assert((dot_m3_v3_row_z(r_mat, normal) < BLI_ASSERT_UNIT_EPSILON) || is_zero_v3(normal)); +} + /****************************** Interpolation ********************************/ static float tri_signed_area(const float v1[3], const float v2[3], const float v3[3], const int i, const int j) |