From cc46ff57df011882c2fa39681df3cbaaacf4f474 Mon Sep 17 00:00:00 2001 From: ggartside Date: Fri, 3 Mar 2023 08:11:00 -0600 Subject: [PATCH] Update src/utilities/geometry/Intersection.cpp Co-authored-by: Julien Marrec --- src/utilities/geometry/Intersection.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utilities/geometry/Intersection.cpp b/src/utilities/geometry/Intersection.cpp index fe29aac9de5..bd5f71ec94f 100644 --- a/src/utilities/geometry/Intersection.cpp +++ b/src/utilities/geometry/Intersection.cpp @@ -151,8 +151,11 @@ std::ostream& operator<<(std::ostream& os, const BoostMultiPolygon& boostPolygon return os; } -// Scale factor for parameters passed to boost -double scaleBy = 1000.0; +// Scale factor for parameters when converting between openstudio and boost data formats to improve the numerical accuracy of the boolean operations. +// Idea came from this comment in the boostorg/geometry repo: https://github.com/boostorg/geometry/issues/1034#issuecomment-1284180101 +// where the author indicates that scaling the values by 10 improved the result and talks about rounding to an integer grid, +// so by increasing the range of values we pass to boost we should be improving the resolution of the integer rounding +static constexpr double scaleBy = 1000.0; // Cleans a polygon by shrinking and expanding. Can return multiple polygons std::vector removeSpikesEx(const BoostPolygon& polygon) {