Commit 91674347 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

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
parent 19845828
#include <macros.h>
#include <trigo.h>
#include <transform.h>
#include <common.h>
#include <trigo.h>
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment