Fix incompatibility between basic_gal (which used angles in degrees in rotation) and other gal layers (which used radians in rotation). Rotation angles are now in radians.
Fix erroneous optimization in VECTOR2<T>::Rotate (which was made for angles in degrees): Angles are in radians, and only 0 rd rotation is skipped ( case very frequent, especially in eeschema)
This commit is contained in:
parent
b92ad6f5a8
commit
f532057d05
|
@ -180,7 +180,7 @@ wxString GetUnitsLabel( EDA_UNITS_T aUnit )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEGREES:
|
case DEGREES:
|
||||||
wxASSERT( false );
|
label = _( "degrees" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,8 @@ void DrawGraphicText( EDA_RECT* aClipBox,
|
||||||
basic_gal.m_DC = aDC;
|
basic_gal.m_DC = aDC;
|
||||||
basic_gal.m_Color = aColor;
|
basic_gal.m_Color = aColor;
|
||||||
basic_gal.SetClipBox( aClipBox );
|
basic_gal.SetClipBox( aClipBox );
|
||||||
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient );
|
|
||||||
|
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
|
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void Rotate( double aAngle )
|
virtual void Rotate( double aAngle )
|
||||||
{
|
{
|
||||||
m_transform.m_rotAngle = aAngle * M_PI/1800;
|
m_transform.m_rotAngle = aAngle;
|
||||||
m_transform.m_rotCenter = m_transform.m_moveOffset;
|
m_transform.m_rotCenter = m_transform.m_moveOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,22 +355,17 @@ VECTOR2<T>& VECTOR2<T>::operator-=( const T& aScalar )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate a VECTOR2 by aAngle.
|
||||||
|
* @param aAngle = rotation angle in radians
|
||||||
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
VECTOR2<T> VECTOR2<T>::Rotate( double aAngle ) const
|
VECTOR2<T> VECTOR2<T>::Rotate( double aAngle ) const
|
||||||
{
|
{
|
||||||
// fast calculation of some rotations, very frequently found
|
// Avoid 0 radian rotation, case very frequently found
|
||||||
if( aAngle == 0.0 )
|
if( aAngle == 0.0 )
|
||||||
return VECTOR2<T> ( T( x ), T( y ) );
|
return VECTOR2<T> ( T( x ), T( y ) );
|
||||||
|
|
||||||
if( aAngle == 90.0 )
|
|
||||||
return VECTOR2<T> ( T( -y ), T( x ) );
|
|
||||||
|
|
||||||
if( aAngle == -90.0 )
|
|
||||||
return VECTOR2<T> ( T( y ), T( -x ) );
|
|
||||||
|
|
||||||
if( aAngle == 180.0 || aAngle == -180.0 )
|
|
||||||
return VECTOR2<T> ( T( -x ), T( -y ) );
|
|
||||||
|
|
||||||
double sa = sin( aAngle );
|
double sa = sin( aAngle );
|
||||||
double ca = cos( aAngle );
|
double ca = cos( aAngle );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue