46 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
47 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 0 ),
"Expected: " <<
VECTOR2I( 15, 0 ) <<
" Actual: " << ptB );
60 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
61 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
73 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
74 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 1, 0 ),
"Expected: " <<
VECTOR2I( 1, 0 ) <<
" Actual: " << ptB );
87 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( -7, 5 ),
"Expected: " <<
VECTOR2I( -7, 5 ) <<
" Actual: " << ptA );
88 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptB );
103 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 3, 5 ),
"Expected: " <<
VECTOR2I( 3, 5 ) <<
" Actual: " << ptA );
104 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptB );
114 bool result =
circle.NearestPoints( &segment, ptA, ptB );
117 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 3 ),
"Expected: " <<
VECTOR2I( 0, 3 ) <<
" Actual: " << ptA );
118 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptB );
127 bool result =
circle.NearestPoints( &segment, ptA, ptB );
131 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 3 ),
"Expected: " <<
VECTOR2I( 0, 3 ) <<
" Actual: " << ptA );
132 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptB );
145 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
146 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
158 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptA );
159 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 7, 7 ),
"Expected: " <<
VECTOR2I( 7, 7 ) <<
" Actual: " << ptB );
178 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptA );
179 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptB );
195 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
196 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 10 ),
"Expected: " <<
VECTOR2I( 10, 10 ) <<
" Actual: " << ptB );
211 BOOST_CHECK( ptA.
x <= 10 && ptA.
x >= 0 );
212 BOOST_CHECK( ptB.
x >= 15 && ptB.
x <= 25 );
226 BOOST_CHECK( ptA.
y >= 0 );
228 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 7 ),
"Expected: " <<
VECTOR2I( 5, 7 ) <<
" Actual: " << ptB );
242 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 1 ),
"Expected: " <<
VECTOR2I( 5, 1 ) <<
" Actual: " << ptA );
243 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 4 ),
"Expected: " <<
VECTOR2I( 5, 4 ) <<
" Actual: " << ptB );
255 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 2 ),
"Expected: " <<
VECTOR2I( 5, 2 ) <<
" Actual: " << ptA );
256 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 7 ),
"Expected: " <<
VECTOR2I( 5, 7 ) <<
" Actual: " << ptB );
274 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
275 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 17, 0 ),
"Expected: " <<
VECTOR2I( 17, 0 ) <<
" Actual: " << ptB );
294 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 12, 5 ),
"Expected: " <<
VECTOR2I( 12, 5 ) <<
" Actual: " << ptB );
307 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptA );
308 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 5 ),
"Expected: " <<
VECTOR2I( 15, 5 ) <<
" Actual: " << ptB );
324 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
325 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
341 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 107, 7 ),
"Expected: " <<
VECTOR2I( 107, 7 ) <<
" Actual: " << ptA );
342 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 150, 50 ),
"Expected: " <<
VECTOR2I( 150, 50 ) <<
" Actual: " << ptB );
358 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 3, 0 ),
"Expected: " <<
VECTOR2I( 3, 0 ) <<
" Actual: " << ptA );
359 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
372 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
373 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 50, 2 ),
"Expected: " <<
VECTOR2I( 50, 2 ) <<
" Actual: " << ptB );
388 BOOST_CHECK( ptA.
x >= 0 );
389 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 10 ),
"Expected: " <<
VECTOR2I( 15, 10 ) <<
" Actual: " << ptB );
403 bool result =
chain.NearestPoints( &arc, ptB, ptA );
407 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptA );
408 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 10 ),
"Expected: " <<
VECTOR2I( 5, 10 ) <<
" Actual: " << ptB );
423 int expectedDistance = 20 - 5 - 3;
424 int actualDistance = (ptB - ptA).EuclideanNorm();
426 BOOST_CHECK_MESSAGE( actualDistance == expectedDistance,
427 "Expected distance: " << expectedDistance <<
" Actual: " << actualDistance );
443 BOOST_CHECK( result1 && result2 );
446 int dist1 = (ptB1 - ptA1).EuclideanNorm();
447 int dist2 = (ptB2 - ptA2).EuclideanNorm();
449 BOOST_CHECK_MESSAGE( dist1 == dist2,
"Distance A->B: " << dist1 <<
" Distance B->A: " << dist2 );
452 BOOST_CHECK_MESSAGE( ptA1 == ptB2,
"Expected ptA1 == ptB2. ptA1: " << ptA1 <<
" ptB2: " << ptB2 );
453 BOOST_CHECK_MESSAGE( ptB1 == ptA2,
"Expected ptB1 == ptA2. ptB1: " << ptB1 <<
" ptA2: " << ptA2 );
467 int minDist = (ptB - ptA).EuclideanNorm();
470 for(
int x = 0; x <= 10; x += 2 )
474 (testPt -
circle.GetCenter()).Resize(
circle.GetRadius() );
475 int testDist = (circleClosest - testPt).EuclideanNorm();
477 BOOST_CHECK_MESSAGE( minDist <= testDist,
478 "Found shorter distance at x=" << x <<
": " << testDist <<
" vs " << minDist );
497 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 12 ),
"Expected: " <<
VECTOR2I( 15, 12 ) <<
" Actual: " << ptB );
510 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptA );
511 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 3, 5 ),
"Expected: " <<
VECTOR2I( 3, 5 ) <<
" Actual: " << ptB );
520 bool result =
circle.NearestPoints( &zeroSeg, ptA, ptB );
523 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 7, 5 ),
"Expected: " <<
VECTOR2I( 7, 5 ) <<
" Actual: " << ptA );
524 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptB );
550 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( -7, -4 ),
"Expected: " <<
VECTOR2I( -7, -4 ) <<
" Actual: " << ptA );
551 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, -2 ),
"Expected: " <<
VECTOR2I( 0, -2 ) <<
" Actual: " << ptB );
565 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 8, 5 ),
"Expected: " <<
VECTOR2I( 8, 5 ) <<
" Actual: " << ptA );
566 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 8, 5 ),
"Expected: " <<
VECTOR2I( 8, 5 ) <<
" Actual: " << ptB );
578 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptA );
579 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptB );
591 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
592 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptB );
bool NearestPoints(const SHAPE_ARC &aArc, VECTOR2I &aPtA, VECTOR2I &aPtB, int64_t &aDistSq) const
Compute closest points between this arc and aArc.
void AddShape(SHAPE *aShape)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
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.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
bool NearestPoints(const SHAPE *aOther, VECTOR2I &aPtThis, VECTOR2I &aPtOther) const
Return the two points that mark the closest distance between this shape and aOther.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
const SHAPE_LINE_CHAIN chain
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
BOOST_AUTO_TEST_CASE(NearestPoints_CircleToCircle_Separate)
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< int32_t > VECTOR2I