From 11edaa6e4a256d69bc2f65240b9a7bc54daa481e Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 4 Apr 2025 15:30:44 -0400 Subject: [PATCH] Use arc mid point for footprint library parity DRC testing. The arc center is a pseudo coordinate which is calculated for drawing purposes. This mid point is fixed unless the arc is modified which should result in more reliable arc parity footprint library DRC testing. Also change EDA_SHAPE::Compare() to use the arc mid point. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15917 --- common/eda_shape.cpp | 2 +- pcbnew/drc/drc_test_provider_library_parity.cpp | 4 ++-- qa/data/config/9.99/kicad_common.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 7e43282e37..a7182ca809 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -2147,7 +2147,7 @@ int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const if( m_shape == SHAPE_T::ARC ) { - TEST_PT( m_arcCenter, aOther->m_arcCenter ); + TEST_PT( GetArcMid(), aOther->GetArcMid() ); } else if( m_shape == SHAPE_T::BEZIER ) { diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 339da83aba..77767b0f09 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -161,7 +161,7 @@ bool primitiveNeedsUpdate( const std::shared_ptr& a, // Arc center is calculated and so may have round-off errors when parents are // differentially rotated. - if( ( a->GetCenter() - b->GetCenter() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0005 ) ) + if( ( a->GetArcMid() - b->GetArcMid() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0005 ) ) return true; break; @@ -448,7 +448,7 @@ bool shapeNeedsUpdate( const PCB_SHAPE& curr_shape, const PCB_SHAPE& ref_shape ) // Arc center is calculated and so may have round-off errors when parents are // differentially rotated. - if( ( curr_shape.GetCenter() - ref_shape.GetCenter() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0005 ) ) + if( ( curr_shape.GetArcMid() - ref_shape.GetArcMid() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0005 ) ) return true; break; diff --git a/qa/data/config/9.99/kicad_common.json b/qa/data/config/9.99/kicad_common.json index 955153ea26..8b18ebc5ed 100644 --- a/qa/data/config/9.99/kicad_common.json +++ b/qa/data/config/9.99/kicad_common.json @@ -90,6 +90,6 @@ "pdf_viewer_name": "", "text_editor": "/usr/bin/open -e", "use_system_pdf_viewer": true, - "working_dir": "/home/mike/Projects/src/kicad/qa/tests" + "working_dir": "/home/wayne/src/kicad/qa/tests" } }