diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 08:59:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 08:59:47 +0400 |
commit | 192e00b0c9663b03d75a17ef2bf75e2635f876e8 (patch) | |
tree | 42d5515214e5d4d83921cb03ea5cbf511fe4707e /source/blender/editors/mesh/editmesh_loopcut.c | |
parent | 1f3e3b0d68ca0469ece01f91e891310b3773a87b (diff) |
code cleanup: use interp_v3_v3v3()
Diffstat (limited to 'source/blender/editors/mesh/editmesh_loopcut.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index a3b26a56cb3..5f923dd65c6 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -160,7 +160,6 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, int select) BMWalker walker; float (*edges)[2][3] = NULL; BLI_array_declare(edges); - float co[2][3]; int i, tot = 0; memset(v, 0, sizeof(v)); @@ -218,16 +217,9 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, int select) BLI_array_grow_items(edges, previewlines); for (i = 1; i <= previewlines; i++) { - co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0]; - co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1]; - co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2]; - - co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0]; - co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1]; - co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2]; - - copy_v3_v3(edges[tot][0], co[0]); - copy_v3_v3(edges[tot][1], co[1]); + const float fac = (i / ((float)previewlines + 1)); + interp_v3_v3v3(edges[tot][0], v[0][0]->co, v[0][1]->co, fac); + interp_v3_v3v3(edges[tot][1], v[1][0]->co, v[1][1]->co, fac); tot++; } } @@ -247,19 +239,14 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, int select) BLI_array_grow_items(edges, previewlines); for (i = 1; i <= previewlines; i++) { - if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1]) + const float fac = (i / ((float)previewlines + 1)); + + if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1]) { continue; - - co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0]; - co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1]; - co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2]; + } - co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0]; - co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1]; - co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2]; - - copy_v3_v3(edges[tot][0], co[0]); - copy_v3_v3(edges[tot][1], co[1]); + interp_v3_v3v3(edges[tot][0], v[0][0]->co, v[0][1]->co, fac); + interp_v3_v3v3(edges[tot][1], v[1][0]->co, v[1][1]->co, fac); tot++; } } |