Fix geometry error in connectivity algorithm.

For custom pad shapes were were calculating cardinal points off
of the bounding box.  However, the bounding box must be rotated
around the pad's position, rather than its shapePos -- which is
an issue since any thermal spokes will be rotated around the
shapePos.

Of course we don't really need to sort that out because we're
doing an intersection of the pad's boundary polygon with a vector
from the shapePos out to the cardianl point -- so we really just
need the cardinal point to be "out there".  So I've changed it
to use use INT_MAX / 2.

Fixes: lp:1851703
* https://bugs.launchpad.net/kicad/+bug/1851703
This commit is contained in:
Jeff Young 2019-11-10 14:46:32 +00:00
parent fd8154d085
commit c29a0b1966
1 changed files with 7 additions and 6 deletions

View File

@ -93,11 +93,11 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
{
switch( n )
{
case 1: pt1.y = m_bbox.GetTop(); break; // North
case 2: pt1.y = m_bbox.GetBottom(); break; // South
case 3: pt1.x = m_bbox.GetLeft(); break; // East
case 4: pt1.x = m_bbox.GetRight(); break; // West
default: break; // Wicked witch
case 1: pt1.y = INT_MIN / 2; break; // North
case 2: pt1.y = INT_MAX / 2; break; // South
case 3: pt1.x = INT_MIN / 2; break; // East
case 4: pt1.x = INT_MAX / 2; break; // West
default: break; // Wicked witch
}
if( pad->GetOrientation() )
@ -112,7 +112,8 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
if( intersections.empty() )
{
// There should always be at least some copper outside the hole
// There should always be at least some copper outside the hole and/or
// shapePos center
assert( false );
return pt0;
}