Skip to content

Commit

Permalink
Add test for segment-box intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Feb 1, 2025
1 parent db1ac4a commit ee7b510
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/tstDetailsAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ BOOST_AUTO_TEST_CASE(intersects)
BOOST_TEST(!intersects(Segment2{{1.1, 1}, {2, 1}}, seg));
BOOST_TEST(!intersects(Segment2{{1, 0}, {2, 1}}, seg));
BOOST_TEST(!intersects(Segment2{{1, 3}, {3, 1.1}}, seg));

constexpr ArborX::Box<2> box2{{{0.0, 0.0}}, {{1.0, 1.0}}};
BOOST_TEST(intersects(Segment2{{0, 0}, {0, 0}}, box2));
BOOST_TEST(intersects(Segment2{{-1, 1}, {1, -1}}, box2));
BOOST_TEST(intersects(Segment2{{-1, 0}, {2, 0}}, box2));
BOOST_TEST(intersects(Segment2{{-1, 0.5}, {0.5, 0.5}}, box2));
BOOST_TEST(intersects(Segment2{{-1, 2}, {2, -1}}, box2));
BOOST_TEST(intersects(Segment2{{0.5, 2}, {0.5, -1}}, box2));
BOOST_TEST(!intersects(Segment2{{0, -1}, {1, -1}}, box2));
BOOST_TEST(!intersects(Segment2{{0.5, 1.6}, {2, 0}}, box2));
BOOST_TEST(intersects(box2, Segment2{{-1, 2}, {2, -1}}));
BOOST_TEST(!intersects(Segment2{{0.5, 1.6}, {2, 0}}, box2));
}

BOOST_AUTO_TEST_CASE(equals)
Expand Down

0 comments on commit ee7b510

Please sign in to comment.