diff --git a/GraphicsView/include/CGAL/Qt/camera_impl.h b/GraphicsView/include/CGAL/Qt/camera_impl.h index 980ce63adc1..eb5e939c774 100644 --- a/GraphicsView/include/CGAL/Qt/camera_impl.h +++ b/GraphicsView/include/CGAL/Qt/camera_impl.h @@ -48,7 +48,7 @@ using namespace CGAL::qglviewer; focusDistance() documentations for default stereo parameter values. */ CGAL_INLINE_FUNCTION Camera::Camera(QObject *parent) - : frame_(NULL), fieldOfView_(M_PI / 4.0), modelViewMatrixIsUpToDate_(false), + : frame_(NULL), fieldOfView_(CGAL_PI / 4.0), modelViewMatrixIsUpToDate_(false), projectionMatrixIsUpToDate_(false) { setParent(parent); // #CONNECTION# Camera copy constructor @@ -394,7 +394,7 @@ void Camera::computeProjectionMatrix() const { projectionMatrix_[11] = -1.0; projectionMatrix_[14] = 2.0 * ZNear * ZFar / (ZNear - ZFar); projectionMatrix_[15] = 0.0; - // same as gluPerspective( 180.0*fieldOfView()/M_PI, aspectRatio(), zNear(), + // same as gluPerspective( 180.0*fieldOfView()/CGAL_PI, aspectRatio(), zNear(), // zFar() ); break; } @@ -889,7 +889,7 @@ qreal Camera::pixelGLRatio(const Vec &position) const { See the (soon available) shadowMap contribution example for a practical implementation. - \attention The fieldOfView() is clamped to M_PI/2.0. This happens when the + \attention The fieldOfView() is clamped to CGAL_PI/2.0. This happens when the Camera is at a distance lower than sqrt(2.0) * sceneRadius() from the sceneCenter(). It optimizes the shadow map resolution, although it may miss some parts of the scene. */ @@ -898,7 +898,7 @@ void Camera::setFOVToFitScene() { if (distanceToSceneCenter() > sqrt(2.0) * sceneRadius()) setFieldOfView(2.0 * asin(sceneRadius() / distanceToSceneCenter())); else - setFieldOfView(M_PI / 2.0); + setFieldOfView(CGAL_PI / 2.0); } /*! Makes the Camera smoothly zoom on the pointUnderPixel() \p pixel. @@ -2250,7 +2250,7 @@ void Camera::initFromDOMElement(const QDomElement &element) { while (!child.isNull()) { if (child.tagName() == "Parameters") { // #CONNECTION# Default values set in constructor - setFieldOfView(DomUtils::qrealFromDom(child, "fieldOfView", M_PI / 4.0)); + setFieldOfView(DomUtils::qrealFromDom(child, "fieldOfView", CGAL_PI / 4.0)); setZNearCoefficient( DomUtils::qrealFromDom(child, "zNearCoefficient", 0.005)); setZClippingCoefficient( diff --git a/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h b/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h index f300b4a2646..cfff7d57d14 100644 --- a/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h +++ b/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h @@ -30,6 +30,7 @@ #else #define CGAL_INLINE_FUNCTION #endif +#include #include #include #include @@ -347,7 +348,7 @@ void ManipulatedCameraFrame::mouseMoveEvent(QMouseEvent *const event, case ROLL: { const qreal angle = - M_PI * (event->x() - prevPos_.x()) / camera->screenWidth(); + CGAL_PI * (event->x() - prevPos_.x()) / camera->screenWidth(); Quaternion rot(Vec(0.0, 0.0, 1.0), angle); rotate(rot); setSpinningQuaternion(rot); diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index 00ea8ebd027..2d78bd719fb 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -3225,7 +3225,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1) angle = 90.0f; else - angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/M_PI; + angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/CGAL_PI; QVector3D axis; axis = QVector3D(dir.z(), 0, -dir.x()); @@ -3235,7 +3235,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve const float Rf = static_cast(R); for(int d = 0; d<360; d+= 360/prec) { - float D = (float) (d * M_PI / 180.); + float D = (float) (d * CGAL_PI / 180.); float a = (float) std::atan(Rf / 0.33); QVector4D p(0., 1., 0, 1.); QVector4D n(Rf*sin(D), sin(a), Rf*cos(D), 1.); @@ -3268,7 +3268,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve data.push_back((float)color.y); data.push_back((float)color.z); //point C1 - D = (d+360/prec)*M_PI/180.0; + D = (d+360/prec)*CGAL_PI/180.0; p = QVector4D(Rf* sin(D), 0.66f, Rf* cos(D), 1.f); n = QVector4D(sin(D), sin(a), cos(D), 1.0); pR = mat*p; @@ -3292,7 +3292,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve for(int d = 0; d<360; d+= 360/prec) { //point A1 - double D = d*M_PI/180.0; + double D = d*CGAL_PI/180.0; QVector4D p(rf*sin(D), 0.66f, rf*cos(D), 1.f); QVector4D n(sin(D), 0.f, cos(D), 1.f); QVector4D pR = mat*p; @@ -3324,7 +3324,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve data.push_back(color.y); data.push_back(color.z); //point C1 - D = (d+360/prec)*M_PI/180.0; + D = (d+360/prec)*CGAL_PI/180.0; p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0); n = QVector4D(sin(D), 0, cos(D), 1.0); pR = mat*p; @@ -3339,7 +3339,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve data.push_back(color.y); data.push_back(color.z); //point A2 - D = (d+360/prec)*M_PI/180.0; + D = (d+360/prec)*CGAL_PI/180.0; p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0); n = QVector4D(sin(D), 0, cos(D), 1.0); @@ -3369,7 +3369,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve data.push_back((float)color.y); data.push_back((float)color.z); //point C2 - D = d*M_PI/180.0; + D = d*CGAL_PI/180.0; p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f); n = QVector4D(sin(D), 0.f, cos(D), 1.f); pR = mat*p; diff --git a/GraphicsView/include/CGAL/Qt/quaternion_impl.h b/GraphicsView/include/CGAL/Qt/quaternion_impl.h index 04d61dafca9..bc8960bebf1 100644 --- a/GraphicsView/include/CGAL/Qt/quaternion_impl.h +++ b/GraphicsView/include/CGAL/Qt/quaternion_impl.h @@ -30,7 +30,7 @@ #else #define CGAL_INLINE_FUNCTION #endif - +#include #include #include #include // RAND_MAX @@ -66,7 +66,7 @@ Quaternion::Quaternion(const Vec &from, const Vec &to) { qreal angle = asin(sqrt(axisSqNorm / (fromSqNorm * toSqNorm))); if (from * to < 0.0) - angle = M_PI - angle; + angle = CGAL_PI - angle; setAxisAngle(axis, angle); } @@ -190,8 +190,8 @@ void Quaternion::getAxisAngle(Vec &axis, qreal &angle) const { if (sinus > 1E-8) axis /= sinus; - if (angle > M_PI) { - angle = 2.0 * qreal(M_PI) - angle; + if (angle > CGAL_PI) { + angle = 2.0 * qreal(CGAL_PI) - angle; axis = -axis; } } @@ -206,7 +206,7 @@ Vec Quaternion::axis() const { const qreal sinus = res.norm(); if (sinus > 1E-8) res /= sinus; - return (acos(q[3]) <= M_PI / 2.0) ? res : -res; + return (acos(q[3]) <= CGAL_PI / 2.0) ? res : -res; } /*! Returns the angle (in radians) of the rotation represented by the @@ -219,7 +219,7 @@ Vec Quaternion::axis() const { CGAL_INLINE_FUNCTION qreal Quaternion::angle() const { const qreal angle = 2.0 * acos(q[3]); - return (angle <= M_PI) ? angle : 2.0 * M_PI - angle; + return (angle <= CGAL_PI) ? angle : 2.0 * CGAL_PI - angle; } /*! Returns an XML \c QDomElement that represents the Quaternion. @@ -555,7 +555,7 @@ Quaternion Quaternion::randomQuaternion() { qreal seed = rand() / (qreal)RAND_MAX; qreal r1 = sqrt(1.0 - seed); qreal r2 = sqrt(seed); - qreal t1 = 2.0 * M_PI * (rand() / (qreal)RAND_MAX); - qreal t2 = 2.0 * M_PI * (rand() / (qreal)RAND_MAX); + qreal t1 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX); + qreal t2 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX); return Quaternion(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2); }