From b207ec88170cd05c3c58643ede0b3ffe0fe617e3 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 8 Aug 2025 10:45:58 -0700 Subject: [PATCH] Remove negative index access from CPoint Callers should be responsible for index count and/or use iterators --- common/plotters/GERBER_plotter.cpp | 4 +- common/preview_items/polygon_geom_manager.cpp | 8 ++-- eeschema/tools/rule_area_create_helper.cpp | 2 +- .../include/geometry/shape_line_chain.h | 2 +- libs/kimath/src/geometry/shape_line_chain.cpp | 6 +-- libs/kimath/src/geometry/shape_utils.cpp | 2 +- pcbnew/convert_shape_list_to_polygon.cpp | 4 +- pcbnew/generators/pcb_tuning_pattern.cpp | 16 +++---- .../length_delay_calculation.cpp | 2 +- pcbnew/pcb_io/fabmaster/import_fabmaster.cpp | 2 +- pcbnew/router/pns_component_dragger.cpp | 2 +- pcbnew/router/pns_diff_pair_placer.cpp | 4 +- pcbnew/router/pns_dp_meander_placer.cpp | 6 +-- pcbnew/router/pns_line.cpp | 12 ++--- pcbnew/router/pns_line.h | 1 + pcbnew/router/pns_line_placer.cpp | 46 +++++++++---------- pcbnew/router/pns_meander.cpp | 6 +-- pcbnew/router/pns_mouse_trail_tracer.cpp | 4 +- pcbnew/router/pns_multi_dragger.cpp | 8 ++-- pcbnew/router/pns_node.cpp | 4 +- pcbnew/router/pns_optimizer.cpp | 6 +-- pcbnew/router/pns_shove.cpp | 20 ++++---- pcbnew/router/pns_topology.cpp | 8 ++-- pcbnew/router/pns_walkaround.cpp | 2 +- pcbnew/tools/zone_create_helper.cpp | 2 +- .../libs/kimath/geometry/geom_test_utils.h | 2 +- .../libs/kimath/geometry/test_shape_arc.cpp | 2 +- qa/tools/pns/pns_log_viewer_frame.cpp | 2 +- 28 files changed, 93 insertions(+), 92 deletions(-) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 48d6a515de..db079c0e93 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -1090,7 +1090,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int } // If the polygon is not closed, close it: - if( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) ) + if( aPoly.CPoint( 0 ) != aPoly.CLastPoint() ) FinishTo( VECTOR2I( aPoly.CPoint( 0 ) ) ); fmt::println( m_outputFile, "G37*" ); @@ -1124,7 +1124,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int // Ensure the thick outline is closed for filled polygons // (if not filled, could be only a polyline) - if( ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) ) && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) ) + if( ( aPoly.CPoint( 0 ) != aPoly.CLastPoint() ) && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) ) LineTo( VECTOR2I( aPoly.CPoint( 0 ) ) ); PenFinish(); diff --git a/common/preview_items/polygon_geom_manager.cpp b/common/preview_items/polygon_geom_manager.cpp index 9faa0094a4..ec732d6fc7 100644 --- a/common/preview_items/polygon_geom_manager.cpp +++ b/common/preview_items/polygon_geom_manager.cpp @@ -48,8 +48,8 @@ bool POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt ) // there are enough leader points - the next // locked-in point is the end of the last leader // segment - m_lockedPoints.Append( m_leaderPts.CPoint( -2 ) ); - m_lockedPoints.Append( m_leaderPts.CPoint( -1 ) ); + m_lockedPoints.Append( m_leaderPts.CPoints()[ m_leaderPts.PointCount() - 2 ] ); + m_lockedPoints.Append( m_leaderPts.CLastPoint() ); } else { @@ -165,7 +165,7 @@ static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, const SHAPE if( aLastPoints.PointCount() < 1 ) return SHAPE_LINE_CHAIN(); - const VECTOR2I lastPt = aLastPoints.CPoint( -1 ); + const VECTOR2I lastPt = aLastPoints.CLastPoint(); const VECTOR2D endpointD = aEndPoint; const VECTOR2D lineVec = endpointD - lastPt; @@ -174,7 +174,7 @@ static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, const SHAPE std::vector{ lastPt, lastPt + GetVectorSnapped45( lineVec ) } ); EDA_ANGLE lineA( lineVec ); - EDA_ANGLE prevA( GetVectorSnapped45( lastPt - aLastPoints.CPoint( -2 ) ) ); + EDA_ANGLE prevA( GetVectorSnapped45( lastPt - aLastPoints.CPoints()[ aLastPoints.PointCount() - 2 ] ) ); bool vertical = std::abs( lineVec.y ) > std::abs( lineVec.x ); bool horizontal = std::abs( lineVec.y ) < std::abs( lineVec.x ); diff --git a/eeschema/tools/rule_area_create_helper.cpp b/eeschema/tools/rule_area_create_helper.cpp index 8cc7897164..de445c0c9d 100644 --- a/eeschema/tools/rule_area_create_helper.cpp +++ b/eeschema/tools/rule_area_create_helper.cpp @@ -156,7 +156,7 @@ void RULE_AREA_CREATE_HELPER::OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) // Simplify doesn't handle that currently. if( outline.PointCount() >= 3 ) { - SEG seg( outline.CPoint( -1 ), outline.CPoint( 1 ) ); + SEG seg( outline.CLastPoint(), outline.CPoint( 1 ) ); if( seg.LineDistance( outline.CPoint( 0 ) ) <= 1 ) outline.Remove( 0 ); diff --git a/libs/kimath/include/geometry/shape_line_chain.h b/libs/kimath/include/geometry/shape_line_chain.h index 2851c83f43..5ec0331cef 100644 --- a/libs/kimath/include/geometry/shape_line_chain.h +++ b/libs/kimath/include/geometry/shape_line_chain.h @@ -540,7 +540,7 @@ public: if( m_points.size() == 0 ) m_bbox = BOX2I( aP, VECTOR2I( 0, 0 ) ); - if( m_points.size() == 0 || aAllowDuplication || CPoint( -1 ) != aP ) + if( m_points.size() == 0 || aAllowDuplication || CLastPoint() != aP ) { m_points.push_back( aP ); m_shapes.push_back( SHAPES_ARE_PT ); diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index e876b6b30c..60607d9b29 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -1562,7 +1562,7 @@ void SHAPE_LINE_CHAIN::Append( const SHAPE_LINE_CHAIN& aOtherLine ) return retval; }; - if( PointCount() == 0 || aOtherLine.CPoint( 0 ) != CPoint( -1 ) ) + if( PointCount() == 0 || aOtherLine.CPoint( 0 ) != CLastPoint() ) { const VECTOR2I p = aOtherLine.CPoint( 0 ); m_points.push_back( p ); @@ -2485,7 +2485,7 @@ const VECTOR2I SHAPE_LINE_CHAIN::PointAlong( int aPathLength ) const total += l; } - return CPoint( -1 ); + return CLastPoint(); } @@ -2824,7 +2824,7 @@ bool SHAPE_LINE_CHAIN::OffsetLine( int aAmount, CORNER_STRATEGY aCornerStrategy, wxASSERT( outline.IsClosed() ); const VECTOR2I& start = CPoint( 0 ); - const VECTOR2I& end = CPoint( -1 ); + const VECTOR2I& end = CLastPoint(); outline.Split( start, true ); outline.Split( end, true ); diff --git a/libs/kimath/src/geometry/shape_utils.cpp b/libs/kimath/src/geometry/shape_utils.cpp index 017fd06ddd..4102bb690a 100644 --- a/libs/kimath/src/geometry/shape_utils.cpp +++ b/libs/kimath/src/geometry/shape_utils.cpp @@ -369,7 +369,7 @@ SHAPE_LINE_CHAIN KIGEOM::RectifyPolygon( const SHAPE_LINE_CHAIN& aPoly ) // Manually handle the last segment if not closed if( !aPoly.IsClosed() && aPoly.PointCount() >= 2 ) { - handleSegment( SEG( aPoly.CPoint( -1 ), aPoly.CPoint( 0 ) ) ); + handleSegment( SEG( aPoly.CLastPoint(), aPoly.CPoint( 0 ) ) ); } raOutline.SetClosed( true ); diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index 66da28bb95..44c5206aa1 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -510,8 +510,8 @@ bool doConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_ // Snap the segment endpoint currContour.SetPoint( -1, startPt ); - shapeOwners[std::make_pair( currContour.CPoint( -2 ), - currContour.CPoint( -1 ) )] = owner; + shapeOwners[std::make_pair( currContour.CPoints()[currContour.PointCount() - 2 ], + currContour.CLastPoint() )] = owner; } prevPt = startPt; diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index 84d5b1e807..e058879709 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -557,7 +557,7 @@ protected: { m_baseLine->Mirror( aCentre, aFlipDirection ); m_origin = m_baseLine->CPoint( 0 ); - m_end = m_baseLine->CPoint( -1 ); + m_end = m_baseLine->CLastPoint(); } if( m_baseLineCoupled ) @@ -858,7 +858,7 @@ void PCB_TUNING_PATTERN::EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_ && m_baseLineCoupled->SegmentCount() > 0 ) { centerlineOffsetEnd = - ( m_baseLineCoupled->CPoint( -1 ) - m_baseLine->CPoint( -1 ) ) / 2; + ( m_baseLineCoupled->CLastPoint() - m_baseLine->CLastPoint() ) / 2; } SEG baseEnd = m_baseLine && m_baseLine->SegmentCount() > 0 ? m_baseLine->CSegment( -1 ) @@ -1191,7 +1191,7 @@ bool PCB_TUNING_PATTERN::removeToBaseline( PNS::ROUTER* aRouter, int aPNSLayer, { VECTOR2I startSnapPoint, endSnapPoint; - std::optional pnsLine = getPNSLine( aBaseLine.CPoint( 0 ), aBaseLine.CPoint( -1 ), + std::optional pnsLine = getPNSLine( aBaseLine.CPoint( 0 ), aBaseLine.CLastPoint(), aRouter, aPNSLayer, startSnapPoint, endSnapPoint ); wxCHECK( pnsLine, false ); @@ -1359,7 +1359,7 @@ bool PCB_TUNING_PATTERN::resetToBaseline( GENERATOR_TOOL* aTool, int aPNSLayer, PNS::NODE* world = router->GetWorld(); VECTOR2I startSnapPoint, endSnapPoint; - std::optional pnsLine = getPNSLine( aBaseLine.CPoint( 0 ), aBaseLine.CPoint( -1 ), + std::optional pnsLine = getPNSLine( aBaseLine.CPoint( 0 ), aBaseLine.CLastPoint(), router, aPNSLayer, startSnapPoint, endSnapPoint ); if( !pnsLine ) @@ -1483,7 +1483,7 @@ bool PCB_TUNING_PATTERN::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COM if( resetToBaseline( aTool, pnslayer, *m_baseLine, true ) ) { m_origin = m_baseLine->CPoint( 0 ); - m_end = m_baseLine->CPoint( -1 ); + m_end = m_baseLine->CLastPoint(); } else { @@ -1680,7 +1680,7 @@ bool PCB_TUNING_PATTERN::MakeEditPoints( EDIT_POINTS& aPoints ) const if( m_tuningMode == DIFF_PAIR && m_baseLineCoupled && m_baseLineCoupled->SegmentCount() > 0 ) { centerlineOffset = ( m_baseLineCoupled->CPoint( 0 ) - m_origin ) / 2; - centerlineOffsetEnd = ( m_baseLineCoupled->CPoint( -1 ) - m_end ) / 2; + centerlineOffsetEnd = ( m_baseLineCoupled->CLastPoint() - m_end ) / 2; } aPoints.AddPoint( m_origin + centerlineOffset ); @@ -1723,7 +1723,7 @@ bool PCB_TUNING_PATTERN::UpdateFromEditPoints( EDIT_POINTS& aEditPoints ) if( m_tuningMode == DIFF_PAIR && m_baseLineCoupled && m_baseLineCoupled->SegmentCount() > 0 ) { centerlineOffset = ( m_baseLineCoupled->CPoint( 0 ) - m_origin ) / 2; - centerlineOffsetEnd = ( m_baseLineCoupled->CPoint( -1 ) - m_end ) / 2; + centerlineOffsetEnd = ( m_baseLineCoupled->CLastPoint() - m_end ) / 2; } SEG base = m_baseLine && m_baseLine->SegmentCount() > 0 ? m_baseLine->CSegment( 0 ) @@ -1778,7 +1778,7 @@ bool PCB_TUNING_PATTERN::UpdateEditPoints( EDIT_POINTS& aEditPoints ) if( m_tuningMode == DIFF_PAIR && m_baseLineCoupled && m_baseLineCoupled->SegmentCount() > 0 ) { centerlineOffset = ( m_baseLineCoupled->CPoint( 0 ) - m_origin ) / 2; - centerlineOffsetEnd = ( m_baseLineCoupled->CPoint( -1 ) - m_end ) / 2; + centerlineOffsetEnd = ( m_baseLineCoupled->CLastPoint() - m_end ) / 2; } SEG base = m_baseLine && m_baseLine->SegmentCount() > 0 ? m_baseLine->CSegment( 0 ) diff --git a/pcbnew/length_delay_calculation/length_delay_calculation.cpp b/pcbnew/length_delay_calculation/length_delay_calculation.cpp index 2fa7d76fd9..e7910d09f1 100644 --- a/pcbnew/length_delay_calculation/length_delay_calculation.cpp +++ b/pcbnew/length_delay_calculation/length_delay_calculation.cpp @@ -508,7 +508,7 @@ void LENGTH_DELAY_CALCULATION::OptimiseTraceInPad( SHAPE_LINE_CHAIN& aLine, cons if( shape->Contains( aLine.CPoint( 0 ) ) ) clipLineToPad( aLine, aPad, aPcbLayer, true ); - else if( shape->Contains( aLine.CPoint( -1 ) ) ) + else if( shape->Contains( aLine.CLastPoint() ) ) clipLineToPad( aLine, aPad, aPcbLayer, false ); } diff --git a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp index 5f59fe1f39..f5c6388da3 100644 --- a/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp +++ b/pcbnew/pcb_io/fabmaster/import_fabmaster.cpp @@ -3465,7 +3465,7 @@ bool FABMASTER::loadZone( BOARD* aBoard, const std::unique_ptr } else { - const VECTOR2I& last = active_chain->CPoint( -1 ); + const VECTOR2I& last = active_chain->CLastPoint(); // Not if this can ever happen, or what do if it does (add both points?). if( last != start ) diff --git a/pcbnew/router/pns_component_dragger.cpp b/pcbnew/router/pns_component_dragger.cpp index 5f1842abb3..27fbca328c 100644 --- a/pcbnew/router/pns_component_dragger.cpp +++ b/pcbnew/router/pns_component_dragger.cpp @@ -90,7 +90,7 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) // Lines that go directly between two linked pads are also special-cased const SHAPE_LINE_CHAIN& line = cn.origLine.CLine(); const JOINT* jA = m_world->FindJoint( line.CPoint( 0 ), aItem->Layer(), aItem->Net() ); - const JOINT* jB = m_world->FindJoint( line.CPoint( -1 ), aItem->Layer(), aItem->Net() ); + const JOINT* jB = m_world->FindJoint( line.CLastPoint(), aItem->Layer(), aItem->Net() ); wxASSERT( jA == aJoint || jB == aJoint ); const JOINT* jSearch = ( jA == aJoint ) ? jB : jA; diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index 00c8c84711..6b15ceadf0 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -740,8 +740,8 @@ bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) if( m_placingVia ) { - m_currentTrace.AppendVias ( makeVia( m_currentTrace.CP().CPoint( -1 ), m_netP ), - makeVia( m_currentTrace.CN().CPoint( -1 ), m_netN ) ); + m_currentTrace.AppendVias ( makeVia( m_currentTrace.CP().CLastPoint(), m_netP ), + makeVia( m_currentTrace.CN().CLastPoint(), m_netN ) ); } else { diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 7a4da22bd2..9efbd6ad25 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -351,17 +351,17 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { ssize_t arcIndex = tunedN.ArcIndex( curIndexN ); - m_result.AddPtAndArc( tunedP.CPoint( -1 ), tunedN.Arc( arcIndex ) ); + m_result.AddPtAndArc( tunedP.CLastPoint(), tunedN.Arc( arcIndex ) ); } else { - m_result.AddCorner( tunedP.CPoint( -1 ), tunedN.CPoint( curIndexN ) ); + m_result.AddCorner( tunedP.CLastPoint(), tunedN.CPoint( curIndexN ) ); } curIndexN = tunedN.NextShape( curIndexN ); } - m_result.AddCorner( tunedP.CPoint( -1 ), tunedN.CPoint( -1 ) ); + m_result.AddCorner( tunedP.CLastPoint(), tunedN.CLastPoint() ); long long int dpLen = origPathLength(); int64_t dpDelay = origPathDelay(); diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 4856de2071..4d6c8c4579 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -269,7 +269,7 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat // corner case for loopy tracks: insert the end loop point back into the hull if( const std::optional isect = pnew.SelfIntersecting() ) { - if( isect->p != pnew.CPoint( -1 ) ) + if( isect->p != pnew.CLastPoint() ) pnew.Split( isect->p ); } @@ -385,7 +385,7 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat // In the case that the initial path ends *inside* the current obstacle (i.e. the mouse cursor // is somewhere inside the hull for the current obstacle) we want to end the walkaround at the // point closest to the cursor - bool inLast = aObstacle.PointInside( CPoint( -1 ) ) && !aObstacle.PointOnEdge( CPoint( -1 ) ); + bool inLast = aObstacle.PointInside( CLastPoint() ) && !aObstacle.PointOnEdge( CLastPoint() ); bool appendV = true; int lastDst = INT_MAX; @@ -536,7 +536,7 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat // just project the normal of the endpoint onto this next segment and call it quits. if( inLast && v_next ) { - int d = ( v_next->pos - CPoint( -1 ) ).SquaredEuclideanNorm(); + int d = ( v_next->pos - CLastPoint() ).SquaredEuclideanNorm(); if( d < lastDst ) { @@ -544,7 +544,7 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat } else { - VECTOR2I proj = SEG( v->pos, v_next->pos ).NearestPoint( CPoint( -1 ) ); + VECTOR2I proj = SEG( v->pos, v_next->pos ).NearestPoint( CLastPoint() ); out.Append( proj ); appendV = false; break; @@ -718,7 +718,7 @@ SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECT return path; } - DIRECTION_45 dir( aOrigin.CPoint( -1 ) - aOrigin.CPoint( -2 ) ); + DIRECTION_45 dir( aOrigin.CLastPoint() - aOrigin.CPoints()[ aOrigin.PointCount() - 2 ] ); return DIRECTION_45().BuildInitialTrace( aOrigin.CPoint( 0 ), aP, dir.IsDiagonal() ); } @@ -923,7 +923,7 @@ void LINE::dragSegment45( const VECTOR2I& aP, int aIndex ) if( index == path.SegmentCount() - 1 ) { - path.Insert( path.PointCount() - 1, path.CPoint( -1 ) ); + path.Insert( path.PointCount() - 1, path.CLastPoint() ); } else if( path.IsPtOnArc( index + 1 ) ) { diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h index 3798039601..c1d8595b4a 100644 --- a/pcbnew/router/pns_line.h +++ b/pcbnew/router/pns_line.h @@ -144,6 +144,7 @@ public: ///< Return the \a aIdx-th point of the line. const VECTOR2I& CPoint( int aIdx ) const { return m_line.CPoint( aIdx ); } + const VECTOR2I& CLastPoint() const { return m_line.CLastPoint(); } const SEG CSegment( int aIdx ) const { return m_line.CSegment( aIdx ); } ///< Set line width. diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index d36a236d7d..4dbd187fb7 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -151,7 +151,7 @@ bool LINE_PLACER::handleSelfIntersections() } // ignore the point where head and tail meet - if( ipoint == head.CPoint( 0 ) || ipoint == tail.CPoint( -1 ) ) + if( ipoint == head.CPoint( 0 ) || ipoint == tail.CLastPoint() ) return false; // Intersection point is on the first or the second segment: just start routing @@ -346,7 +346,7 @@ bool LINE_PLACER::mergeHead() return false; } - if( n_tail && head.CPoint( 0 ) != tail.CPoint( -1 ) ) + if( n_tail && head.CPoint( 0 ) != tail.CLastPoint() ) { PNS_DBG( Dbg(), Message, wxT( "Merge failed: head and tail discontinuous." ) ); return false; @@ -443,7 +443,7 @@ bool LINE_PLACER::cursorDistMinimum( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& if( aL.PointCount() == 0 ) return false; - VECTOR2I lastP = aL.CPoint(-1); + VECTOR2I lastP = aL.CLastPoint(); int accumulatedDist = 0; dists.reserve( 2 * aL.PointCount() ); @@ -664,7 +664,7 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio if( bestLength < hugThresholdLengthComplete && bestLine.has_value() ) { walkFull.SetShape( bestLine->CLine() ); - walkP = walkFull.CLine().CPoint(-1); + walkP = walkFull.CLine().CLastPoint(); PNS_DBGN( Dbg(), EndGroup ); continue; } @@ -682,7 +682,7 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio validCw = cursorDistMinimum( wr.lines[WP_CW].CLine(), aP, hugThresholdLength, l_cw ); if( validCw ) - distCw = ( aP - l_cw.CPoint( -1 ) ).EuclideanNorm(); + distCw = ( aP - l_cw.CLastPoint() ).EuclideanNorm(); PNS_DBG( Dbg(), AddShape, &l_cw, MAGENTA, 200000, wxString::Format( "wh-result-cw %s", validCw ? "non-colliding" @@ -694,7 +694,7 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio validCcw = cursorDistMinimum( wr.lines[WP_CCW].CLine(), aP, hugThresholdLength, l_ccw ); if( validCcw ) - distCcw = ( aP - l_ccw.CPoint( -1 ) ).EuclideanNorm(); + distCcw = ( aP - l_ccw.CLastPoint() ).EuclideanNorm(); PNS_DBG( Dbg(), AddShape, &l_ccw, MAGENTA, 200000, wxString::Format( "wh-result-ccw %s", validCcw ? "non-colliding" @@ -705,12 +705,12 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio if( distCw < distCcw && validCw ) { walkFull.SetShape( l_cw ); - walkP = l_cw.CPoint(-1); + walkP = l_cw.CLastPoint(); } else if( validCcw ) { walkFull.SetShape( l_ccw ); - walkP = l_ccw.CPoint(-1); + walkP = l_ccw.CLastPoint(); } else { @@ -725,7 +725,7 @@ bool LINE_PLACER::rhWalkBase( const VECTOR2I& aP, LINE& aWalkLine, int aCollisio if( l1.EndsWithVia() ) { VIA v ( l1.Via() ); - v.SetPos( walkFull.CPoint( -1 ) ); + v.SetPos( walkFull.CLastPoint() ); walkFull.AppendVia( v ); } @@ -800,9 +800,9 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTail if( m_placingVia && viaOk ) { - PNS_DBG( Dbg(), AddPoint, aNewHead.CPoint(-1), RED, 1000000, wxString::Format( "VIA" ) ); + PNS_DBG( Dbg(), AddPoint, aNewHead.CLastPoint(), RED, 1000000, wxString::Format( "VIA" ) ); - aNewHead.AppendVia( makeVia( aNewHead.CPoint( -1 ) ) ); + aNewHead.AppendVia( makeVia( aNewHead.CLastPoint() ) ); } OPTIMIZER::Optimize( &aNewHead, effort, m_currentNode ); @@ -881,9 +881,9 @@ bool LINE_PLACER::splitHeadTail( const LINE& aNewLine, const LINE& aOldTail, LIN if( n > 1 && aOldTail.PointCount() > 1 ) { - if( l2.CLine().PointOnEdge( aOldTail.CPoint( -1 ) ) ) + if( l2.CLine().PointOnEdge( aOldTail.CLastPoint() ) ) { - l2.Line().Split( aOldTail.CPoint( -1 ) ); + l2.Line().Split( aOldTail.CLastPoint() ); } for( i = 0; i < aOldTail.PointCount(); i++ ) @@ -953,7 +953,7 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai if( m_placingVia && viaOk ) { - newHead.AppendVia( makeVia( newHead.CPoint( -1 ) ) ); + newHead.AppendVia( makeVia( newHead.CLastPoint() ) ); PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-new-via" ); } @@ -1104,7 +1104,7 @@ bool LINE_PLACER::optimizeTailHeadTransition() void LINE_PLACER::updatePStart( const LINE& tail ) { if( tail.CLine().PointCount() ) - m_p_start = tail.CLine().CPoint(-1); + m_p_start = tail.CLine().CLastPoint(); else m_p_start = m_currentStart; } @@ -1228,7 +1228,7 @@ bool LINE_PLACER::route( const VECTOR2I& aP ) if( !m_head.PointCount() ) return false; - return m_head.CPoint( -1 ) == aP; + return m_head.CLastPoint() == aP; } @@ -1504,7 +1504,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) if( !current.PointCount() ) m_currentEnd = m_p_start; else - m_currentEnd = current.CLine().CPoint( -1 ); + m_currentEnd = current.CLine().CLastPoint(); NODE* latestNode = m_currentNode; m_lastNode = latestNode->Branch(); @@ -1515,7 +1515,7 @@ bool LINE_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) && current.SegmentCount() ) { if ( aEndItem->Net() == m_currentNet ) - SplitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) ); + SplitAdjacentSegments( m_lastNode, aEndItem, current.CLastPoint() ); if( Settings().RemoveLoops() ) removeLoops( m_lastNode, current ); @@ -1608,11 +1608,11 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis return true; } - VECTOR2I p_pre_last = l.CPoint( -1 ); - const VECTOR2I p_last = l.CPoint( -1 ); + VECTOR2I p_pre_last = l.CLastPoint(); + const VECTOR2I p_last = l.CLastPoint(); if( l.PointCount() > 2 ) - p_pre_last = l.CPoint( -2 ); + p_pre_last = l.CPoints()[ l.PointCount() - 2 ]; if( aEndItem && m_currentNet && m_currentNet == aEndItem->Net() ) realEnd = true; @@ -1805,7 +1805,7 @@ void LINE_PLACER::removeLoops( NODE* aNode, LINE& aLatest ) if( !aLatest.SegmentCount() ) return; - if( aLatest.CLine().CPoint( 0 ) == aLatest.CLine().CPoint( -1 ) ) + if( aLatest.CLine().CPoint( 0 ) == aLatest.CLine().CLastPoint() ) return; std::set toErase; @@ -2020,7 +2020,7 @@ bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead, PNS::PNS_MO if( l.SegmentCount() > 1 && m_orthoMode ) { - VECTOR2I newLast = l.CSegment( 0 ).LineProject( l.CPoint( -1 ) ); + VECTOR2I newLast = l.CSegment( 0 ).LineProject( l.CLastPoint() ); l.Remove( -1, -1 ); l.SetPoint( 1, newLast ); diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index 7c187cc038..79d9185738 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -504,7 +504,7 @@ void MEANDER_SHAPE::miter( int aRadius, bool aSide ) VECTOR2D dir = m_currentDir.Resize( (double) aRadius ); SHAPE_LINE_CHAIN lc = makeMiterShape( m_currentPos, dir, aSide ); - m_currentPos = lc.CPoint( -1 ); + m_currentPos = lc.CLastPoint(); turn( aSide ? ANGLE_90 : -ANGLE_90 ); m_currentTarget->Append( lc ); @@ -900,7 +900,7 @@ void MEANDER_SHAPE::updateBaseSegment( ) if( m_dual ) { VECTOR2I midpA = ( CLine( 0 ).CPoint( 0 ) + CLine( 1 ).CPoint( 0 ) ) / 2; - VECTOR2I midpB = ( CLine( 0 ).CPoint( -1 ) + CLine( 1 ).CPoint( -1 ) ) / 2; + VECTOR2I midpB = ( CLine( 0 ).CLastPoint() + CLine( 1 ).CLastPoint() ) / 2; m_clippedBaseSeg.A = m_baseSeg.LineProject( midpA ); m_clippedBaseSeg.B = m_baseSeg.LineProject( midpB ); @@ -908,7 +908,7 @@ void MEANDER_SHAPE::updateBaseSegment( ) else { m_clippedBaseSeg.A = m_baseSeg.LineProject( CLine( 0 ).CPoint( 0 ) ); - m_clippedBaseSeg.B = m_baseSeg.LineProject( CLine( 0 ).CPoint( -1 ) ); + m_clippedBaseSeg.B = m_baseSeg.LineProject( CLine( 0 ).CLastPoint() ); } } diff --git a/pcbnew/router/pns_mouse_trail_tracer.cpp b/pcbnew/router/pns_mouse_trail_tracer.cpp index 8b37dc1131..3fbcf4134f 100644 --- a/pcbnew/router/pns_mouse_trail_tracer.cpp +++ b/pcbnew/router/pns_mouse_trail_tracer.cpp @@ -52,7 +52,7 @@ void MOUSE_TRAIL_TRACER::AddTrailPoint( const VECTOR2I& aP ) } else { - SEG s_new( m_trail.CPoint( -1 ), aP ); + SEG s_new( m_trail.CLastPoint(), aP ); if( m_trail.SegmentCount() > 2 ) { @@ -284,7 +284,7 @@ VECTOR2I MOUSE_TRAIL_TRACER::GetTrailLeadVector() const } else { - return m_trail.CPoint( -1 ) - m_trail.CPoint( 0 ); + return m_trail.CLastPoint() - m_trail.CPoint( 0 ); } } diff --git a/pcbnew/router/pns_multi_dragger.cpp b/pcbnew/router/pns_multi_dragger.cpp index aa2902c643..9b45d6d5be 100644 --- a/pcbnew/router/pns_multi_dragger.cpp +++ b/pcbnew/router/pns_multi_dragger.cpp @@ -92,7 +92,7 @@ bool MULTI_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) const VECTOR2I& origFirst = l.originalLine.CLine().CPoint( 0 ); const int distFirst = ( origFirst - aP ).EuclideanNorm(); - const VECTOR2I& origLast = l.originalLine.CLine().CPoint( -1 ); + const VECTOR2I& origLast = l.originalLine.CLine().CLastPoint(); const int distLast = ( origLast - aP ).EuclideanNorm(); l.cornerDistance = std::min( distFirst, distLast ); @@ -223,7 +223,7 @@ bool MULTI_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) } // and if it's connected (non-trivial fanout), disregard it - const JOINT* jt = m_world->FindJoint( l.originalLine.CPoint( -1 ), &l.originalLine ); + const JOINT* jt = m_world->FindJoint( l.originalLine.CLastPoint(), &l.originalLine ); assert (jt != nullptr); @@ -707,7 +707,7 @@ bool MULTI_DRAGGER::Drag( const VECTOR2I& aP ) if( m_dragMode == DM_CORNER ) { // first, drag only the primary line - // PNS_DBG( Dbg(), AddPoint, primaryDragged->CPoint( -1 ), YELLOW, 600000, wxT("mdrag-sec")); + // PNS_DBG( Dbg(), AddPoint, primaryDragged->CLastPoint(), YELLOW, 600000, wxT("mdrag-sec")); lastPreDrag = primaryPreDrag->CSegment( -1 ); primaryDir = DIRECTION_45( lastPreDrag ); @@ -787,7 +787,7 @@ bool MULTI_DRAGGER::Drag( const VECTOR2I& aP ) { // compute the distance between the primary line and the last point of // the currently processed line - int dist = lastPreDrag.LineDistance( l.preDragLine.CPoint( -1 ), true ); + int dist = lastPreDrag.LineDistance( l.preDragLine.CLastPoint(), true ); // now project it on the perpendicular line we computed before auto projected = aP + perp.Resize( dist ); diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index dd0625b426..a0fc7610f1 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -1101,7 +1101,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex, bool const SHAPE_ARC* sa = static_cast( arc->Shape( -1 ) ); int nSegs = line.PointCount(); - VECTOR2I last = nSegs ? line.CPoint( -1 ) : VECTOR2I(); + VECTOR2I last = nSegs ? line.CLastPoint() : VECTOR2I(); ssize_t lastShape = nSegs ? line.ArcIndex( static_cast( nSegs ) - 1 ) : -1; line.Append( arcReversed[i] ? sa->Reversed() : *sa ); @@ -1138,7 +1138,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex, bool void NODE::FindLineEnds( const LINE& aLine, JOINT& aA, JOINT& aB ) { aA = *FindJoint( aLine.CPoint( 0 ), &aLine ); - aB = *FindJoint( aLine.CPoint( -1 ), &aLine ); + aB = *FindJoint( aLine.CLastPoint(), &aLine ); } diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index 8225200e70..6af6664e92 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -996,7 +996,7 @@ int OPTIMIZER::smartPadsSingle( LINE* aLine, ITEM* aPad, bool aEnd, int aEndVert { SHAPE_LINE_CHAIN v; SHAPE_LINE_CHAIN connect = dir.BuildInitialTrace( - breakout.CPoint( -1 ), line.CPoint( p ), diag == 0 ); + breakout.CLastPoint(), line.CPoint( p ), diag == 0 ); DIRECTION_45 dir_bkout( breakout.CSegment( -1 ) ); @@ -1083,7 +1083,7 @@ bool OPTIMIZER::runSmartPads( LINE* aLine ) if( line.PointCount() < 3 ) return false; - VECTOR2I p_start = line.CPoint( 0 ), p_end = line.CPoint( -1 ); + VECTOR2I p_start = line.CPoint( 0 ), p_end = line.CLastPoint(); ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); @@ -1125,7 +1125,7 @@ bool OPTIMIZER::fanoutCleanup( LINE* aLine ) DIRECTION_45::CORNER_MODE cornerMode = ROUTER::GetInstance()->Settings().GetCornerMode(); - VECTOR2I p_start = aLine->CPoint( 0 ), p_end = aLine->CPoint( -1 ); + VECTOR2I p_start = aLine->CPoint( 0 ), p_end = aLine->CLastPoint(); ITEM* startPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_start ); ITEM* endPad = findPadOrVia( aLine->Layer(), aLine->Net(), p_end ); diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 62979559ea..5910cc5729 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -186,7 +186,7 @@ int SHOVE::getClearance( const ITEM* aA, const ITEM* aB ) const void SHOVE::sanityCheck( LINE* aOld, LINE* aNew ) { assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) ); - assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) ); + assert( aOld->CLastPoint() == aNew->CLastPoint() ); } @@ -288,7 +288,7 @@ bool SHOVE::shoveLineFromLoneVia( const LINE& aCurLine, const LINE& aObstacleLin if( shortest.PointCount() < 2 ) return false; - if( aObstacleLine.CPoint( -1 ) != shortest.CPoint( -1 ) ) + if( aObstacleLine.CLastPoint() != shortest.CLastPoint() ) return false; if( aObstacleLine.CPoint( 0 ) != shortest.CPoint( 0 ) ) @@ -362,7 +362,7 @@ bool SHOVE::shoveLineToHullSet( const LINE& aCurLine, const LINE& aObstacleLine, int minDist0, minDist1, minhull0, minhull1 ; VECTOR2I p0 = minDistP( l.CPoint( 0 ), minDist0, minhull0 ); - VECTOR2I p1 = minDistP( l.CPoint( -1 ), minDist1, minhull1 ); + VECTOR2I p1 = minDistP( l.CLastPoint(), minDist1, minhull1 ); PNS_DBG( Dbg(), Message, wxString::Format( "mindists : %d %d hulls %d %d\n", minDist0, minDist1, minhull0, minhull1 ) ); @@ -437,7 +437,7 @@ bool SHOVE::shoveLineToHullSet( const LINE& aCurLine, const LINE& aObstacleLine, continue; } - if( path.CPoint( -1 ) != obs.CPoint( -1 ) || path.CPoint( 0 ) != obs.CPoint( 0 ) ) + if( path.CLastPoint() != obs.CLastPoint() || path.CPoint( 0 ) != obs.CPoint( 0 ) ) { PNS_DBG( Dbg(), Message, wxString::Format( wxT( "attempt %d fail vend-start\n" ), attempt ) ); @@ -511,7 +511,7 @@ bool SHOVE::ShoveObstacleLine( const LINE& aCurLine, const LINE& aObstacleLine, if( aObstacleLine.PointCount() >= 2 ) { jtStart = m_currentNode->FindJoint( aObstacleLine.CPoint( 0 ), &aObstacleLine ); - jtEnd = m_currentNode->FindJoint( aObstacleLine.CPoint( -1 ), &aObstacleLine ); + jtEnd = m_currentNode->FindJoint( aObstacleLine.CLastPoint(), &aObstacleLine ); } if( jtStart ) @@ -667,7 +667,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacl if( !pushLineStack( shovedLine ) ) return SH_INCOMPLETE; - + return SH_OK; } @@ -1469,7 +1469,7 @@ bool SHOVE::pushLineStack( const LINE& aL, bool aKeepCurrentOnTop ) m_lineStack.push_back( aL ); } - + pruneLineFromOptimizerQueue( aL ); m_optimizerQueue.push_back( aL ); @@ -1600,9 +1600,9 @@ bool SHOVE::patchTadpoleVia( ITEM* nearest, LINE& current ) if (current.CLine().PointCount() < 1 ) return false; -// PNS_DBG(Dbg(), Message, wxString::Format( "cp %d %d", current.CLine().CPoint(-1).x, current.CLine().CPoint(-1).y ) ); +// PNS_DBG(Dbg(), Message, wxString::Format( "cp %d %d", current.CLine().CLastPoint().x, current.CLine().CLastPoint().y ) ); - auto jtViaEnd = m_currentNode->FindJoint( current.CLine().CPoint(-1), ¤t ); + auto jtViaEnd = m_currentNode->FindJoint( current.CLine().CLastPoint(), ¤t ); // PNS_DBG(Dbg(), Message, wxString::Format( "jt %p", jtViaEnd ) ); @@ -2501,7 +2501,7 @@ SHOVE::SHOVE_STATUS SHOVE::Run() m_currentNode->LockJoint( head.CPoint( 0 ), &head, true ); if( !head.EndsWithVia() ) - m_currentNode->LockJoint( head.CPoint( -1 ), &head, true ); + m_currentNode->LockJoint( head.CLastPoint(), &head, true ); } SetShovePolicy( head, headLineEntry.policy ); diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp index ba041207fb..0039661ace 100644 --- a/pcbnew/router/pns_topology.cpp +++ b/pcbnew/router/pns_topology.cpp @@ -109,7 +109,7 @@ bool TOPOLOGY::NearestUnconnectedAnchorPoint( const LINE* aTrack, VECTOR2I& aPoi track.ClearLinks(); tmpNode->Add( track ); - const JOINT* jt = tmpNode->FindJoint( track.CPoint( -1 ), &track ); + const JOINT* jt = tmpNode->FindJoint( track.CLastPoint(), &track ); if( !jt || m_world->GetRuleResolver()->NetCode( jt->Net() ) <= 0 ) return false; @@ -152,7 +152,7 @@ bool TOPOLOGY::LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine ) return false; aRatLine.Clear(); - aRatLine.Append( aTrack->CPoint( -1 ) ); + aRatLine.Append( aTrack->CLastPoint() ); aRatLine.Append( end ); return true; } @@ -210,7 +210,7 @@ bool TOPOLOGY::followTrivialPath( LINE* aLine2, bool aLeft, ITEM_SET& aSet, while( true ) { - VECTOR2I anchor = aLeft ? curr_line->CPoint( 0 ) : curr_line->CPoint( -1 ); + VECTOR2I anchor = aLeft ? curr_line->CPoint( 0 ) : curr_line->CLastPoint(); LINKED_ITEM* last = aLeft ? curr_line->Links().front() : curr_line->Links().back(); const JOINT* jt = m_world->FindJoint( anchor, curr_line ); @@ -247,7 +247,7 @@ bool TOPOLOGY::followTrivialPath( LINE* aLine2, bool aLeft, ITEM_SET& aSet, } LINE l = m_world->AssembleLine( next_seg, nullptr, false, aFollowLockedSegments ); - VECTOR2I nextAnchor = ( aLeft ? l.CLine().CPoint( -1 ) : l.CLine().CPoint( 0 ) ); + VECTOR2I nextAnchor = ( aLeft ? l.CLine().CLastPoint() : l.CLine().CPoint( 0 ) ); if( nextAnchor != anchor ) { diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index 3ed4ae9038..494a1435d1 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -375,7 +375,7 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath ) st = ST_STUCK; } - if( ln.PointCount() > 0 && ln.CPoint( -1 ) != aInitialPath.CPoint( -1 ) ) + if( ln.PointCount() > 0 && ln.CLastPoint() != aInitialPath.CLastPoint() ) { st = ST_ALMOST_DONE; diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index e6c5329018..3c1f9c2b6f 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -350,7 +350,7 @@ void ZONE_CREATE_HELPER::OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) // Simplify doesn't handle that currently. if( chain.PointCount() >= 3 ) { - SEG seg( chain.CPoint( -1 ), chain.CPoint( 1 ) ); + SEG seg( chain.CLastPoint(), chain.CPoint( 1 ) ); if( seg.LineDistance( chain.CPoint( 0 ) ) <= 1 ) chain.Remove( 0 ); diff --git a/qa/tests/libs/kimath/geometry/geom_test_utils.h b/qa/tests/libs/kimath/geometry/geom_test_utils.h index 44549a513f..c8795361e9 100644 --- a/qa/tests/libs/kimath/geometry/geom_test_utils.h +++ b/qa/tests/libs/kimath/geometry/geom_test_utils.h @@ -281,7 +281,7 @@ inline bool IsOutlineValid( const SHAPE_LINE_CHAIN& aChain ) } else { - if( aChain.Arc( prevArcIdx ).GetP1() != aChain.CPoint( -1 ) ) + if( aChain.Arc( prevArcIdx ).GetP1() != aChain.CLastPoint() ) return false; } } diff --git a/qa/tests/libs/kimath/geometry/test_shape_arc.cpp b/qa/tests/libs/kimath/geometry/test_shape_arc.cpp index 38fa4ff7e1..37078f983e 100644 --- a/qa/tests/libs/kimath/geometry/test_shape_arc.cpp +++ b/qa/tests/libs/kimath/geometry/test_shape_arc.cpp @@ -1172,7 +1172,7 @@ BOOST_DATA_TEST_CASE( ArcToPolyline, boost::unit_test::data::make( ArcToPolyline BOOST_CHECK_EQUAL( chain.CPoint( 0 ), c.m_geom.m_start_point ); // End point (exactly) where expected - BOOST_CHECK_EQUAL( chain.CPoint( -1 ), this_arc.GetP1() ); + BOOST_CHECK_EQUAL( chain.CLastPoint(), this_arc.GetP1() ); int radius = ( c.m_geom.m_center_point - c.m_geom.m_start_point ).EuclideanNorm(); diff --git a/qa/tools/pns/pns_log_viewer_frame.cpp b/qa/tools/pns/pns_log_viewer_frame.cpp index 28400d771e..c2a8891f4e 100644 --- a/qa/tools/pns/pns_log_viewer_frame.cpp +++ b/qa/tools/pns/pns_log_viewer_frame.cpp @@ -87,7 +87,7 @@ void PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyline( const SHAPE_LINE_CHAIN& aL, std: Polyline( aL ); if( name.length() > 0 && aL.PointCount() > 0 ) - m_labelMgr->Add( aL.CPoint( -1 ), name, GetStrokeColor() ); + m_labelMgr->Add( aL.CLastPoint(), name, GetStrokeColor() ); if( aShowVertexNumbers ) {