diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-26 04:15:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-26 04:15:21 +0400 |
commit | a7242c3162fd8ac28754b92c3bab8f003f912251 (patch) | |
tree | 00d9123f9c398738446caea9644515e13ac81774 /source/blender/blenlib | |
parent | bd65fc176d39f8b083e0dbb7c6fda98de896257d (diff) |
Code cleanup: add _v2 suffix to resolve_tri/quad functions
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 18 |
2 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 633887e3ef8..6889e4f2651 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -218,10 +218,10 @@ void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const flo bool barycentric_coords_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); int barycentric_inside_triangle_v2(const float w[3]); -void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); -void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); -void resolve_quad_uv_deriv(float r_uv[2], float r_deriv[2][2], - const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); +void resolve_tri_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); +void resolve_quad_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); +void resolve_quad_uv_v2_deriv(float r_uv[2], float r_deriv[2][2], + const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); /* use to find the point of a UV on a face */ void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index b1fd0fe5663..66fdaafa32d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2683,8 +2683,13 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3 #define IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0) -/* Barycentric reverse */ -void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]) +/** + * Barycentric reverse + * + * Compute coordinates (u, v) for point \a st with respect to triangle (\a st0, \a st1, \a st2)" + */ +void resolve_tri_uv_v2(float r_uv[2], const float st[2], + const float st0[2], const float st1[2], const float st2[2]) { /* find UV such that * t = u * t0 + v * t1 + (1 - u - v) * t2 @@ -2705,14 +2710,15 @@ void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const } /* bilinear reverse */ -void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) +void resolve_quad_uv_v2(float r_uv[2], const float st[2], + const float st0[2], const float st1[2], const float st2[2], const float st3[2]) { - resolve_quad_uv_deriv(r_uv, NULL, st, st0, st1, st2, st3); + resolve_quad_uv_v2_deriv(r_uv, NULL, st, st0, st1, st2, st3); } /* bilinear reverse with derivatives */ -void resolve_quad_uv_deriv(float r_uv[2], float r_deriv[2][2], - const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) +void resolve_quad_uv_v2_deriv(float r_uv[2], float r_deriv[2][2], + const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) { const double signed_area = (st0[0] * st1[1] - st0[1] * st1[0]) + (st1[0] * st2[1] - st1[1] * st2[0]) + (st2[0] * st3[1] - st2[1] * st3[0]) + (st3[0] * st0[1] - st3[1] * st0[0]); |