118 bool result =
circle.NearestPoints( &segment, ptA, ptB );
131 bool result =
circle.NearestPoints( &segment, ptA, 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 );
392 BOOST_CHECK( ptA.
x >= 0 );
407 bool result =
chain.NearestPoints( &arc, ptB, ptA );
427 int expectedDistance = 20 - 5 - 3;
428 int actualDistance = (ptB - ptA).EuclideanNorm();
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();
482 "Found shorter distance at x=" << x <<
": " << testDist <<
" vs " << minDist );
524 bool result =
circle.NearestPoints( &zeroSeg, ptA, 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()
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
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