File libetonyek-0.1.1-constants.patch of Package libetonyek
--- libetonyek-0.1.1/src/lib/KEY2ParserUtils.cpp
+++ libetonyek-0.1.1/src/lib/KEY2ParserUtils.cpp
@@ -8,7 +8,6 @@
*/
#include <boost/lexical_cast.hpp>
-#include <boost/math/constants/constants.hpp>
#include "libetonyek_xml.h"
#include "KEY2ParserUtils.h"
@@ -161,7 +160,7 @@ double KEY2ParserUtils::deg2rad(double value)
value += 360;
// convert
- return boost::math::constants::pi<double>() / 180 * value;
+ return etonyek_pi / 180 * value;
}
KEY2ParserUtils::KEY2ParserUtils()
--- libetonyek-0.1.1/src/lib/KEYShape.cpp
+++ libetonyek-0.1.1/src/lib/KEYShape.cpp
@@ -11,8 +11,6 @@
#include <cmath>
#include <deque>
-#include <boost/math/constants/constants.hpp>
-
#include "KEYOutput.h"
#include "KEYPath.h"
#include "KEYShape.h"
@@ -20,8 +18,6 @@
#include "KEYTransformation.h"
#include "KEYTypes.h"
-namespace m = boost::math::constants;
-
using std::deque;
namespace libetonyek
@@ -138,7 +134,7 @@ deque<Point> rotatePoint(const Point &point, const unsigned n)
deque<Point> points;
- const double angle = m::two_pi<double>() / n;
+ const double angle = etonyek_two_pi / n;
points.push_back(point);
for (unsigned i = 1; i < n; ++i)
@@ -308,7 +304,7 @@ KEYPathPtr_t makeStarPath(const KEYSize &size, const unsigned points, const doub
const deque<Point> outerPoints = rotatePoint(Point(0, -1), points);
// create inner points
- const double angle = m::two_pi<double>() / points;
+ const double angle = etonyek_two_pi / points;
deque<Point> innerPoints(outerPoints);
transform(innerPoints, rotate(angle / 2) * scale(innerRadius, innerRadius));
--- libetonyek-0.1.1/src/lib/libetonyek_utils.h
+++ libetonyek-0.1.1/src/lib/libetonyek_utils.h
@@ -80,6 +80,15 @@ typedef __int64 int64_t;
namespace libetonyek
{
+/* Constants */
+const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00);
+const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00);
+const double etonyek_pi(3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+00);
+const double etonyek_two_pi(6.28318530717958647692528676655900576839433879875021164194988918461563281257241799725606965068423413596429617303e+00);
+
+const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00);
+const double etonyek_root_two(1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623e+00);
+
struct KEYDummyDeleter
{
void operator()(void *) {}
--- libetonyek-0.1.1/src/test/KEYShapeTest.cpp
+++ libetonyek-0.1.1/src/test/KEYShapeTest.cpp
@@ -7,8 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <boost/math/constants/constants.hpp>
-
#include "KEYObject.h"
#include "KEYPath.h"
#include "KEYShape.h"
@@ -19,13 +17,11 @@
namespace test
{
-namespace m = boost::math::constants;
-
using libetonyek::KEYPath;
using libetonyek::KEYPathPtr_t;
using libetonyek::KEYSize;
-
-const double etonyek_root_three(1.73205080756887729352744634150587236694280525381038062805580697945193301690880003708114618675724857567562614142e+00);
+using libetonyek::etonyek_root_three;
+using libetonyek::etonyek_root_two;
void KEYShapeTest::setUp()
{
@@ -75,7 +71,7 @@ void KEYShapeTest::testMakePolygonPath()
// octagon
{
- const double d = 25 * (2 - m::root_two<double>());
+ const double d = 25 * (2 - etonyek_root_two);
KEYPath ref;
ref.appendMoveTo(50, 0);
--- libetonyek-0.1.1/src/test/KEYTransformationTest.cpp
+++ libetonyek-0.1.1/src/test/KEYTransformationTest.cpp
@@ -7,22 +7,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <boost/math/constants/constants.hpp>
-
#include "KEYTransformation.h"
#include "KEYTypes.h"
#include "KEYTransformationTest.h"
+#include "libetonyek_utils.h"
+
namespace test
{
-namespace m = boost::math::constants;
-
using libetonyek::KEYTransformation;
-
-const double etonyek_half_pi(1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404326e+00);
-const double etonyek_third_pi(1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550e+00);
+using libetonyek::etonyek_third_pi;
+using libetonyek::etonyek_half_pi;
+using libetonyek::etonyek_two_pi;
+using libetonyek::etonyek_pi;
namespace
{
@@ -134,9 +133,9 @@ void KEYTransformationTest::testConstruction()
// shearing
// FIXME: find the problem and enable
- // CPPUNIT_ASSERT(shear(m::pi<double>() / 4, 0) == KEYTransformation(1, 2, 0, 1, 0, 0));
- // CPPUNIT_ASSERT(shear(0, m::pi<double>() / 4) == KEYTransformation(1, 0, 2, 1, 0, 0));
- // CPPUNIT_ASSERT(shear(m::pi<double>() / 4, m::pi<double>() / 4) == KEYTransformation(1, 2, 2, 1, 0, 0));
+ // CPPUNIT_ASSERT(shear(etonyek_pi / 4, 0) == KEYTransformation(1, 2, 0, 1, 0, 0));
+ // CPPUNIT_ASSERT(shear(0, etonyek_pi / 4) == KEYTransformation(1, 0, 2, 1, 0, 0));
+ // CPPUNIT_ASSERT(shear(etonyek_pi / 4, etonyek_pi / 4) == KEYTransformation(1, 2, 2, 1, 0, 0));
// translating
CPPUNIT_ASSERT(translate(100, 0) == KEYTransformation(1, 0, 0, 1, 100, 0));
@@ -152,7 +151,7 @@ void KEYTransformationTest::testConstructionIdentity()
CPPUNIT_ASSERT(origin(0, 0) == KEYTransformation());
CPPUNIT_ASSERT(flip(false, false) == KEYTransformation());
CPPUNIT_ASSERT(rotate(0) == KEYTransformation());
- CPPUNIT_ASSERT(rotate(m::two_pi<double>()) == KEYTransformation());
+ CPPUNIT_ASSERT(rotate(etonyek_two_pi) == KEYTransformation());
CPPUNIT_ASSERT(scale(1, 1) == KEYTransformation());
CPPUNIT_ASSERT(shear(0, 0) == KEYTransformation());
CPPUNIT_ASSERT(translate(0, 0) == KEYTransformation());
@@ -250,7 +249,7 @@ void KEYTransformationTest::testInverseOperations()
CPPUNIT_ASSERT(flip(false, true) * flip(false, true) == KEYTransformation());
CPPUNIT_ASSERT(flip(true, true) * flip(true, true) == KEYTransformation());
- CPPUNIT_ASSERT(rotate(m::pi<double>()) * rotate(-m::pi<double>()) == KEYTransformation());
+ CPPUNIT_ASSERT(rotate(etonyek_pi) * rotate(-etonyek_pi) == KEYTransformation());
CPPUNIT_ASSERT(scale(2, 1) * scale(0.5, 1) == KEYTransformation());
CPPUNIT_ASSERT(scale(1, 2) * scale(1, 0.5) == KEYTransformation());