Implement an EPSILON for library/schematic/board checking.

This is mainly to not get caught out when format changes result in
different values being stored vs. calculated (such as for arcs).
This commit is contained in:
Jeff Young 2021-11-29 15:04:36 +00:00
parent 33454ef8d2
commit dede3f5709
2 changed files with 6 additions and 2 deletions

View File

@ -1423,7 +1423,9 @@ void EDA_SHAPE::SwapShape( EDA_SHAPE* aImage )
int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const
{
#define TEST( a, b ) { if( a != b ) return a - b; }
#define EPSILON 2 // Should be enough for rounding errors on calculated items
#define TEST( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; }
#define TEST_PT( a, b ) { TEST( a.x, b.x ); TEST( a.y, b.y ); }
TEST_PT( m_start, aOther->m_start );

View File

@ -655,7 +655,9 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
{
#define TEST( a, b ) { if( a != b ) return a - b; }
#define EPSILON 2 // Should be enough for rounding errors on calculated items
#define TEST( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; }
#define TEST_PT( a, b ) { TEST( a.x, b.x ); TEST( a.y, b.y ); }
TEST_PT( m_e.pos, aOther->m_e.pos );