Use M_PI for Pi, not constexpr calculation
Constexpr evaluation breaks Clang compilation. Use math.h M_PI, as elsewhere.
This commit is contained in:
parent
5e19ed29b8
commit
9476b53533
|
@ -24,15 +24,14 @@
|
||||||
#ifndef GEOM_TEST_UTILS_H
|
#ifndef GEOM_TEST_UTILS_H
|
||||||
#define GEOM_TEST_UTILS_H
|
#define GEOM_TEST_UTILS_H
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Utility functions for testing geometry functions.
|
* @brief Utility functions for testing geometry functions.
|
||||||
*/
|
*/
|
||||||
namespace GEOM_TEST
|
namespace GEOM_TEST
|
||||||
{
|
{
|
||||||
|
|
||||||
constexpr double PI = atan(1.0) * 4.0;
|
|
||||||
constexpr double PI_2 = atan(1.0) * 2.0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if a value is within a tolerance of a nominal value
|
* @brief Check if a value is within a tolerance of a nominal value
|
||||||
*
|
*
|
||||||
|
@ -159,12 +158,12 @@ bool ArePerpendicular( const VECTOR2<T>& a, const VECTOR2<T>& b, double aToleran
|
||||||
auto angle = std::abs( a.Angle() - b.Angle() );
|
auto angle = std::abs( a.Angle() - b.Angle() );
|
||||||
|
|
||||||
// Normalise: angles of 3*pi/2 are also perpendicular
|
// Normalise: angles of 3*pi/2 are also perpendicular
|
||||||
if (angle > PI)
|
if (angle > M_PI)
|
||||||
{
|
{
|
||||||
angle -= PI;
|
angle -= M_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return IsWithin( angle, PI_2, aTolerance );
|
return IsWithin( angle, M_PI / 2.0, aTolerance );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,8 +68,9 @@ void TestFilletSegmentConstraints( const SEG& aSeg, VECTOR2I aRadCentre,
|
||||||
( diffC.EuclideanNorm() )( aRadius )( aError + 1 ) );
|
( diffC.EuclideanNorm() )( aRadius )( aError + 1 ) );
|
||||||
|
|
||||||
// Check 3: Mid-point -> radius centre perpendicular
|
// Check 3: Mid-point -> radius centre perpendicular
|
||||||
|
const auto perpendularityMaxError = ( M_PI / 2 ) / 10;
|
||||||
BOOST_CHECK_PREDICATE( ArePerpendicular<int>,
|
BOOST_CHECK_PREDICATE( ArePerpendicular<int>,
|
||||||
( diffC )( aSeg.A - aSeg.B )( PI_2 / 10 ) );
|
( diffC )( aSeg.A - aSeg.B )( perpendularityMaxError ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue