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-05-08 16:56:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-08 16:56:31 +0400
commitdf502ffd5ffe4711c5b0602e0f1cdeaeb15b8673 (patch)
tree2bbebaeaa8ed775218b265c210da3c0d4d824977 /source/blender
parenta2221cad15c04eab4b4a9c687b28d9ddf9e29616 (diff)
knife tool: use faster method for sort_by_frac_along(), no need to call
line_point_factor_v3().
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index b37026aafd8..05434b76d51 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2217,8 +2217,9 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
/* sort list of kverts by fraction along edge e */
static void sort_by_frac_along(ListBase *lst, BMEdge *e)
{
+ /* note, since we know the point is along the edge, sort from distance to v1co */
const float *v1co = e->v1->co;
- const float *v2co = e->v2->co;
+// const float *v2co = e->v2->co;
Ref *cur = NULL, *prev = NULL, *next = NULL;
if (lst->first == lst->last)
@@ -2226,7 +2227,11 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
for (cur = ((Ref *)lst->first)->next; cur; cur = next) {
KnifeVert *vcur = cur->ref;
+#if 0
const float vcur_fac = line_point_factor_v3(vcur->co, v1co, v2co);
+#else
+ const float vcur_fac = len_squared_v3v3(v1co, vcur->co);
+#endif
next = cur->next;
prev = cur->prev;
@@ -2235,8 +2240,13 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
while (prev) {
KnifeVert *vprev = prev->ref;
+#if 0
if (line_point_factor_v3(vprev->co, v1co, v2co) <= vcur_fac)
break;
+#else
+ if (len_squared_v3v3(v1co, vprev->co) <= vcur_fac)
+ break;
+#endif
prev = prev->prev;
}