diff options
Diffstat (limited to 'boost/geometry/strategies/cartesian/area_surveyor.hpp')
-rw-r--r-- | boost/geometry/strategies/cartesian/area_surveyor.hpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/boost/geometry/strategies/cartesian/area_surveyor.hpp b/boost/geometry/strategies/cartesian/area_surveyor.hpp index 74b63532c0..ba76f67946 100644 --- a/boost/geometry/strategies/cartesian/area_surveyor.hpp +++ b/boost/geometry/strategies/cartesian/area_surveyor.hpp @@ -4,6 +4,11 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// This file was modified by Oracle on 2016. +// Modifications copyright (c) 2016, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -17,7 +22,7 @@ #include <boost/mpl/if.hpp> -#include <boost/geometry/arithmetic/determinant.hpp> +//#include <boost/geometry/arithmetic/determinant.hpp> #include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/core/coordinate_dimension.hpp> #include <boost/geometry/util/select_most_precise.hpp> @@ -98,8 +103,20 @@ public : PointOfSegment const& p2, summation& state) { + // Below formulas are equivalent, however the two lower ones + // suffer less from accuracy loss for great values of coordinates. + // See: https://svn.boost.org/trac/boost/ticket/11928 + // SUM += x2 * y1 - x1 * y2; - state.sum += detail::determinant<return_type>(p2, p1); + // state.sum += detail::determinant<return_type>(p2, p1); + + // SUM += (x2 - x1) * (y2 + y1) + //state.sum += (return_type(get<0>(p2)) - return_type(get<0>(p1))) + // * (return_type(get<1>(p2)) + return_type(get<1>(p1))); + + // SUM += (x1 + x2) * (y1 - y2) + state.sum += (return_type(get<0>(p1)) + return_type(get<0>(p2))) + * (return_type(get<1>(p1)) - return_type(get<1>(p2))); } static inline return_type result(summation const& state) |