GRID_HELPER: fixed arithmetic issue in segment snap distance check disguised as 'excessive optimization' by the dragger in the router
This commit is contained in:
parent
325300bd76
commit
e221b11e3b
|
@ -257,5 +257,18 @@ void MOUSE_TRAIL_TRACER::FlipPosture()
|
|||
m_manuallyForced = true;
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I MOUSE_TRAIL_TRACER::GetTrailLeadVector() const
|
||||
{
|
||||
if( m_trail.PointCount() < 2 )
|
||||
{
|
||||
return VECTOR2I(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_trail.CPoint( -1 ) - m_trail.CPoint( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
bool IsManuallyForced() const { return m_manuallyForced; }
|
||||
|
||||
VECTOR2I GetTrailLeadVector() const;
|
||||
private:
|
||||
SHAPE_LINE_CHAIN m_trail;
|
||||
int m_tolerance;
|
||||
|
|
|
@ -79,6 +79,8 @@ VECTOR2I PCB_GRID_HELPER::AlignToSegment( const VECTOR2I& aPoint, const SEG& aSe
|
|||
{
|
||||
OPT_VECTOR2I pts[6];
|
||||
|
||||
const int c_gridSnapEpsilon = 2;
|
||||
|
||||
if( !m_enableSnap )
|
||||
return aPoint;
|
||||
|
||||
|
@ -97,7 +99,7 @@ VECTOR2I PCB_GRID_HELPER::AlignToSegment( const VECTOR2I& aPoint, const SEG& aSe
|
|||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if( pts[i] && aSeg.Contains( *pts[i] ) )
|
||||
if( pts[i] && aSeg.Distance( *pts[i] ) <= c_gridSnapEpsilon )
|
||||
{
|
||||
int d = (*pts[i] - aPoint).EuclideanNorm();
|
||||
|
||||
|
|
Loading…
Reference in New Issue