Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/boost/geometry/arithmetic/determinant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried writing this as:

    return (rt(ux) * rt(vy)) - (rt(uy) * rt(vx));

It should give the same results as your alternative code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it gives the same result as the original. Btw, I'm compiling using MinGW-w64, it's also shipped with QtCreator for Windows, in case you'd like to play with it.

// 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);
}
};

Expand Down
43 changes: 43 additions & 0 deletions test/algorithms/overlay/get_turns_linear_linear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, double>::value)) )
{
test_geometry<ls, ls>("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<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(15 0.5, 14 0.4, 13 0.3, 12 10)",
expected("miu+=")("mui=+"));
test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
"LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)",
expected("mui=+")("mix+="));
test_geometry<ls, ls>("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<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(13 0.3, 14 0.4, 15 0.5)",
expected("mii++")("ccc==")("mux=="));
test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(15 0.5, 14 0.4, 13 0.3)",
expected("mix+=")("mui=+"));
test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
"LINESTRING(13 0.3, 14 0.4, 15 0.5)",
expected("mui=+")("mix+="));
test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
"LINESTRING(15 0.5, 14 0.4, 13 0.3)",
expected("mux==")("ccc==")("mii++"));

test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(12 10, 13 0.3, 14 0.4)",
expected("mii++")("mux=="));
test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(14 0.4, 13 0.3, 12 10)",
expected("miu+=")("mui=+"));
test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
"LINESTRING(12 10, 13 0.3, 14 0.4)",
expected("mui=+")("mix+="));
test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
"LINESTRING(14 0.4, 13 0.3, 12 10)",
expected("muu==")("mii++"));
}

// TODO:
//test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
//test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
Expand Down