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:
authorCampbell Barton <ideasman42@gmail.com>2016-07-31 06:55:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-07-31 06:58:14 +0300
commit3fe7aacdf7f87ef9293ae4d8c4ce1dd9373e7011 (patch)
treee6945c1e68022ab341e2171be287d565afedc63b /extern/curve_fit_nd
parent8fab198aaee48a0b0cf78be1d32f414f96cdc697 (diff)
Curve Fitting: circular fit could give NAN handles
Fitting lines that exactly double back on themselves could give NAN length handles.
Diffstat (limited to 'extern/curve_fit_nd')
-rw-r--r--extern/curve_fit_nd/intern/curve_fit_cubic.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/extern/curve_fit_nd/intern/curve_fit_cubic.c b/extern/curve_fit_nd/intern/curve_fit_cubic.c
index 24b216d32ff..9c8ebcd098b 100644
--- a/extern/curve_fit_nd/intern/curve_fit_cubic.c
+++ b/extern/curve_fit_nd/intern/curve_fit_cubic.c
@@ -742,7 +742,11 @@ static void cubic_from_points(
!(alpha_r >= 0.0))
{
#ifdef USE_CIRCULAR_FALLBACK
- alpha_l = alpha_r = points_calc_cubic_scale(p0, p3, tan_l, tan_r, points_offset_coords_length, dims);
+ double alpha_test = points_calc_cubic_scale(p0, p3, tan_l, tan_r, points_offset_coords_length, dims);
+ if (!isfinite(alpha_test)) {
+ alpha_test = len_vnvn(p0, p3, dims) / 3.0;
+ }
+ alpha_l = alpha_r = alpha_test;
#else
alpha_l = alpha_r = len_vnvn(p0, p3, dims) / 3.0;
#endif
@@ -804,7 +808,11 @@ static void cubic_from_points(
p2_dist_sq > dist_sq_max)
{
#ifdef USE_CIRCULAR_FALLBACK
- alpha_l = alpha_r = points_calc_cubic_scale(p0, p3, tan_l, tan_r, points_offset_coords_length, dims);
+ double alpha_test = points_calc_cubic_scale(p0, p3, tan_l, tan_r, points_offset_coords_length, dims);
+ if (!isfinite(alpha_test)) {
+ alpha_test = len_vnvn(p0, p3, dims) / 3.0;
+ }
+ alpha_l = alpha_r = alpha_test;
#else
alpha_l = alpha_r = len_vnvn(p0, p3, dims) / 3.0;
#endif