Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9729ac2

Browse files
committed
MNT: make local variable const
To make clear we won't be changing them.
1 parent b3476a8 commit 9729ac2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/_path.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -857,19 +857,19 @@ inline bool segments_intersect(const double &x1,
857857
(fmin(x3, x4) <= fmin(x1, x2) && fmin(x1, x2) <= fmax(x3, x4));
858858
}
859859
}
860-
860+
861861
return false;
862862
}
863863

864-
double n1 = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3));
865-
double n2 = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3));
864+
const double n1 = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3));
865+
const double n2 = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3));
866866

867-
double u1 = n1 / den;
868-
double u2 = n2 / den;
867+
const double u1 = n1 / den;
868+
const double u2 = n2 / den;
869869

870-
return ((u1 > 0.0 || isclose(u1, 0.0, rtol, atol)) &&
871-
(u1 < 1.0 || isclose(u1, 1.0, rtol, atol)) &&
872-
(u2 > 0.0 || isclose(u2, 0.0, rtol, atol)) &&
870+
return ((u1 > 0.0 || isclose(u1, 0.0, rtol, atol)) &&
871+
(u1 < 1.0 || isclose(u1, 1.0, rtol, atol)) &&
872+
(u2 > 0.0 || isclose(u2, 0.0, rtol, atol)) &&
873873
(u2 < 1.0 || isclose(u2, 1.0, rtol, atol)));
874874
}
875875

0 commit comments

Comments
 (0)