Polygon: Avoid stackoverflow when summing exact numbers

This commit is contained in:
Andreas Fabri 2024-02-28 14:28:00 +00:00
parent 074a05811a
commit 3bd448d1a8
1 changed files with 3 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <CGAL/config.h>
#include <CGAL/enum.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Lazy.h>
#include <CGAL/Polygon_2/polygon_assertions.h>
///
@ -153,6 +154,7 @@ area_2( ForwardIterator first, ForwardIterator last,
ForwardIterator third = second;
while (++third != last) {
result = result + compute_area_2(*first, *second, *third);
exact(result);
second = third;
}
}
@ -190,6 +192,7 @@ polygon_area_2( ForwardIterator first, ForwardIterator last,
ForwardIterator third = second;
while (++third != last) {
result = result + compute_area_2(*first, *second, *third);
exact(result);
second = third;
}
return result;