[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57068] trunk/blender/source/blender/ freestyle/intern/geometry/FitCurve.cpp: Fix for crash in Freestyle with sketchy chaining and Bezier Curve geometry modifier .

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Tue May 28 02:35:29 CEST 2013


Revision: 57068
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57068
Author:   kjym3
Date:     2013-05-28 00:35:29 +0000 (Tue, 28 May 2013)
Log Message:
-----------
Fix for crash in Freestyle with sketchy chaining and Bezier Curve geometry modifier.

When the sketchy chaining is used, stroke geometry may contain a 180-degree U-turn.
If the 'error' parameter of the Bezier Curve geometry modifier is small (e.g., 10),
Bezier curve fitting will recursively split the original stroke into two pieces.
This splitting may take place at a U-turn point, causing a numerical singularity issue
that leads to a crash.

Problem report by edna in the BA Freestyle thread, with an example .blend to reproduce
the problem.  Thanks a lot!

Modified Paths:
--------------
    trunk/blender/source/blender/freestyle/intern/geometry/FitCurve.cpp

Modified: trunk/blender/source/blender/freestyle/intern/geometry/FitCurve.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/geometry/FitCurve.cpp	2013-05-27 23:51:01 UTC (rev 57067)
+++ trunk/blender/source/blender/freestyle/intern/geometry/FitCurve.cpp	2013-05-28 00:35:29 UTC (rev 57068)
@@ -376,6 +376,12 @@
 	tHatCenter[0] = (V1[0] + V2[0]) / 2.0;
 	tHatCenter[1] = (V1[1] + V2[1]) / 2.0;
 	tHatCenter = *V2Normalize(&tHatCenter);
+
+	/* avoid numerical singularity in the special case when V1 == -V2 */
+	if (V2Length(&tHatCenter) < M_EPSILON) {
+		tHatCenter = *V2Normalize(&V1);
+	}
+
 	return tHatCenter;
 }
 




More information about the Bf-blender-cvs mailing list