[Bf-blender-cvs] [712c3a86eda] greasepencil-object: WIP: Fix error in smooth lines

Antonio Vazquez noreply at git.blender.org
Thu Nov 9 12:46:40 CET 2017


Commit: 712c3a86eda8089259dcb07d8f69d0de64223f35
Author: Antonio Vazquez
Date:   Thu Nov 9 12:46:22 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB712c3a86eda8089259dcb07d8f69d0de64223f35

WIP: Fix error in smooth lines

Need to check the distance of previous points, not new with previous.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 98c0450620d..7d3fd57d133 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -554,14 +554,14 @@ static bool gp_smooth_buffer_point(bGPdata *gpd, float inf)
 	 */
 	sub_v2_v2v2(vab, fptb, fpta);
 	sub_v2_v2v2(vac, fpt, fpta);
-	float sqsize_bc = len_squared_v2v2(fptb, fpt);
+	float sqsize_ab = len_squared_v2v2(fptb, fpta);
 	normalize_v2(vab);
 	normalize_v2(vac);
 
 	/* as the vectors are normalized, we can use dot product to calculate cosine */
 	float angle = dot_v2v2(vab, vac);
 	/* if the angle is minimun, means the point can be removed, so rollback one point */
-	if ((angle > MIN_STROKE_SEGMENT_ANGLE) && (sqsize_bc < MIN_STROKE_SEGMENT_SQUARE * 3.0f)) {
+	if ((angle > MIN_STROKE_SEGMENT_ANGLE) && (sqsize_ab < MIN_STROKE_SEGMENT_SQUARE * 3.0f)) {
 		ptb->x = pt->x;
 		ptb->y = pt->y;
 		ptb->pressure = pt->pressure;



More information about the Bf-blender-cvs mailing list