Browse Source

Fix regression in least_squares_fit.cpp

pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
11b6a3cbb6
  1. 7
      Marlin/least_squares_fit.cpp

7
Marlin/least_squares_fit.cpp

@ -69,10 +69,9 @@ int finish_incremental_LSF(struct linear_fit_data *lsf) {
lsf->x2bar = lsf->x2bar / N - sq(lsf->xbar); lsf->x2bar = lsf->x2bar / N - sq(lsf->xbar);
lsf->y2bar = lsf->y2bar / N - sq(lsf->ybar); lsf->y2bar = lsf->y2bar / N - sq(lsf->ybar);
lsf->z2bar = lsf->z2bar / N - sq(lsf->zbar); lsf->z2bar = lsf->z2bar / N - sq(lsf->zbar);
lsf->xybar = lsf->xybar / N - sq(lsf->xbar); lsf->xybar = lsf->xybar / N - lsf->xbar * lsf->ybar;
lsf->yzbar = lsf->yzbar / N - sq(lsf->ybar); lsf->yzbar = lsf->yzbar / N - lsf->ybar * lsf->zbar;
lsf->xzbar = lsf->xzbar / N - sq(lsf->xbar); lsf->xzbar = lsf->xzbar / N - lsf->xbar * lsf->zbar;
const float DD = lsf->x2bar * lsf->y2bar - sq(lsf->xybar); const float DD = lsf->x2bar * lsf->y2bar - sq(lsf->xybar);
if (fabs(DD) <= 1e-10 * (lsf->max_absx + lsf->max_absy)) if (fabs(DD) <= 1e-10 * (lsf->max_absx + lsf->max_absy))
return -1; return -1;

Loading…
Cancel
Save