Use dedicated functions to convert between degrees and radians
This commit is contained in:
parent
9e5f333bcc
commit
fe064de26b
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user