add determinism test

This commit is contained in:
Sébastien Loriot 2022-02-15 17:38:19 +01:00 committed by Laurent Rineau
parent f7fa358585
commit fe9b74dcd3
1 changed files with 21 additions and 0 deletions

View File

@ -481,6 +481,27 @@ struct Test
check_intersection (S(p( -1,-1), p( -2,-2)), S(p(-2,-2), p(-1,-1)), S(p(-2,-2),p(-1,-1))); check_intersection (S(p( -1,-1), p( -2,-2)), S(p(-2,-2), p(-1,-1)), S(p(-2,-2),p(-1,-1)));
check_intersection (S(p( -2,-2), p( -1,-1)), S(p(-1,-1), p(-2,-2)), S(p(-2,-2),p(-1,-1))); check_intersection (S(p( -2,-2), p( -1,-1)), S(p(-1,-1), p(-2,-2)), S(p(-2,-2),p(-1,-1)));
check_intersection (S(p( -2,-2), p( -1,-1)), S(p(-2,-2), p(-1,-1)), S(p(-2,-2),p(-1,-1))); check_intersection (S(p( -2,-2), p( -1,-1)), S(p(-2,-2), p(-1,-1)), S(p(-2,-2),p(-1,-1)));
//check determinism of crossing point
P p1a(-122.37323046264295, 37.7435274415764);
P p1b(-122.3711959178425, 37.74348027376899);
P p2a(-122.37130249711004, 37.74203327688176);
P p2b(-122.3722247426892, 37.74401427059434);
std::set<double> ds;
auto test = [&ds](S s1, S s2)
{
P i = boost::get<P>(*CGAL::intersection(s1,s2));
ds.insert(CGAL::to_double(i.x())); ds.insert(CGAL::to_double(i.y()));
assert(ds.size()==2);
};
test(S(p1a,p1b), S(p2a,p2b));
test(S(p1a,p1b), S(p2b,p2a));
test(S(p1b,p1a), S(p2b,p2a));
test(S(p1b,p1a), S(p2a,p2b));
test(S(p2a,p2b), S(p1a,p1b));
test(S(p2b,p2a), S(p1a,p1b));
test(S(p2b,p2a), S(p1b,p1a));
test(S(p2a,p2b), S(p1b,p1a));
} }
void R_R() void R_R()