diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-19 08:48:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-19 08:48:34 +0400 |
commit | db051f2b2ddae22b6ff7468ae5cca7884d5b06da (patch) | |
tree | 67dc02d3c2d30fde68c8d7889bf93cff0ccff3d4 /source/blender/blenlib | |
parent | 946c9580b5d2735072fa2a4bd817c23fe269ec91 (diff) |
fix MESH_OT_tris_convert_to_quads() limit options (uv and vertex color) were not working at all.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 15 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 9 |
4 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 6fe5d48d06e..7c8bf88943d 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -115,6 +115,8 @@ void rgba_float_to_uchar(unsigned char col_r[4], const float col_f[4]); void xyz_to_lab(float x, float y, float z, float *l, float *a, float *b); +MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit); + /***************** lift/gamma/gain / ASC-CDL conversion *****************/ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 6c81ca3f0a9..de1d423bfad 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -173,6 +173,7 @@ MINLINE int is_one_v3(const float a[3]); MINLINE int equals_v2v2(const float v1[2], const float v2[2]); MINLINE int equals_v3v3(const float a[3], const float b[3]); +MINLINE int compare_v2v2(const float a[3], const float b[3], const float limit); MINLINE int compare_v3v3(const float a[3], const float b[3], const float limit); MINLINE int compare_len_v3v3(const float a[3], const float b[3], const float limit); diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index 6b90cbfe9c3..f520b2318e5 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -273,5 +273,20 @@ MINLINE float rgb_to_luma_y(const float rgb[3]) return 0.212671f * rgb[0] + 0.71516f * rgb[1] + 0.072169f * rgb[2]; } +MINLINE int compare_rgb_uchar(const unsigned char col_a[3], const unsigned char col_b[3], const int limit) +{ + int r = (int)col_a[0] - (int)col_b[0]; + if (ABS(r) < limit) { + int g = (int)col_a[1] - (int)col_b[1]; + if (ABS(g) < limit) { + int b = (int)col_a[2] - (int)col_b[2]; + if (ABS(b) < limit) { + return 1; + } + } + } + + return 0; +} #endif /* __MATH_COLOR_INLINE_C__ */ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 0a8f57214d7..c409e536b45 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -724,6 +724,15 @@ MINLINE int equals_v4v4(const float v1[4], const float v2[4]) return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2]) && (v1[3] == v2[3])); } +MINLINE int compare_v2v2(const float v1[2], const float v2[2], const float limit) +{ + if (fabsf(v1[0] - v2[0]) < limit) + if (fabsf(v1[1] - v2[1]) < limit) + return 1; + + return 0; +} + MINLINE int compare_v3v3(const float v1[3], const float v2[3], const float limit) { if (fabsf(v1[0] - v2[0]) < limit) |