diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index a278e6a204..89e785a6ba 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -1338,8 +1338,8 @@ void MyCanvas::DrawSplines(wxDC& dc) { angle += angles[ angle_pos ]; int r = R * radii[ radius_pos ] / 100; - pts[ i ].x = center.x + (wxCoord)( r * cos( M_PI * angle / 180.0) ); - pts[ i ].y = center.y + (wxCoord)( r * sin( M_PI * angle / 180.0) ); + pts[ i ].x = center.x + (wxCoord)( r * cos(wxDegToRad(angle)) ); + pts[ i ].y = center.y + (wxCoord)( r * sin(wxDegToRad(angle)) ); angle_pos++; if ( angle_pos >= WXSIZEOF(angles) ) angle_pos = 0; diff --git a/src/common/geometry.cpp b/src/common/geometry.cpp index 57bdcb40c7..cd2fc3c59f 100644 --- a/src/common/geometry.cpp +++ b/src/common/geometry.cpp @@ -176,8 +176,7 @@ wxDouble wxPoint2DInt::GetVectorAngle() const return 180; } - // casts needed for MIPSpro compiler under SGI - wxDouble deg = atan2( (double)m_y , (double)m_x ) * 180 / M_PI; + wxDouble deg = wxRadToDeg(atan2( (double)m_y , (double)m_x )); if ( deg < 0 ) { deg += 360; @@ -189,8 +188,9 @@ wxDouble wxPoint2DInt::GetVectorAngle() const void wxPoint2DInt::SetVectorAngle( wxDouble degrees ) { wxDouble length = GetVectorLength(); - m_x = (int)(length * cos( degrees / 180 * M_PI )); - m_y = (int)(length * sin( degrees / 180 * M_PI )); + double rad = wxDegToRad(degrees); + m_x = (int)(length * cos(rad)); + m_y = (int)(length * sin(rad)); } wxDouble wxPoint2DDouble::GetVectorAngle() const @@ -209,7 +209,7 @@ wxDouble wxPoint2DDouble::GetVectorAngle() const else return 180; } - wxDouble deg = atan2( m_y , m_x ) * 180 / M_PI; + wxDouble deg = wxRadToDeg(atan2( m_y , m_x )); if ( deg < 0 ) { deg += 360; @@ -220,8 +220,9 @@ wxDouble wxPoint2DDouble::GetVectorAngle() const void wxPoint2DDouble::SetVectorAngle( wxDouble degrees ) { wxDouble length = GetVectorLength(); - m_x = length * cos( degrees / 180 * M_PI ); - m_y = length * sin( degrees / 180 * M_PI ); + double rad = wxDegToRad(degrees); + m_x = length * cos(rad); + m_y = length * sin(rad); } // wxRect2D