Improve handling of long distances

This commit is contained in:
Alex 2021-12-12 01:05:55 +03:00 committed by Seth Hillbrand
parent b81a3f0533
commit 6d739ca9da
2 changed files with 5 additions and 5 deletions

View File

@ -705,7 +705,7 @@ bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const
case SHAPE_T::CIRCLE:
{
int radius = GetRadius();
int dist = KiROUND( EuclideanNorm( aPosition - getCenter() ) );
long dist = KiROUND<double, long>( EuclideanNorm( aPosition - getCenter() ) );
if( IsFilled() )
return dist <= radius + maxdist; // Filled circle hit-test
@ -723,7 +723,7 @@ bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const
VECTOR2I relPos = aPosition - getCenter();
int radius = GetRadius();
int dist = KiROUND( EuclideanNorm( relPos ) );
long dist = KiROUND<double, long>( EuclideanNorm( relPos ) );
if( IsFilled() )
{

View File

@ -62,9 +62,9 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
if( m_constructMan.IsReset() )
return;
const VECTOR2I origin = m_constructMan.GetOrigin();
const VECTOR2I end = m_constructMan.GetEnd();
const VECTOR2I radVec = end - origin;
const VECTOR2I origin = m_constructMan.GetOrigin();
const VECTOR2I end = m_constructMan.GetEnd();
const VECTOR2D radVec = end - origin;
// Ensures that +90° is up and -90° is down in pcbnew
const EDA_ANGLE deltaAngle( VECTOR2I( radVec.x, -radVec.y ) );