mirror of https://github.com/CGAL/cgal
Polygon: Avoid stackoverflow when summing exact numbers
This commit is contained in:
parent
074a05811a
commit
3bd448d1a8
|
|
@ -24,6 +24,7 @@
|
||||||
#include <CGAL/config.h>
|
#include <CGAL/config.h>
|
||||||
#include <CGAL/enum.h>
|
#include <CGAL/enum.h>
|
||||||
#include <CGAL/Bbox_2.h>
|
#include <CGAL/Bbox_2.h>
|
||||||
|
#include <CGAL/Lazy.h>
|
||||||
#include <CGAL/Polygon_2/polygon_assertions.h>
|
#include <CGAL/Polygon_2/polygon_assertions.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -153,6 +154,7 @@ area_2( ForwardIterator first, ForwardIterator last,
|
||||||
ForwardIterator third = second;
|
ForwardIterator third = second;
|
||||||
while (++third != last) {
|
while (++third != last) {
|
||||||
result = result + compute_area_2(*first, *second, *third);
|
result = result + compute_area_2(*first, *second, *third);
|
||||||
|
exact(result);
|
||||||
second = third;
|
second = third;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -190,6 +192,7 @@ polygon_area_2( ForwardIterator first, ForwardIterator last,
|
||||||
ForwardIterator third = second;
|
ForwardIterator third = second;
|
||||||
while (++third != last) {
|
while (++third != last) {
|
||||||
result = result + compute_area_2(*first, *second, *third);
|
result = result + compute_area_2(*first, *second, *third);
|
||||||
|
exact(result);
|
||||||
second = third;
|
second = third;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue