SHAPE_ARC::Collide( aSeg ) must check segment end points as candidates
The edge case is when the segment is completely contained inside the arc
(This partially reverts b4835c8208
and
adds the missing test cases)
This commit is contained in:
parent
724182abe4
commit
4de4347baa
|
@ -238,12 +238,15 @@ bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance, int* aActual, VECTOR2I
|
|||
// 1. Intersetion of the segment with the full circle
|
||||
// 2. Closest point on the segment to the center of the circle
|
||||
// 3. Closest point on the segment to the end points of the arc
|
||||
// 4. End points of the segment
|
||||
|
||||
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,7 +648,11 @@ 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 },
|
||||
{ "seg inside arc start", { { 0, 0 }, { 71, -71 }, 90.0 },
|
||||
10, { { 90, 0 }, { -35, 0 } }, true, 10 },
|
||||
{ "seg inside arc end", { { 0, 0 }, { 71, -71 }, 90.0 },
|
||||
10, { { -35, 0 }, { 90, 0 } }, true, 10 },
|
||||
{ "large diameter arc", { { 172367922, 82282076 }, { 162530000, 92120000 }, -45.0 },
|
||||
433300, { { 162096732, 92331236 }, { 162096732, 78253268 } }, true, 433268 },
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue