Add test case for SHAPE_ARC::Collide( seg ) + remove unneeded candidates
Followup to commit 01068e0d41
This commit is contained in:
parent
007b3bdbcc
commit
b4835c8208
|
@ -237,15 +237,13 @@ bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance, int* aActual, VECTOR2I
|
|||
// Possible points of the collision are:
|
||||
// 1. Intersetion of the segment with the full circle
|
||||
// 2. Closest point on the segment to the center of the circle
|
||||
// 3. End points of the segment
|
||||
// 3. Closest point on the segment to the end points of the arc
|
||||
|
||||
std::vector<VECTOR2I> candidatePts = circle.Intersect( aSeg );
|
||||
|
||||
candidatePts.push_back( aSeg.NearestPoint( center ) );
|
||||
candidatePts.push_back( aSeg.NearestPoint( m_start ) );
|
||||
candidatePts.push_back( aSeg.NearestPoint( m_end ) );
|
||||
candidatePts.push_back( aSeg.A );
|
||||
candidatePts.push_back( aSeg.B );
|
||||
|
||||
for( const VECTOR2I& candidate : candidatePts )
|
||||
{
|
||||
|
|
|
@ -648,6 +648,8 @@ static const std::vector<ARC_SEG_COLLIDE_CASE> arc_seg_collide_cases = {
|
|||
{ "270 deg ", { { 0, 0 }, { 100, 0 }, 270.0 }, 0, { { 0, -100 }, { 0, -50 } }, true, 0 },
|
||||
{ "45 deg ", { { 0, 0 }, { 100, 0 }, 270.0 }, 0, { { 71, 71 }, { 35, 35 } }, true, 0 },
|
||||
{ "-45 deg ", { { 0, 0 }, { 100, 0 }, 270.0 }, 0, { { 71, -71 }, { 35, -35 } }, false, -1 },
|
||||
{ "edge case - large diameter arc", { { 172367922, 82282076 }, { 162530000, 92120000 }, -45.0 },
|
||||
433300, { { 162096732, 92331236 }, { 162096732, 78253268 } }, true, 433268 },
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue