Browse Source

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).
6.0.7
Jeff Young 4 years ago
parent
commit
dede3f5709
  1. 4
      common/eda_shape.cpp
  2. 4
      common/eda_text.cpp

4
common/eda_shape.cpp

@ -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 );

4
common/eda_text.cpp

@ -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 );

Loading…
Cancel
Save