From c622d173ddbff1d5e1b8c48b39c8f683f27c9852 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 17:48:28 +0300 Subject: [PATCH] Several useful constans. --HG-- branch : develop --- src/libs/vdxf/dxflib/dl_codes.h | 19 ------------------- src/libs/vgeometry/vabstractcurve.h | 5 +---- src/libs/vmisc/vmath.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_codes.h b/src/libs/vdxf/dxflib/dl_codes.h index 131efc5b3..0bbcabcaf 100644 --- a/src/libs/vdxf/dxflib/dl_codes.h +++ b/src/libs/vdxf/dxflib/dl_codes.h @@ -39,25 +39,6 @@ #endif // _MSC_VER > 1000 #endif // Q_CC_MSVC -#ifdef _WIN32 -#undef M_PI -#define M_PI 3.14159265358979323846 -QT_WARNING_DISABLE_MSVC(4800) -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#ifndef M_2PI -#define M_2PI 6.28318530717958647692 /* 2*pi */ -#endif - -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 /* pi/2 */ - -#endif - #define DL_DXF_MAXLINE 1024 #define DL_DXF_MAXGROUPCODE 1100 diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index f8546885b..13d16969c 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -38,15 +38,12 @@ #include #include "../ifc/ifcdef.h" +#include "../vmisc/vmath.h" #include "vgeometrydef.h" #include "vgobject.h" class QPointF; -#ifndef M_2PI -#define M_2PI 6.28318530717958647692528676655900576 -#endif - enum class PathDirection : char { Hide, Show }; class QLineF; diff --git a/src/libs/vmisc/vmath.h b/src/libs/vmisc/vmath.h index a24c656b7..cf43762c3 100644 --- a/src/libs/vmisc/vmath.h +++ b/src/libs/vmisc/vmath.h @@ -48,5 +48,33 @@ Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians) #endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0) +#ifndef M_2PI +#define M_2PI (6.28318530717958647692) /* 2*pi */ +#endif + +#ifndef M_3PI_4 +#define M_3PI_4 (2.35619449019234492884) /* 3*pi/4 */ +#endif + +#ifndef M_3PI_8 +#define M_3PI_8 (1.17809724509617246442) /* 3*pi/8 */ +#endif + +#ifndef M_PI_8 +#define M_PI_8 (0.39269908169872415480) /* pi/8 */ +#endif + +#ifndef M_4_PI +#define M_4_PI (1.27323954473516268615) /* 4/pi */ +#endif + +#ifndef M_1_SQRT2 +#define M_1_SQRT2 (0.70710678118654752440) /* 1/sqrt(2) */ +#endif + +#ifndef M_EULER +#define M_EULER (0.57721566490153286060) +#endif + #endif // VMATH_H