7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Fix DRC error with arcs

When two arcs only barely overlapped, we cannot predict the actual point
ends as they exist in the error margins.  Since arc tracks have
different radii by definition, rounding errors in calculating the
overlap angle led to some mistaken identification of parallel segments.

This adds an advanced config flag to set the preferred cutoff point
(currently 0.001°) for whether two arcs actually overlap in shared angle
space
This commit is contained in:
Seth Hillbrand 2024-10-21 13:29:12 -07:00
parent 2bee6f2549
commit 6be6680d8c
3 changed files with 16 additions and 2 deletions

View File

@ -124,6 +124,7 @@ static const wxChar ExtensionSnapActivateOnHover[] = wxT( "ExtensionSnapActivate
static const wxChar EnableSnapAnchorsDebug[] = wxT( "EnableSnapAnchorsDebug" );
static const wxChar EnableODB[] = wxT( "EnableODB" );
static const wxChar EnableJobset[] = wxT( "EnableJobset" );
static const wxChar MinParallelAngle[] = wxT( "MinParallelAngle" );
} // namespace KEYS
@ -294,6 +295,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_ExtensionSnapActivateOnHover = true;
m_EnableSnapAnchorsDebug = false;
m_MinParallelAngle = 0.001;
loadFromConfigFile();
}
@ -563,6 +566,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_EnableSnapAnchorsDebug,
m_EnableSnapAnchorsDebug ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinParallelAngle,
&m_MinParallelAngle, m_MinParallelAngle,
0.0, 45.0 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;

View File

@ -708,6 +708,12 @@ public:
*/
bool m_EnableODB;
/**
* Minimum overlapping angle for which an arc is considered to be parallel
* to its paired arc.
*/
double m_MinParallelAngle;
///@}
private:

View File

@ -18,6 +18,7 @@
*/
#include <advanced_config.h>
#include <board.h>
#include <board_design_settings.h>
#include <pcb_track.h>
@ -179,8 +180,8 @@ static bool commonParallelProjection( const PCB_ARC& p, const PCB_ARC& n, SHAPE_
clip_total_angle = p_end_angle - n_start_angle;
}
// One arc starts exactly where the other ends
if( clip_total_angle == ANGLE_0 )
// One arc starts approximately where the other ends
if( clip_total_angle <= EDA_ANGLE( ADVANCED_CFG::GetCfg().m_MinParallelAngle ) )
return false;
VECTOR2I n_start_pt = n_center + VECTOR2I( KiROUND( n_radius ), 0 );