cppcheck: further fixes

This commit is contained in:
Ingo Weyrich
2019-08-06 22:10:38 +02:00
parent 96bf78fe87
commit 4fedfb2b26
10 changed files with 101 additions and 134 deletions

View File

@@ -230,7 +230,6 @@ void DiagonalCurve::NURBS_set ()
poly_x.clear();
poly_y.clear();
unsigned int sc_xsize = j - 1;
j = 0;
// adding the initial horizontal segment, if any
if (x[0] > 0.) {
@@ -314,18 +313,13 @@ inline void catmull_rom_spline(int n_points,
double space = (t2-t1) / n_points;
double t;
int i;
double c, d, A1_x, A1_y, A2_x, A2_y, A3_x, A3_y;
double B1_x, B1_y, B2_x, B2_y, C_x, C_y;
res_x.push_back(p1_x);
res_y.push_back(p1_y);
// special case, a segment at 0 or 1 is computed exactly
if (p1_y == p2_y && (p1_y == 0 || p1_y == 1)) {
for (i = 1; i < n_points-1; ++i) {
t = p1_x + space * i;
for (int i = 1; i < n_points-1; ++i) {
double t = p1_x + space * i;
if (t >= p2_x) {
break;
}
@@ -333,38 +327,38 @@ inline void catmull_rom_spline(int n_points,
res_y.push_back(p1_y);
}
} else {
for (i = 1; i < n_points-1; ++i) {
t = t1 + space * i;
for (int i = 1; i < n_points-1; ++i) {
double t = t1 + space * i;
c = (t1 - t)/(t1 - t0);
d = (t - t0)/(t1 - t0);
A1_x = c * p0_x + d * p1_x;
A1_y = c * p0_y + d * p1_y;
double c = (t1 - t)/(t1 - t0);
double d = (t - t0)/(t1 - t0);
double A1_x = c * p0_x + d * p1_x;
double A1_y = c * p0_y + d * p1_y;
c = (t2 - t)/(t2 - t1);
d = (t - t1)/(t2 - t1);
A2_x = c * p1_x + d * p2_x;
A2_y = c * p1_y + d * p2_y;
double A2_x = c * p1_x + d * p2_x;
double A2_y = c * p1_y + d * p2_y;
c = (t3 - t)/(t3 - t2);
d = (t - t2)/(t3 - t2);
A3_x = c * p2_x + d * p3_x;
A3_y = c * p2_y + d * p3_y;
double A3_x = c * p2_x + d * p3_x;
double A3_y = c * p2_y + d * p3_y;
c = (t2 - t)/(t2 - t0);
d = (t - t0)/(t2 - t0);
B1_x = c * A1_x + d * A2_x;
B1_y = c * A1_y + d * A2_y;
double B1_x = c * A1_x + d * A2_x;
double B1_y = c * A1_y + d * A2_y;
c = (t3 - t)/(t3 - t1);
d = (t - t1)/(t3 - t1);
B2_x = c * A2_x + d * A3_x;
B2_y = c * A2_y + d * A3_y;
double B2_x = c * A2_x + d * A3_x;
double B2_y = c * A2_y + d * A3_y;
c = (t2 - t)/(t2 - t1);
d = (t - t1)/(t2 - t1);
C_x = c * B1_x + d * B2_x;
C_y = c * B1_y + d * B2_y;
double C_x = c * B1_x + d * B2_x;
double C_y = c * B1_y + d * B2_y;
res_x.push_back(C_x);
res_y.push_back(C_y);
@@ -512,7 +506,6 @@ double DiagonalCurve::getVal (double t) const
++d;
}
return LIM01(*(poly_y.begin() + d));
break;
}
case DCT_NURBS : {