Solving issue #984: Crash on opening raw
This commit is contained in:
parent
3f921ea255
commit
b9fb664670
@ -76,10 +76,10 @@ namespace rtengine {
|
|||||||
double const increment = 1./hashSize;
|
double const increment = 1./hashSize;
|
||||||
double milestone = 0.;
|
double milestone = 0.;
|
||||||
|
|
||||||
for (unsigned int i=0; i<(hashSize+1); i++) {
|
for (unsigned int i=0; i<(hashSize+1);) {
|
||||||
while(poly_x[polyIter] <= milestone) ++polyIter;
|
while(poly_x[polyIter] <= milestone) ++polyIter;
|
||||||
hash[i] = polyIter-1;
|
hash[i] = polyIter-1;
|
||||||
milestone += increment;
|
milestone = (++i)*increment;
|
||||||
}
|
}
|
||||||
hash[hashSize+1] = poly_x.size()-1;
|
hash[hashSize+1] = poly_x.size()-1;
|
||||||
|
|
||||||
|
@ -290,11 +290,9 @@ void FlatCurve::CtrlPoints_set () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// adding an final horizontal line if necessary
|
// adding the final horizontal segment, always (see under)
|
||||||
if (!periodic && sc_x[--j] != 1.) {
|
poly_x.push_back(3.0); // 3.0 is a hack for optimization purpose of the getVal method (the last value has to be beyond the normal range)
|
||||||
poly_x.push_back(1.);
|
poly_y.push_back(sc_y[j-1]);
|
||||||
poly_y.push_back(sc_y[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Checking the values
|
// Checking the values
|
||||||
@ -335,8 +333,9 @@ double FlatCurve::getVal (double t) {
|
|||||||
k_lo = k;
|
k_lo = k;
|
||||||
}
|
}
|
||||||
|
|
||||||
double h = poly_x[k_hi] - poly_x[k_lo];
|
double dx = poly_x[k_hi] - poly_x[k_lo];
|
||||||
return poly_y[k_lo] + (t - poly_x[k_lo]) * ( poly_y[k_hi] - poly_y[k_lo] ) / h;
|
double dy = poly_y[k_hi] - poly_y[k_lo];
|
||||||
|
return poly_y[k_lo] + (t - poly_x[k_lo]) * dy / dx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*case Parametric : {
|
/*case Parametric : {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user