[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34055] trunk/blender/source/blender/ editors/gpencil/gpencil_paint.c: Fixing Grease Pencil typo noted while scanning through Mike Erwin's

Joshua Leung aligorith at gmail.com
Tue Jan 4 07:28:45 CET 2011


Revision: 34055
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34055
Author:   aligorith
Date:     2011-01-04 07:28:44 +0100 (Tue, 04 Jan 2011)

Log Message:
-----------
Fixing Grease Pencil typo noted while scanning through Mike Erwin's
GSoC10 work. Cheers Mike for catching this!

Also removing the use of sqrt() as noted in a "todo" comment there...

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-01-04 06:18:58 UTC (rev 34054)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-01-04 06:28:44 UTC (rev 34055)
@@ -210,13 +210,17 @@
 	if (p->gpd->sbuffer_size == 0)
 		return 1;
 	
-	/* check if mouse moved at least certain distance on both axes (best case) */
+	/* check if mouse moved at least certain distance on both axes (best case) 
+	 *	- aims to eliminate some jitter-noise from input when trying to draw straight lines freehand
+	 */
 	else if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX))
 		return 1;
 	
-	/* check if the distance since the last point is significant enough */
-	// future optimisation: sqrt here may be too slow?
-	else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX)
+	/* check if the distance since the last point is significant enough 
+	 *	- prevents points being added too densely
+	 *	- distance here doesn't use sqrt to prevent slowness... we should still be safe from overflows though
+	 */
+	else if ((dx*dx + dy*dy) > MIN_EUCLIDEAN_PX*MIN_EUCLIDEAN_PX)
 		return 1;
 	
 	/* mouse 'didn't move' */
@@ -415,7 +419,7 @@
 		return;
 	
 	/* don't simplify if less than 4 points in buffer */
-	if ((num_points <= 2) || (old_points == NULL))
+	if ((num_points <= 4) || (old_points == NULL))
 		return;
 		
 	/* clear buffer (but don't free mem yet) so that we can write to it 





More information about the Bf-blender-cvs mailing list