tweak to edge slide - use a quads opposite vertex when both edges share a quad, gives nicer results.

This commit is contained in:
Campbell Barton
2013-01-29 05:30:39 +00:00
parent e9a4dd202e
commit 0d0dc37aee

View File

@@ -4917,10 +4917,19 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
len_v3_ensure(vec_accum, vec_accum_len / (float)i);
}
else {
/* When there is no edge to slide along,
* we must slide along the vector defined by the face we're attach to */
BMLoop *l_tmp = BM_face_vert_share_loop(l_first->f, v);
float tvec[3];
if (ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next)) {
float tvec[3];
BLI_assert(ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next));
if (l_tmp->f->len == 4) {
/* we could use code below, but in this case
* sliding diagonally across the quad works well */
sub_v3_v3v3(vec_accum, l_tmp->next->next->v->co, v->co);
}
else {
BM_loop_calc_face_tangent(l_tmp, vec_accum);
if (!BM_loop_is_convex(l_tmp)) {
negate_v3(vec_accum);
@@ -4929,9 +4938,6 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
cross_v3_v3v3(vec_accum, l_tmp->f->no, tvec);
len_v3_ensure(vec_accum, (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f);
}
else {
BLI_assert(0);
}
}
copy_v3_v3(r_slide_vec, vec_accum);