diff --git a/include/boost/geometry/arithmetic/determinant.hpp b/include/boost/geometry/arithmetic/determinant.hpp index 14edea7182..1c11104961 100644 --- a/include/boost/geometry/arithmetic/determinant.hpp +++ b/include/boost/geometry/arithmetic/determinant.hpp @@ -39,7 +39,13 @@ public : static inline ReturnType apply(U const& ux, U const& uy , V const& vx, V const& vy) { - return rt(ux) * rt(vy) - rt(uy) * rt(vx); + // NOTE: the explicit temporaries are here on purpose + // without them in some cases MinGW and probably QCC + // calculate different results than MSVC and GCC + ReturnType const t1 = rt(ux) * rt(vy); + ReturnType const t2 = rt(uy) * rt(vx); + return t1 - t2; + //return rt(ux) * rt(vy) - rt(uy) * rt(vx); } }; diff --git a/test/algorithms/overlay/get_turns_linear_linear.cpp b/test/algorithms/overlay/get_turns_linear_linear.cpp index 9278c02fd6..f7be94e047 100644 --- a/test/algorithms/overlay/get_turns_linear_linear.cpp +++ b/test/algorithms/overlay/get_turns_linear_linear.cpp @@ -290,6 +290,49 @@ void test_all() expected("")("")); } + // 10.03.2015 results different for MinGW and MSVC/GCC + if ( BOOST_GEOMETRY_CONDITION((boost::is_same::value)) ) + { + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)", + expected("mii++")("ccc==")("mux==")); + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(15 0.5, 14 0.4, 13 0.3, 12 10)", + expected("miu+=")("mui=+")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)", + expected("mui=+")("mix+=")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(15 0.5, 14 0.4, 13 0.3, 12 10)", + expected("muu==")("ccc==")("mii++")); + + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(13 0.3, 14 0.4, 15 0.5)", + expected("mii++")("ccc==")("mux==")); + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(15 0.5, 14 0.4, 13 0.3)", + expected("mix+=")("mui=+")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(13 0.3, 14 0.4, 15 0.5)", + expected("mui=+")("mix+=")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(15 0.5, 14 0.4, 13 0.3)", + expected("mux==")("ccc==")("mii++")); + + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(12 10, 13 0.3, 14 0.4)", + expected("mii++")("mux==")); + test_geometry("LINESTRING(0 0, 10 0, 20 1)", + "LINESTRING(14 0.4, 13 0.3, 12 10)", + expected("miu+=")("mui=+")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(12 10, 13 0.3, 14 0.4)", + expected("mui=+")("mix+=")); + test_geometry("LINESTRING(20 1, 10 0, 0 0)", + "LINESTRING(14 0.4, 13 0.3, 12 10)", + expected("muu==")("mii++")); + } + // TODO: //test_geometry("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102"); //test_geometry("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");