From e0d314713977c17937a63a2de34f835ce239aa51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 13 Dec 2004 20:04:51 +0000 Subject: [PATCH] math.h/PI integration git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/rotate/rotate.cpp | 9 --------- src/common/dcbase.cpp | 8 +++----- src/common/geometry.cpp | 5 ----- src/common/matrix.cpp | 4 ++-- src/mac/carbon/dc.cpp | 7 +------ src/mac/classic/dc.cpp | 8 ++------ src/mgl/dc.cpp | 5 ----- src/msw/dc.cpp | 6 ------ src/os2/dc.cpp | 6 ------ src/palmos/dc.cpp | 8 +------- 10 files changed, 9 insertions(+), 57 deletions(-) diff --git a/samples/rotate/rotate.cpp b/samples/rotate/rotate.cpp index c540983239..f2baa3715c 100644 --- a/samples/rotate/rotate.cpp +++ b/samples/rotate/rotate.cpp @@ -23,15 +23,6 @@ #include "wx/image.h" #include "wx/numdlg.h" -/* GRG: This is not ANSI standard, define M_PI explicitly -#include // M_PI -*/ - -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 -#endif - - class MyApp: public wxApp { public: diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index fadb078d01..4b596ac2f9 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -30,8 +30,6 @@ #include "wx/dc.h" -#include - // bool wxDCBase::sm_cacheing = false; // ============================================================================ @@ -319,7 +317,7 @@ void wxDCBase::DoDrawSpline( wxList *points ) if (node == NULL) // empty list return; - + p = (wxPoint *)node->GetData(); x1 = p->x; @@ -766,7 +764,7 @@ void wxDCBase::Rotate( wxList* points, double angle, wxPoint center ) { if( angle != 0.0 ) { - double pi(3.1415926536); + double pi(M_PI); double dSinA = -sin(angle*2.0*pi/360.0); double dCosA = cos(angle*2.0*pi/360.0); for ( wxNode* node = points->First(); node; node = node->Next() ) @@ -794,7 +792,7 @@ void wxDCBase::CalculateEllipticPoints( wxList* points, wxCoord w, wxCoord h, double sa, double ea ) { - double pi = 3.1415926535; + double pi = M_PI; double sar = 0; double ear = 0; int xsa = 0; diff --git a/src/common/geometry.cpp b/src/common/geometry.cpp index b78f2e79ee..d74af422a9 100644 --- a/src/common/geometry.cpp +++ b/src/common/geometry.cpp @@ -29,11 +29,6 @@ #include "wx/geometry.h" #include "wx/datstrm.h" -// normally this is defined in -#ifndef M_PI - #define M_PI 3.14159265358979323846 -#endif - // // wxPoint2D // diff --git a/src/common/matrix.cpp b/src/common/matrix.cpp index 78a4251891..d324a852dd 100644 --- a/src/common/matrix.cpp +++ b/src/common/matrix.cpp @@ -25,12 +25,12 @@ #ifndef WX_PRECOMP #include "wx/defs.h" +#include "wx/math.h" #endif #include "wx/matrix.h" -#include -static const double pi = 3.1415926535; +static const double pi = M_PI; wxTransformMatrix::wxTransformMatrix(void) { diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index 93b10723b9..028c3cd0fc 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -23,7 +23,6 @@ #include "wx/log.h" #if __MSL__ >= 0x6000 -#include "math.h" namespace std {} using namespace std ; #endif @@ -47,11 +46,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) #define twips2mm 0.0176388888889 #define mm2pt 2.83464566929 #define pt2mm 0.352777777778 -#if !defined( __DARWIN__ ) || defined(__MWERKS__) -#ifndef M_PI -const double M_PI = 3.14159265358979 ; -#endif -#endif + const double RAD2DEG = 180.0 / M_PI; const short kEmulatedMode = -1 ; const short kUnsupportedMode = -2 ; diff --git a/src/mac/classic/dc.cpp b/src/mac/classic/dc.cpp index 9fa0993003..5be3660fc2 100644 --- a/src/mac/classic/dc.cpp +++ b/src/mac/classic/dc.cpp @@ -23,7 +23,7 @@ #include "wx/log.h" #if __MSL__ >= 0x6000 -#include "math.h" +namespace std {} using namespace std ; #endif @@ -46,11 +46,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) #define twips2mm 0.0176388888889 #define mm2pt 2.83464566929 #define pt2mm 0.352777777778 -#if !defined( __DARWIN__ ) || defined(__MWERKS__) -#ifndef M_PI -const double M_PI = 3.14159265358979 ; -#endif -#endif + const double RAD2DEG = 180.0 / M_PI; const short kEmulatedMode = -1 ; const short kUnsupportedMode = -2 ; diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp index 5b4101fd20..3fb64cab40 100644 --- a/src/mgl/dc.cpp +++ b/src/mgl/dc.cpp @@ -39,7 +39,6 @@ #include "wx/log.h" #include -#include #include @@ -48,10 +47,6 @@ // constants //----------------------------------------------------------------------------- -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - const double mm2inches = 0.0393700787402; const double inches2mm = 25.4; const double mm2twips = 56.6929133859; diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index c6f000a796..0ec26a8b0e 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -54,7 +54,6 @@ #endif #include -#include #if wxUSE_COMMON_DIALOGS && !defined(__WXMICROWIN__) #include @@ -94,11 +93,6 @@ static const int VIEWPORT_EXTENT = 1000; static const int MM_POINTS = 9; static const int MM_METRIC = 10; -// usually this is defined in math.h -#ifndef M_PI - static const double M_PI = 3.14159265358979323846; -#endif // M_PI - // ROPs which don't have standard names (see "Ternary Raster Operations" in the // MSDN docs for how this and other numbers in wxDC::Blit() are obtained) #define DSTCOPY 0x00AA0029 // a.k.a. NOP operation diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 696c32f4a1..56f4dacc08 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -32,7 +32,6 @@ #include "wx/dcprint.h" #include -#include #include "wx/os2/private.h" @@ -68,11 +67,6 @@ static const int VIEWPORT_EXTENT = 1000; static const int MM_POINTS = 9; static const int MM_METRIC = 10; -// usually this is defined in math.h -#ifndef M_PI - static const double M_PI = 3.14159265358979323846; -#endif // M_PI - // --------------------------------------------------------------------------- // private functions // --------------------------------------------------------------------------- diff --git a/src/palmos/dc.cpp b/src/palmos/dc.cpp index 46471e3ee6..6ac50f1822 100644 --- a/src/palmos/dc.cpp +++ b/src/palmos/dc.cpp @@ -4,7 +4,7 @@ // Author: William Osborne // Modified by: // Created: 10/13/04 -// RCS-ID: $Id: +// RCS-ID: $Id: // Copyright: (c) William Osborne // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,6 @@ #endif #include -#include #ifndef AC_SRC_ALPHA #define AC_SRC_ALPHA 1 @@ -72,11 +71,6 @@ static const int VIEWPORT_EXTENT = 1000; static const int MM_POINTS = 9; static const int MM_METRIC = 10; -// usually this is defined in math.h -#ifndef M_PI - static const double M_PI = 3.14159265358979323846; -#endif // M_PI - #define DSTCOPY 0x00AA0029 // --------------------------------------------------------------------------- -- 2.47.2