50 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
51 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 0 ),
"Expected: " <<
VECTOR2I( 15, 0 ) <<
" Actual: " << ptB );
64 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
65 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
77 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
78 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 1, 0 ),
"Expected: " <<
VECTOR2I( 1, 0 ) <<
" Actual: " << ptB );
91 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( -7, 5 ),
"Expected: " <<
VECTOR2I( -7, 5 ) <<
" Actual: " << ptA );
92 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptB );
107 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 3, 5 ),
"Expected: " <<
VECTOR2I( 3, 5 ) <<
" Actual: " << ptA );
108 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptB );
118 bool result =
circle.NearestPoints( &segment, ptA, ptB );
121 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 3 ),
"Expected: " <<
VECTOR2I( 0, 3 ) <<
" Actual: " << ptA );
122 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptB );
131 bool result =
circle.NearestPoints( &segment, ptA, ptB );
135 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 3 ),
"Expected: " <<
VECTOR2I( 0, 3 ) <<
" Actual: " << ptA );
136 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptB );
149 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptA );
150 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptB );
162 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptA );
163 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 7, 7 ),
"Expected: " <<
VECTOR2I( 7, 7 ) <<
" Actual: " << ptB );
182 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptA );
183 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptB );
199 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
200 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 10 ),
"Expected: " <<
VECTOR2I( 10, 10 ) <<
" Actual: " << ptB );
215 BOOST_CHECK( ptA.
x <= 10 && ptA.
x >= 0 );
216 BOOST_CHECK( ptB.
x >= 15 && ptB.
x <= 25 );
230 BOOST_CHECK( ptA.
y >= 0 );
232 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 7 ),
"Expected: " <<
VECTOR2I( 5, 7 ) <<
" Actual: " << ptB );
246 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 1 ),
"Expected: " <<
VECTOR2I( 5, 1 ) <<
" Actual: " << ptA );
247 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 4 ),
"Expected: " <<
VECTOR2I( 5, 4 ) <<
" Actual: " << ptB );
259 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 2 ),
"Expected: " <<
VECTOR2I( 5, 2 ) <<
" Actual: " << ptA );
260 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 7 ),
"Expected: " <<
VECTOR2I( 5, 7 ) <<
" Actual: " << ptB );
278 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
279 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 17, 0 ),
"Expected: " <<
VECTOR2I( 17, 0 ) <<
" Actual: " << ptB );
298 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 12, 5 ),
"Expected: " <<
VECTOR2I( 12, 5 ) <<
" Actual: " << ptB );
311 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 5 ),
"Expected: " <<
VECTOR2I( 10, 5 ) <<
" Actual: " << ptA );
312 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 5 ),
"Expected: " <<
VECTOR2I( 15, 5 ) <<
" Actual: " << ptB );
328 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
329 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
345 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 11, 1 ),
"Expected: " <<
VECTOR2I( 11, 1 ) <<
" Actual: " << ptA );
346 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 5 ),
"Expected: " <<
VECTOR2I( 15, 5 ) <<
" Actual: " << ptB );
362 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 3, 0 ),
"Expected: " <<
VECTOR2I( 3, 0 ) <<
" Actual: " << ptA );
363 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptB );
376 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 10, 0 ),
"Expected: " <<
VECTOR2I( 10, 0 ) <<
" Actual: " << ptA );
377 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 50, 2 ),
"Expected: " <<
VECTOR2I( 50, 2 ) <<
" Actual: " << ptB );
392 BOOST_CHECK( ptA.
x >= 0 );
393 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 10 ),
"Expected: " <<
VECTOR2I( 15, 10 ) <<
" Actual: " << ptB );
407 bool result =
chain.NearestPoints( &arc, ptB, ptA );
411 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptA );
412 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 10 ),
"Expected: " <<
VECTOR2I( 5, 10 ) <<
" Actual: " << ptB );
427 int expectedDistance = 20 - 5 - 3;
428 int actualDistance = (ptB - ptA).EuclideanNorm();
430 BOOST_CHECK_MESSAGE( actualDistance == expectedDistance,
431 "Expected distance: " << expectedDistance <<
" Actual: " << actualDistance );
447 BOOST_CHECK( result1 && result2 );
450 int dist1 = (ptB1 - ptA1).EuclideanNorm();
451 int dist2 = (ptB2 - ptA2).EuclideanNorm();
453 BOOST_CHECK_MESSAGE( dist1 == dist2,
"Distance A->B: " << dist1 <<
" Distance B->A: " << dist2 );
456 BOOST_CHECK_MESSAGE( ptA1 == ptB2,
"Expected ptA1 == ptB2. ptA1: " << ptA1 <<
" ptB2: " << ptB2 );
457 BOOST_CHECK_MESSAGE( ptB1 == ptA2,
"Expected ptB1 == ptA2. ptB1: " << ptB1 <<
" ptA2: " << ptA2 );
471 int minDist = (ptB - ptA).EuclideanNorm();
474 for(
int x = 0; x <= 10; x += 2 )
478 (testPt -
circle.GetCenter()).Resize(
circle.GetRadius() );
479 int testDist = (circleClosest - testPt).EuclideanNorm();
481 BOOST_CHECK_MESSAGE( minDist <= testDist,
482 "Found shorter distance at x=" << x <<
": " << testDist <<
" vs " << minDist );
501 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 15, 12 ),
"Expected: " <<
VECTOR2I( 15, 12 ) <<
" Actual: " << ptB );
514 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 5 ),
"Expected: " <<
VECTOR2I( 0, 5 ) <<
" Actual: " << ptA );
515 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 3, 5 ),
"Expected: " <<
VECTOR2I( 3, 5 ) <<
" Actual: " << ptB );
524 bool result =
circle.NearestPoints( &zeroSeg, ptA, ptB );
527 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 7, 5 ),
"Expected: " <<
VECTOR2I( 7, 5 ) <<
" Actual: " << ptA );
528 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 5 ),
"Expected: " <<
VECTOR2I( 5, 5 ) <<
" Actual: " << ptB );
554 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( -7, -4 ),
"Expected: " <<
VECTOR2I( -7, -4 ) <<
" Actual: " << ptA );
555 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 0, -2 ),
"Expected: " <<
VECTOR2I( 0, -2 ) <<
" Actual: " << ptB );
569 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 8, 5 ),
"Expected: " <<
VECTOR2I( 8, 5 ) <<
" Actual: " << ptA );
570 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 8, 5 ),
"Expected: " <<
VECTOR2I( 8, 5 ) <<
" Actual: " << ptB );
582 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 0, 0 ),
"Expected: " <<
VECTOR2I( 0, 0 ) <<
" Actual: " << ptA );
583 BOOST_CHECK_MESSAGE( ptB ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptB );
595 BOOST_CHECK_MESSAGE( ptA ==
VECTOR2I( 5, 0 ),
"Expected: " <<
VECTOR2I( 5, 0 ) <<
" Actual: " << ptA );
596 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