Curve Fitting: avoid clamping fallback handles.

This commit is contained in:
Campbell Barton
2016-05-05 20:30:08 +10:00
parent d0818dbae1
commit 9b8bf57361

View File

@@ -471,11 +471,16 @@ static void cubic_from_points(
* so only problems absurd of approximation and not for bugs in the code.
*/
bool use_clamp = true;
/* flip check to catch nan values */
if (!(alpha_l >= 0.0) ||
!(alpha_r >= 0.0))
{
alpha_l = alpha_r = len_vnvn(p0, p3, dims) / 3.0;
/* skip clamping when we're using default handles */
use_clamp = false;
}
double *p1 = CUBIC_PT(r_cubic, 1, dims);
@@ -497,6 +502,7 @@ static void cubic_from_points(
/* ------------------------------------
* Clamping (we could make it optional)
*/
if (use_clamp) {
#ifdef USE_VLA
double center[dims];
#else
@@ -556,6 +562,7 @@ static void cubic_from_points(
imul_vn_fl(p2, sqrt(dist_sq_max) / sqrt(p2_dist_sq), dims);
iadd_vnvn(p2, center, dims);
}
}
/* end clamping */
}