42 typedef std::tuple<SEG, bool, VECTOR2I>
SEG_CASE;
44 std::vector<SEG_CASE>
segs;
115 BOOST_CHECK( !common.solidPolySet.HasHoles() );
116 BOOST_CHECK( common.holeyPolySet.HasHoles() );
126 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 0, 50 ) ) );
129 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 0, 10 ) ) );
132 BOOST_CHECK( common.holeyPolySet.PointOnEdge(
VECTOR2I( 10, 11 ) ) );
135 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 12, 12 ) ) );
138 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 90, 90 ) ) );
141 BOOST_CHECK( !common.holeyPolySet.PointOnEdge(
VECTOR2I( 200, 200 ) ) );
151 for(
const VECTOR2I& point : collidingPoints )
153 std::stringstream ss;
154 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
157 BOOST_CHECK( common.holeyPolySet.Contains( point ) );
161 for(
const VECTOR2I& point : nonCollidingPoints )
163 std::stringstream ss;
164 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
167 BOOST_CHECK( !common.holeyPolySet.Contains( point ) );
179 for(
const VECTOR2I& point : collidingPoints )
181 std::stringstream ss;
182 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
185 BOOST_CHECK( common.holeyPolySet.Collide( point, 0 ) );
189 for(
const VECTOR2I& point : nonCollidingPoints )
191 std::stringstream ss;
192 ss <<
"Point {" << point.x <<
", " << point.y <<
" }";
195 BOOST_CHECK( !common.holeyPolySet.Collide( point, 0 ) );
201 BOOST_CHECK( common.holeyPolySet.Collide(
VECTOR2I( -1, 10 ), 5 ) );
204 BOOST_CHECK( common.holeyPolySet.Collide(
VECTOR2I( 11, 11 ), 5 ) );
214 for(
const VECTOR2I& point : common.holeyPoints )
217 " Point " << point.
x <<
", " << point.
y <<
218 " does not collide with holeyPolySet polygon" );
229 for(
const VECTOR2I& point : common.holeyPoints )
230 BOOST_CHECK( common.holeyPolySet.CollideVertex( point +
VECTOR2I( 1, 1 ),
nullptr, 2 ) );
239 for(
const SEG_CASE& testCase : segs )
245 std::tie( seg, expectedResult, expectedLocation ) = testCase;
249 BOOST_CHECK( common.holeyPolySet.Collide( seg, 0,
nullptr, &
location ) == expectedResult );
252 BOOST_REQUIRE_EQUAL(
location, expectedLocation );
261 outline.
Append( 1000, 1000 );
262 outline.
Append( 2000, 1000 );
263 outline.
Append( 2000, 2000 );
264 outline.
Append( 1000, 2000 );
266 square.AddOutline( outline );
271 std::vector<SEG> nearMisses = {
278 for(
const SEG& seg : nearMisses )
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
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_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_INFO("Two-port Series .op current = "<< iDevice)
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
BOOST_TEST_CONTEXT("Test Clearance")
BOOST_AUTO_TEST_CASE(HasHoles)
Declares the CollisionFixture as the boost test suite fixture.
BOOST_CHECK_EQUAL(result, "25.4")
VECTOR2< int32_t > VECTOR2I