Curve Fitting: avoid clamping fallback handles.
This commit is contained in:
7
extern/curve_fit_nd/intern/curve_fit_cubic.c
vendored
7
extern/curve_fit_nd/intern/curve_fit_cubic.c
vendored
@@ -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 */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user