[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56555] trunk/blender/source/blender/ editors/mesh/editmesh_knife.c: knife tool: use faster method for sort_by_frac_along(), no need to call

Campbell Barton ideasman42 at gmail.com
Wed May 8 14:56:31 CEST 2013


Revision: 56555
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56555
Author:   campbellbarton
Date:     2013-05-08 12:56:31 +0000 (Wed, 08 May 2013)
Log Message:
-----------
knife tool: use faster method for sort_by_frac_along(), no need to call
line_point_factor_v3().

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-05-08 12:56:24 UTC (rev 56554)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-05-08 12:56:31 UTC (rev 56555)
@@ -2217,8 +2217,9 @@
 /* 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 @@
 
 	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 @@
 
 		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;
 		}
 




More information about the Bf-blender-cvs mailing list