optimize interp_weights_poly_v2, v3

use line_point_factor instead of length between vertices.
This commit is contained in:
Campbell Barton 2014-12-26 08:44:23 +11:00
parent f84defa9c0
commit 53ec177b7f
Notes: blender-bot 2023-02-14 09:43:44 +01:00
Referenced by issue #42887, Nvidia GTX 9XX not recognized in Blender (2.73)
1 changed files with 8 additions and 10 deletions

View File

@ -2714,11 +2714,10 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
w[i_curr] = 1.0f;
}
else {
float len_curr = len_v3v3(co, v_curr);
float len_next = len_v3v3(co, v_next);
float edge_len = len_curr + len_next;
w[i_curr] = len_next / edge_len;
w[(i_curr + 1) % n] = len_curr / edge_len;
float fac = line_point_factor_v3(co, v_curr, v_next);
CLAMP(fac, 0.0f, 1.0f);
w[i_curr] = 1.0f - fac;
w[(i_curr + 1) % n] = fac;
}
}
else {
@ -2787,11 +2786,10 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
w[i_curr] = 1.0f;
}
else {
float len_curr = len_v2v2(co, v_curr);
float len_next = len_v2v2(co, v_next);
float edge_len = len_curr + len_next;
w[i_curr] = len_next / edge_len;
w[(i_curr + 1) % n] = len_curr / edge_len;
float fac = line_point_factor_v2(co, v_curr, v_next);
CLAMP(fac, 0.0f, 1.0f);
w[i_curr] = 1.0f - fac;
w[(i_curr + 1) % n] = fac;
}
}
else {