Add definition for PI and PI_2
M_PI and M_PI_2 are not C++ standard and are therefore not present, in MinGW-w64 gcc 5.1.0 for example. We therefore replace it with an own definition. Since math.h was only included for M_PI and M_PI_2 makros, we can now remove it. Signed-off-by: Squareys <Squareys@googlemail.com>pull/859/head
parent
019226c119
commit
7c0e40a3f4
|
@ -32,15 +32,13 @@
|
||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
// Otherwise #defines like M_PI are undeclared under Visual Studio
|
|
||||||
#define _USE_MATH_DEFINES
|
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
const double PI_3div4 = 3 * M_PI / 4;
|
const double PI = 3.1415926535897932384626433832795029;
|
||||||
|
const double PI_2 = 2 * PI;
|
||||||
|
const double PI_3div4 = 3 * PI / 4;
|
||||||
const double EPSILON = 1e-15;
|
const double EPSILON = 1e-15;
|
||||||
|
|
||||||
enum Orientation { CW, CCW, COLLINEAR };
|
enum Orientation { CW, CCW, COLLINEAR };
|
||||||
|
|
|
@ -231,7 +231,7 @@ void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n)
|
||||||
|
|
||||||
while (node->next) {
|
while (node->next) {
|
||||||
double angle = HoleAngle(*node);
|
double angle = HoleAngle(*node);
|
||||||
if (angle > M_PI_2 || angle < -M_PI_2) break;
|
if (angle > PI || angle < -PI_2) break;
|
||||||
Fill(tcx, *node);
|
Fill(tcx, *node);
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n)
|
||||||
|
|
||||||
while (node->prev) {
|
while (node->prev) {
|
||||||
double angle = HoleAngle(*node);
|
double angle = HoleAngle(*node);
|
||||||
if (angle > M_PI_2 || angle < -M_PI_2) break;
|
if (angle > PI_2 || angle < -PI_2) break;
|
||||||
Fill(tcx, *node);
|
Fill(tcx, *node);
|
||||||
node = node->prev;
|
node = node->prev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue