[Bf-blender-cvs] [a8b3ff9] master: Curve Fitting: fix off by one error

Campbell Barton noreply at git.blender.org
Fri Aug 5 10:49:39 CEST 2016


Commit: a8b3ff9e16575114d35a709aa78066523bb69df3
Author: Campbell Barton
Date:   Fri Aug 5 18:49:56 2016 +1000
Branches: master
https://developer.blender.org/rBa8b3ff9e16575114d35a709aa78066523bb69df3

Curve Fitting: fix off by one error

In practice this wasn't likely to cause problems, but better fix.

===================================================================

M	extern/curve_fit_nd/intern/curve_fit_cubic.c

===================================================================

diff --git a/extern/curve_fit_nd/intern/curve_fit_cubic.c b/extern/curve_fit_nd/intern/curve_fit_cubic.c
index 417b41d..9b4f186 100644
--- a/extern/curve_fit_nd/intern/curve_fit_cubic.c
+++ b/extern/curve_fit_nd/intern/curve_fit_cubic.c
@@ -614,7 +614,7 @@ static void cubic_from_points_offset_fallback(
 
 	double dists[2] = {0, 0};
 
-	const double *pt = points_offset;
+	const double *pt = &points_offset[dims];
 	for (uint i = 1; i < points_offset_len - 1; i++, pt += dims) {
 		for (uint k = 0; k < 2; k++) {
 			sub_vn_vnvn(tmp, p0, pt, dims);
@@ -896,7 +896,7 @@ static double points_calc_coord_length(
 	}
 	assert(!is_almost_zero(r_u[points_offset_len - 1]));
 	const double w = r_u[points_offset_len - 1];
-	for (uint i = 0; i < points_offset_len; i++) {
+	for (uint i = 1; i < points_offset_len; i++) {
 		r_u[i] /= w;
 	}
 	return w;




More information about the Bf-blender-cvs mailing list