diff --git a/test/geometry/test_0d1d_intersection.cc b/test/geometry/test_0d1d_intersection.cc index 15bd5730e9053368d640c43abc8e0e41b9a3a69b..68286011de8e303e9f9171d311c3389a9355a15b 100644 --- a/test/geometry/test_0d1d_intersection.cc +++ b/test/geometry/test_0d1d_intersection.cc @@ -49,12 +49,25 @@ void testIntersections(std::vector<bool>& returns) GlobalPosition p5 = a - (b - a); GlobalPosition p6(0.5*scaling); + GlobalPosition delta = b - a; + delta *= 1.5e-7; + GlobalPosition p7 = a - delta; + GlobalPosition p8 = b + delta; + GlobalPosition p9 = a + delta; + GlobalPosition p10 = b - delta; + returns.push_back(testIntersection(a, b, p1, true)); returns.push_back(testIntersection(a, b, p2, true)); returns.push_back(testIntersection(a, b, p3, true)); returns.push_back(testIntersection(a, b, p4)); returns.push_back(testIntersection(a, b, p5)); returns.push_back(testIntersection(a, b, p6)); + + // test cases where the point is just on or just outside the segment + returns.push_back(testIntersection(a, b, p7)); + returns.push_back(testIntersection(a, b, p8)); + returns.push_back(testIntersection(a, b, p9, true)); + returns.push_back(testIntersection(a, b, p10, true)); } } diff --git a/test/geometry/test_0d2d_intersection.cc b/test/geometry/test_0d2d_intersection.cc index 077def4387df5b5a88601b7531671ca994b6cf96..a9209b13da2065a62c111b27c0500a548519c7b1 100644 --- a/test/geometry/test_0d2d_intersection.cc +++ b/test/geometry/test_0d2d_intersection.cc @@ -45,6 +45,10 @@ void runIntersectionTest(std::vector<bool>& returns, const Transformation& trans returns.push_back(testIntersection(triangle, transform({0.5, 0.51}), false, verbose)); returns.push_back(testIntersection(triangle, transform({0.0, -0.01}), false, verbose)); + // test cases where the point is just inside or just outside the triangle + returns.push_back(testIntersection(triangle, transform({0.0, -1.5e-7}), false, verbose)); + returns.push_back(testIntersection(triangle, transform({1.0+1.5e-7, 1.5e-7}), false, verbose)); + // test quadrilateral-point intersections if (verbose) std::cout << "\n -- Test quadrilateral-point intersections" << std::endl; @@ -64,6 +68,9 @@ void runIntersectionTest(std::vector<bool>& returns, const Transformation& trans returns.push_back(testIntersection(quadrilateral, transform({0.5, 1.01}), false, verbose)); returns.push_back(testIntersection(quadrilateral, transform({0.0, -0.01}), false, verbose)); + // test cases where the point is just inside or just outside the triangle + returns.push_back(testIntersection(quadrilateral, transform({0.0, -1.5e-7}), false, verbose)); + returns.push_back(testIntersection(quadrilateral, transform({1.0+1.5e-7, 1.5e-7}), false, verbose)); } template<class Transformation>