Minor cleanup.

This commit is contained in:
Jeff Young 2021-06-12 11:39:28 +01:00
parent be980df1ca
commit 5bb6b1a3cc
2 changed files with 19 additions and 18 deletions

View File

@ -439,10 +439,12 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
tanIntersect = tanStart.IntersectLines( tanEnd ).get();
auto isTrackStartClosestToArcStart =
[&]( PCB_TRACK* aPointA ) -> bool
[&]( PCB_TRACK* aTrack ) -> bool
{
return GetLineLength( aPointA->GetStart(), theArc->GetStart() )
< GetLineLength( aPointA->GetEnd(), theArc->GetStart() );
double trackStartToArcStart = GetLineLength( aTrack->GetStart(), theArc->GetStart() );
double trackEndToArcStart = GetLineLength( aTrack->GetEnd(), theArc->GetStart() );
return trackStartToArcStart < trackEndToArcStart;
};
bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
@ -476,21 +478,20 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
//
auto getFurthestPointToTanInterstect =
[&]( VECTOR2I& aPointA, VECTOR2I& aPointB ) -> VECTOR2I
{
if( ( aPointA - tanIntersect ).EuclideanNorm()
> ( aPointB - tanIntersect ).EuclideanNorm() )
[&]( VECTOR2I& aPointA, VECTOR2I& aPointB ) -> VECTOR2I
{
return aPointA;
}
else
{
return aPointB;
}
};
if( ( aPointA - tanIntersect ).EuclideanNorm()
> ( aPointB - tanIntersect ).EuclideanNorm() )
{
return aPointA;
}
else
{
return aPointB;
}
};
CIRCLE maxTanCircle;
VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.A, tanStart.B );
VECTOR2I tanEndPoint = getFurthestPointToTanInterstect( tanEnd.A, tanEnd.B );
VECTOR2I tempTangentPoint = tanEndPoint;
@ -530,8 +531,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
for( VECTOR2I candidate : possiblePoints )
{
if( ( candidate - m_cursor ).EuclideanNorm()
< ( closest - m_cursor ).EuclideanNorm() )
if( ( candidate - m_cursor ).SquaredEuclideanNorm()
< ( closest - m_cursor ).SquaredEuclideanNorm() )
{
closest = candidate;
}

View File

@ -89,7 +89,7 @@ public:
/**
* Drag-resize an arc (and change end points of connected straight segments).
*/
int DragArcTrack( const TOOL_EVENT& aEvent );
int DragArcTrack( const TOOL_EVENT& aTrack );
/**
* Display properties window for the selected object.