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(); tanIntersect = tanStart.IntersectLines( tanEnd ).get();
auto isTrackStartClosestToArcStart = auto isTrackStartClosestToArcStart =
[&]( PCB_TRACK* aPointA ) -> bool [&]( PCB_TRACK* aTrack ) -> bool
{ {
return GetLineLength( aPointA->GetStart(), theArc->GetStart() ) double trackStartToArcStart = GetLineLength( aTrack->GetStart(), theArc->GetStart() );
< GetLineLength( aPointA->GetEnd(), theArc->GetStart() ); double trackEndToArcStart = GetLineLength( aTrack->GetEnd(), theArc->GetStart() );
return trackStartToArcStart < trackEndToArcStart;
}; };
bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart ); bool isStartTrackOnStartPt = isTrackStartClosestToArcStart( trackOnStart );
@ -490,7 +492,6 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
}; };
CIRCLE maxTanCircle; CIRCLE maxTanCircle;
VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.A, tanStart.B ); VECTOR2I tanStartPoint = getFurthestPointToTanInterstect( tanStart.A, tanStart.B );
VECTOR2I tanEndPoint = getFurthestPointToTanInterstect( tanEnd.A, tanEnd.B ); VECTOR2I tanEndPoint = getFurthestPointToTanInterstect( tanEnd.A, tanEnd.B );
VECTOR2I tempTangentPoint = tanEndPoint; VECTOR2I tempTangentPoint = tanEndPoint;
@ -530,8 +531,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
for( VECTOR2I candidate : possiblePoints ) for( VECTOR2I candidate : possiblePoints )
{ {
if( ( candidate - m_cursor ).EuclideanNorm() if( ( candidate - m_cursor ).SquaredEuclideanNorm()
< ( closest - m_cursor ).EuclideanNorm() ) < ( closest - m_cursor ).SquaredEuclideanNorm() )
{ {
closest = candidate; closest = candidate;
} }

View File

@ -89,7 +89,7 @@ public:
/** /**
* Drag-resize an arc (and change end points of connected straight segments). * 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. * Display properties window for the selected object.