Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-29 05:31:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-29 05:31:42 +0400
commit3fc5002a4a40f9d9d12a624920b4e4d86af227ce (patch)
treef17302a378490fd7ebbe105018e3ce79744ff4aa /source/blender/editors
parenta0bd829637afa01afa3f905ba7f0d880b5c8e3ff (diff)
code cleanup: add some comments about to get_next_loop() for edge slide, also name vars better (was using meaningless names).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 62b57aa071b..b901c14f6ba 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4883,13 +4883,19 @@ static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
return NULL;
}
+/**
+ * Given 2 edges and a loop, step over the loops
+ * and calculate a direction to slide along.
+ */
static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
- BMEdge *e_prev, BMEdge *e_next, float vec[3])
+ BMEdge *e_prev, BMEdge *e_next, float slide_vec[3])
{
BMLoop *firstl;
- float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f};
+ float vec_accum[3] = {0.0f, 0.0f, 0.0f};
int i = 0;
+ BLI_assert(BM_edge_share_vert(e_prev, e_next) == v);
+
firstl = l;
do {
l = BM_face_other_edge_loop(l->f, l->e, v);
@@ -4898,7 +4904,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
if (l->e == e_next) {
if (i) {
- mul_v3_fl(a, 1.0f / (float)i);
+ mul_v3_fl(vec_accum, 1.0f / (float)i);
}
else {
/* When there is no edge to slide along,
@@ -4909,43 +4915,45 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
sub_v3_v3v3(e_dir_next, BM_edge_other_vert(e_next, v)->co, v->co);
cross_v3_v3v3(tvec, l->f->no, e_dir_prev);
- cross_v3_v3v3(a, e_dir_next, l->f->no);
+ cross_v3_v3v3(vec_accum, e_dir_next, l->f->no);
- mid_v3_v3v3(a, a, tvec);
+ mid_v3_v3v3(vec_accum, vec_accum, tvec);
/* check if we need to flip
* (compare the normal defines by the edges with the face normal) */
cross_v3_v3v3(tvec, e_dir_prev, e_dir_next);
if (dot_v3v3(tvec, l->f->no) > 0.0f) {
- negate_v3(a);
+ negate_v3(vec_accum);
}
}
- copy_v3_v3(vec, a);
+ copy_v3_v3(slide_vec, vec_accum);
return l;
}
else {
- sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
- add_v3_v3v3(a, a, n);
+ float tvec[3];
+ sub_v3_v3v3(tvec, BM_edge_other_vert(l->e, v)->co, v->co);
+ add_v3_v3v3(vec_accum, vec_accum, tvec);
i += 1;
}
if (BM_face_other_edge_loop(l->f, l->e, v)->e == e_next) {
if (i) {
- mul_v3_fl(a, 1.0f / (float)i);
+ mul_v3_fl(vec_accum, 1.0f / (float)i);
}
- copy_v3_v3(vec, a);
+ copy_v3_v3(slide_vec, vec_accum);
return BM_face_other_edge_loop(l->f, l->e, v);
}
l = l->radial_next;
} while (l != firstl);
- if (i)
- mul_v3_fl(a, 1.0f / (float)i);
+ if (i) {
+ mul_v3_fl(vec_accum, 1.0f / (float)i);
+ }
- copy_v3_v3(vec, a);
+ copy_v3_v3(slide_vec, vec_accum);
return NULL;
}