46 typedef std::tuple<SEG, bool, VECTOR2I>
SEG_CASE;
48 std::vector<SEG_CASE>
segs;
119 BOOST_CHECK( !common.solidPolySet.HasHoles() );
120 BOOST_CHECK( common.holeyPolySet.HasHoles() );
130 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 0, 50 ) ) );
133 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 0, 10 ) ) );
136 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 10, 11 ) ) );
139 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 12, 12 ) ) );
142 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 90, 90 ) ) );
145 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 200, 200 ) ) );
155 for(
const VECTOR2I& point : collidingPoints )
157 std::stringstream ss;
158 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
159 BOOST_TEST_INFO( ss.str() );
161 BOOST_CHECK( common.holeyPolySet.Contains( point ) );
165 for(
const VECTOR2I& point : nonCollidingPoints )
167 std::stringstream ss;
168 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
169 BOOST_TEST_INFO( ss.str() );
171 BOOST_CHECK( !common.holeyPolySet.Contains( point ) );
183 for(
const VECTOR2I& point : collidingPoints )
185 std::stringstream ss;
186 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
187 BOOST_TEST_INFO( ss.str() );
189 BOOST_CHECK( common.holeyPolySet.Collide( point, 0 ) );
193 for(
const VECTOR2I& point : nonCollidingPoints )
195 std::stringstream ss;
196 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
197 BOOST_TEST_INFO( ss.str() );
199 BOOST_CHECK( !common.holeyPolySet.Collide( point, 0 ) );
205 BOOST_CHECK( common.holeyPolySet.Collide(
VECTOR2I( -1, 10 ), 5 ) );
208 BOOST_CHECK( common.holeyPolySet.Collide(
VECTOR2I( 11, 11 ), 5 ) );
218 for(
const VECTOR2I& point : common.holeyPoints )
220 BOOST_CHECK_MESSAGE( common.holeyPolySet.CollideVertex( point,
nullptr, 0 ),
221 " Point " << point.
x <<
", " << point.
y <<
222 " does not collide with holeyPolySet polygon" );
233 for(
const VECTOR2I& point : common.holeyPoints )
234 BOOST_CHECK( common.holeyPolySet.CollideVertex( point +
VECTOR2I( 1, 1 ),
nullptr, 2 ) );
243 for(
const SEG_CASE& testCase : segs )
249 std::tie( seg, expectedResult, expectedLocation ) = testCase;
253 BOOST_CHECK( common.holeyPolySet.Collide( seg, 0,
nullptr, &location ) == expectedResult );
256 BOOST_REQUIRE_EQUAL( location, expectedLocation );
static bool Collide(const SHAPE_CIRCLE &aA, const SHAPE_CIRCLE &aB, int aClearance, int *aActual, VECTOR2I *aLocation, VECTOR2I *aMTV)
Fixture for the Collision test suite.
struct KI_TEST::CommonTestData common
CollisionFixture()
Constructor.
std::tuple< SEG, bool, VECTOR2I > SEG_CASE
std::vector< VECTOR2I > collidingPoints
std::vector< VECTOR2I > nonCollidingPoints
std::vector< SEG_CASE > segs
Common data for some of the SHAPE_POLY_SET tests:
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(HasHoles)
Declares the CollisionFixture as the boost test suite fixture.
VECTOR2< int32_t > VECTOR2I