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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-05-28 04:35:29 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-05-28 04:35:29 +0400
commit1ab7a6f9af2fa0124fafee84d96099de9ec051e3 (patch)
treefe91c1c7e4e9a736f2f2e1ff091ee188dc3a72e7 /source/blender/freestyle
parent5de17660e20efb28719847f24f4b99cd99f1772d (diff)
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!
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index cc21ba05f3d..a5701ea05e5 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -376,6 +376,12 @@ static Vector2 ComputeCenterTangent(Vector2 *d, int center)
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;
}