From 91674347b51f591f7b19eeaa8184d09106efb5aa Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Thu, 2 May 2013 22:53:12 +0200 Subject: [PATCH] Fixed bad computation in eeschema/transform (my fault) Note: ArcTangente gives a double but *takes* ints, so it's not good to use for nontrivial things --- eeschema/transform.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eeschema/transform.cpp b/eeschema/transform.cpp index 6c40f5906c..f14eb6abad 100644 --- a/eeschema/transform.cpp +++ b/eeschema/transform.cpp @@ -1,8 +1,8 @@ #include +#include #include #include -#include TRANSFORM& TRANSFORM::operator=( const TRANSFORM& aTransform ) @@ -79,21 +79,21 @@ bool TRANSFORM::MapAngles( int* aAngle1, int* aAngle2 ) const t = x * x1 + y * y1; y = x * x2 + y * y2; x = t; - *aAngle1 = KiROUND( ArcTangente( y, x ) ); + *aAngle1 = KiROUND( RAD2DECIDEG( atan2( y, x ) ) ); x = cos( DECIDEG2RAD( *aAngle2 ) ); y = sin( DECIDEG2RAD( *aAngle2 ) ); t = x * x1 + y * y1; y = x * x2 + y * y2; x = t; - *aAngle2 = (int) ( atan2( y, x ) * 1800.0 / M_PI + 0.5 ); + *aAngle2 = KiROUND( RAD2DECIDEG( atan2( y, x ) ) ); NORMALIZE_ANGLE_POS( *aAngle1 ); NORMALIZE_ANGLE_POS( *aAngle2 ); if( *aAngle2 < *aAngle1 ) *aAngle2 += 3600; - if( *aAngle2 - *aAngle1 > 1800 ) /* Need to swap the two angles. */ + if( *aAngle2 - *aAngle1 > 1800 ) // Need to swap the two angles { Angle = (*aAngle1); *aAngle1 = (*aAngle2);