From ba3a810e55934db0442f9d3bb9b456d94f1a83df Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 20 Jan 2022 18:22:15 +0000 Subject: [PATCH] Prefer EDA_ANGLE to naked degrees. --- common/eda_rect.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/eda_rect.cpp b/common/eda_rect.cpp index 7c10679c86..6882f40db3 100644 --- a/common/eda_rect.cpp +++ b/common/eda_rect.cpp @@ -195,22 +195,22 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, const EDA_ANGLE& aRotation ) c */ // Prevent floating point comparison errors - static const double ROT_EPS = 0.000000001; + static const EDA_ANGLE ROT_EPSILON( 0.000000001, DEGREES_T ); - static const double ROT_PARALLEL[] = { 0.0, 180.0, 360.0 }; - static const double ROT_PERPENDICULAR[] = { 0.0, 90.0, 270.0 }; + static const EDA_ANGLE ROT_PARALLEL[] = { ANGLE_0, ANGLE_180, ANGLE_360 }; + static const EDA_ANGLE ROT_PERPENDICULAR[] = { ANGLE_0, ANGLE_90, ANGLE_270 }; // Test for non-rotated rectangle - for( double ii : ROT_PARALLEL ) + for( EDA_ANGLE ii : ROT_PARALLEL ) { - if( std::fabs( rotation.AsDegrees() - ii ) < ROT_EPS ) + if( std::abs( rotation - ii ) < ROT_EPSILON ) return Intersects( aRect ); } // Test for rectangle rotated by multiple of 90 degrees - for( double jj : ROT_PERPENDICULAR ) + for( EDA_ANGLE jj : ROT_PERPENDICULAR ) { - if( std::fabs( rotation.AsDegrees() - jj ) < ROT_EPS ) + if( std::abs( rotation - jj ) < ROT_EPSILON ) { EDA_RECT rotRect;