mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-12 05:29:05 +08:00
Fixed overflow in Polygon::area()
This commit is contained in:
parent
fe3f5471e7
commit
40bb0b6f55
@ -103,7 +103,7 @@ double Polygon::area() const
|
|||||||
|
|
||||||
double a = 0.;
|
double a = 0.;
|
||||||
for (size_t i = 0, j = n - 1; i < n; ++i) {
|
for (size_t i = 0, j = n - 1; i < n; ++i) {
|
||||||
a += double(points[j].x + points[i].x) * double(points[i].y - points[j].y);
|
a += ((double)points[j].x + (double)points[i].x) * ((double)points[i].y - (double)points[j].y);
|
||||||
j = i;
|
j = i;
|
||||||
}
|
}
|
||||||
return 0.5 * a;
|
return 0.5 * a;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user