Add public wxDegToRad() and wxRadToDeg() functions.

Define these functions just once in wx/math.h instead of duplicating them in a
dozen of places.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-17 12:29:15 +00:00
parent 4d8ff19a1a
commit a380c1e46f
13 changed files with 62 additions and 67 deletions

View File

@@ -23,21 +23,13 @@
#include "wx/icon.h"
#include "wx/bitmap.h"
#include "wx/dcmemory.h"
#include "wx/math.h"
#include "wx/region.h"
#include "wx/log.h"
#endif
#include "wx/private/graphics.h"
//-----------------------------------------------------------------------------
// Local functions
//-----------------------------------------------------------------------------
static inline double DegToRad(double deg)
{
return (deg * M_PI) / 180.0;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -470,7 +462,7 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2,
alpha = 360 + alpha;
// TODO obtuse angles
alpha = DegToRad(alpha);
alpha = wxDegToRad(alpha);
wxDouble dist = r / sin(alpha/2) * cos(alpha/2);
// calculate tangential points
@@ -484,7 +476,7 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2,
wxDouble a2 = v2.GetVectorAngle()-90;
AddLineToPoint(t1.m_x,t1.m_y);
AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true);
AddArc(c.m_x,c.m_y,r,wxDegToRad(a1),wxDegToRad(a2),true);
AddLineToPoint(p2.m_x,p2.m_y);
}