From e664605c90a7769aa642a19ed1f049fb279580e4 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 21 Oct 2023 12:37:17 -0400 Subject: [PATCH] Fix false positive DRC footprint parity test. This fix removed the Euclidean normalization test and replaced it with an arc center X and Y coordinate differential check. The error epsilon was increased to 200nm due to the arc center position calculation code using the near 100nm position. https://gitlab.com/kicad/code/kicad/-/issues/15917 --- pcbnew/drc/drc_test_provider_library_parity.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 636039c36e..f75b9bc0f4 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2021-2022 KiCad Developers. + * Copyright (C) 2021-2023 KiCad Developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -216,9 +216,11 @@ bool shapesNeedUpdate( const FP_SHAPE* a, const FP_SHAPE* b ) TEST( a->GetStart0(), b->GetStart0() ); TEST( a->GetEnd0(), b->GetEnd0() ); - // Arc center is calculated and so may have round-off errors when parents are - // differentially rotated. - if( ( a->GetCenter0() - b->GetCenter0() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0001 ) ) + // Arc center is calculated to the nearest 100nm increment and may have round-off errors + // when parents are differentially rotated. See CalcArcCenter() function in + // ./libs/kimath/src/trigo.cpp. + if( ( std::abs( a->GetCenter0().x - b->GetCenter0().x ) > pcbIUScale.mmToIU( 0.0002 ) ) || + ( std::abs( a->GetCenter0().y - b->GetCenter0().y ) > pcbIUScale.mmToIU( 0.0002 ) ) ) return true; break;