Browse Source

update M_PI to igl::PI. header file inclusion for some files are also added.

Former-commit-id: 7565b77de7e5f83504d3f8d7671cf48080975372
ZM-LT 6 năm trước cách đây
mục cha
commit
174ac59db6

+ 3 - 3
include/igl/Camera.h

@@ -174,7 +174,7 @@ inline Eigen::Matrix4d igl::Camera::projection() const
     const double tx = (right+left)/(right-left);
     const double ty = (top+bottom)/(top-bottom);
     const double tz = (far+near)/(far-near);
-    const double z_fix = 0.5 /m_at_dist / tan(m_angle*0.5 * (M_PI/180.) );
+    const double z_fix = 0.5 /m_at_dist / tan(m_angle*0.5 * (igl::PI/180.) );
     P<<
       z_fix*2./(right-left), 0, 0, -tx,
       0, z_fix*2./(top-bottom), 0, -ty,
@@ -283,8 +283,8 @@ inline void igl::Camera::dolly_zoom(const double da)
     m_angle = min(89.,max(IGL_CAMERA_MIN_ANGLE,m_angle));
     // change in distance
     const double s = 
-      (2.*tan(old_angle/2./180.*M_PI)) /
-      (2.*tan(m_angle/2./180.*M_PI)) ;
+      (2.*tan(old_angle/2./180.*igl::PI)) /
+      (2.*tan(m_angle/2./180.*igl::PI)) ;
     const double old_at_dist = m_at_dist;
     m_at_dist = old_at_dist * s;
     dolly(Vector3d(0,0,1)*(m_at_dist - old_at_dist));

+ 2 - 2
include/igl/comb_frame_field.cpp

@@ -49,9 +49,9 @@ IGL_INLINE void igl::comb_frame_field(const Eigen::PlainObjectBase<DerivedV> &V,
     {
       a[j] = atan2(B2.row(i).dot(DIRs.row(j)),B1.row(i).dot(DIRs.row(j))) - a_combed;
       //make it positive by adding some multiple of 2pi
-      a[j] += std::ceil (std::max(0., -a[j]) / (M_PI*2.)) * (M_PI*2.);
+      a[j] += std::ceil (std::max(0., -a[j]) / (igl::PI*2.)) * (igl::PI*2.);
       //take modulo 2pi
-      a[j] = fmod(a[j], (M_PI*2.));
+      a[j] = fmod(a[j], (igl::PI*2.));
     }
     // now the max is u and the min is v
 

+ 9 - 9
include/igl/compute_frame_field_bisectors.cpp

@@ -34,26 +34,26 @@ IGL_INLINE void igl::compute_frame_field_bisectors(
     // Convert to angle
     double a1 = atan2(B2.row(i).dot(PD1.row(i)),B1.row(i).dot(PD1.row(i)));
     //make it positive by adding some multiple of 2pi
-    a1 += std::ceil (std::max(0., -a1) / (M_PI*2.)) * (M_PI*2.);
+    a1 += std::ceil (std::max(0., -a1) / (igl::PI*2.)) * (igl::PI*2.);
     //take modulo 2pi
-    a1 = fmod(a1, (M_PI*2.));
+    a1 = fmod(a1, (igl::PI*2.));
     double a2 = atan2(B2.row(i).dot(PD2.row(i)),B1.row(i).dot(PD2.row(i)));
     //make it positive by adding some multiple of 2pi
-    a2 += std::ceil (std::max(0., -a2) / (M_PI*2.)) * (M_PI*2.);
+    a2 += std::ceil (std::max(0., -a2) / (igl::PI*2.)) * (igl::PI*2.);
     //take modulo 2pi
-    a2 = fmod(a2, (M_PI*2.));
+    a2 = fmod(a2, (igl::PI*2.));
 
     double b1 = (a1+a2)/2.0;
     //make it positive by adding some multiple of 2pi
-    b1 += std::ceil (std::max(0., -b1) / (M_PI*2.)) * (M_PI*2.);
+    b1 += std::ceil (std::max(0., -b1) / (igl::PI*2.)) * (igl::PI*2.);
     //take modulo 2pi
-    b1 = fmod(b1, (M_PI*2.));
+    b1 = fmod(b1, (igl::PI*2.));
 
-    double b2 = b1+(M_PI/2.);
+    double b2 = b1+(igl::PI/2.);
     //make it positive by adding some multiple of 2pi
-    b2 += std::ceil (std::max(0., -b2) / (M_PI*2.)) * (M_PI*2.);
+    b2 += std::ceil (std::max(0., -b2) / (igl::PI*2.)) * (igl::PI*2.);
     //take modulo 2pi
-    b2 = fmod(b2, (M_PI*2.));
+    b2 = fmod(b2, (igl::PI*2.));
 
     BIS1.row(i) = cos(b1) * B1.row(i) + sin(b1) * B2.row(i);
     BIS2.row(i) = cos(b2) * B1.row(i) + sin(b2) * B2.row(i);

+ 1 - 1
include/igl/copyleft/cgal/extract_feature.cpp

@@ -55,7 +55,7 @@ IGL_INLINE void igl::copyleft::cgal::extract_feature(
   const size_t num_faces = F.rows();
   // NOTE: CGAL's definition of dihedral angle measures the angle between two
   // facets instead of facet normals.
-  const double cos_tol = cos(M_PI - tol);
+  const double cos_tol = cos(igl::PI - tol);
   std::vector<size_t> result; // Indices into uE
 
   auto is_non_manifold = [&uE2E](size_t ei) -> bool {

+ 1 - 1
include/igl/copyleft/cgal/wire_mesh.cpp

@@ -30,7 +30,7 @@ IGL_INLINE void igl::copyleft::cgal::wire_mesh(
   MatrixX3S PV(poly_size,3);
   for(int p =0;p<PV.rows();p++)
   {
-    const Scalar phi = (Scalar(p)/Scalar(PV.rows()))*2.*M_PI;
+    const Scalar phi = (Scalar(p)/Scalar(PV.rows()))*2.*igl::PI;
     PV(p,0) = 0.5*cos(phi);
     PV(p,1) = 0.5*sin(phi);
     PV(p,2) = 0;

+ 7 - 7
include/igl/copyleft/comiso/frame_field.cpp

@@ -164,25 +164,25 @@ FrameInterpolator::~FrameInterpolator()
 double FrameInterpolator::mod2pi(double d)
 {
   while(d<0)
-    d = d + (2.0*M_PI);
+    d = d + (2.0*igl::PI);
 
-  return fmod(d, (2.0*M_PI));
+  return fmod(d, (2.0*igl::PI));
 }
 
 double FrameInterpolator::modpi2(double d)
 {
   while(d<0)
-    d = d + (M_PI/2.0);
+    d = d + (igl::PI/2.0);
 
-  return fmod(d, (M_PI/2.0));
+  return fmod(d, (igl::PI/2.0));
 }
 
 double FrameInterpolator::modpi(double d)
 {
   while(d<0)
-    d = d + (M_PI);
+    d = d + (igl::PI);
 
-  return fmod(d, (M_PI));
+  return fmod(d, (igl::PI));
 }
 
 
@@ -276,7 +276,7 @@ void FrameInterpolator::compute_edge_consistency()
 
       double r = modpi(theta0-theta1);
 
-      edge_consistency[eid] = r < M_PI/4.0 || r > 3*(M_PI/4.0);
+      edge_consistency[eid] = r < igl::PI/4.0 || r > 3*(igl::PI/4.0);
 
       // Copy it into edge_consistency_TT
       int i1 = -1;

+ 1 - 0
include/igl/copyleft/comiso/frame_field.h

@@ -9,6 +9,7 @@
 #define IGL_COMISO_FRAMEFIELD_H
 
 #include <igl/igl_inline.h>
+#include <igl/PI.h>
 #include <Eigen/Dense>
 #include <vector>
 

+ 9 - 9
include/igl/copyleft/comiso/nrosy.cpp

@@ -297,7 +297,7 @@ void igl::copyleft::comiso::NRosyField::prepareSystemMatrix(const int N)
       row = tag_t[i];
       if (isFixed_i) b(row) += -2               * hard[i]; else T.push_back(Eigen::Triplet<double>(row,tag_t[i]  , 2             ));
       if (isFixed_j) b(row) +=  2               * hard[j]; else T.push_back(Eigen::Triplet<double>(row,tag_t[j]  ,-2             ));
-      if (isFixed_p) b(row) += -((4 * M_PI)/Nd) * p[eid] ; else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],((4 * M_PI)/Nd)));
+      if (isFixed_p) b(row) += -((4 * igl::PI)/Nd) * p[eid] ; else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],((4 * igl::PI)/Nd)));
       b(row) += -2 * k[eid];
       assert(hard[i] == hard[i]);
       assert(hard[j] == hard[j]);
@@ -311,7 +311,7 @@ void igl::copyleft::comiso::NRosyField::prepareSystemMatrix(const int N)
       row = tag_t[j];
       if (isFixed_i) b(row) += 2               * hard[i]; else T.push_back(Eigen::Triplet<double>(row,tag_t[i]  , -2             ));
       if (isFixed_j) b(row) += -2              * hard[j]; else T.push_back(Eigen::Triplet<double>(row,tag_t[j] ,  2              ));
-      if (isFixed_p) b(row) += ((4 * M_PI)/Nd) * p[eid] ; else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],-((4 * M_PI)/Nd)));
+      if (isFixed_p) b(row) += ((4 * igl::PI)/Nd) * p[eid] ; else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],-((4 * igl::PI)/Nd)));
       b(row) += 2 * k[eid];
       assert(k[eid] == k[eid]);
       assert(b(row) == b(row));
@@ -320,10 +320,10 @@ void igl::copyleft::comiso::NRosyField::prepareSystemMatrix(const int N)
     if (!isFixed_p)
     {
       row = tag_p[eid];
-      if (isFixed_i) b(row) += -(4 * M_PI)/Nd              * hard[i]; else T.push_back(Eigen::Triplet<double>(row,tag_t[i] ,   (4 * M_PI)/Nd             ));
-      if (isFixed_j) b(row) +=  (4 * M_PI)/Nd              * hard[j]; else T.push_back(Eigen::Triplet<double>(row,tag_t[j] ,  -(4 * M_PI)/Nd             ));
-      if (isFixed_p) b(row) += -(2 * pow(((2*M_PI)/Nd),2)) * p[eid] ;  else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],  (2 * pow(((2*M_PI)/Nd),2))));
-      b(row) += - (4 * M_PI)/Nd * k[eid];
+      if (isFixed_i) b(row) += -(4 * igl::PI)/Nd              * hard[i]; else T.push_back(Eigen::Triplet<double>(row,tag_t[i] ,   (4 * igl::PI)/Nd             ));
+      if (isFixed_j) b(row) +=  (4 * igl::PI)/Nd              * hard[j]; else T.push_back(Eigen::Triplet<double>(row,tag_t[j] ,  -(4 * igl::PI)/Nd             ));
+      if (isFixed_p) b(row) += -(2 * pow(((2*igl::PI)/Nd),2)) * p[eid] ;  else T.push_back(Eigen::Triplet<double>(row,tag_p[eid],  (2 * pow(((2*igl::PI)/Nd),2))));
+      b(row) += - (4 * igl::PI)/Nd * k[eid];
       assert(k[eid] == k[eid]);
       assert(b(row) == b(row));
     }
@@ -759,7 +759,7 @@ void igl::copyleft::comiso::NRosyField::reduceSpace()
           int fid1 = EF(eid,1);
 
           pFixed[eid] = true;
-          p[eid] = roundl(2.0/M_PI*(hard(fid1) - hard(fid0) - k(eid)));
+          p[eid] = roundl(2.0/igl::PI*(hard(fid1) - hard(fid0) - k(eid)));
         }
       }
     }
@@ -795,7 +795,7 @@ Eigen::Vector3d igl::copyleft::comiso::NRosyField::convertLocalto3D(unsigned fid
 
 Eigen::VectorXd igl::copyleft::comiso::NRosyField::angleDefect()
 {
-  Eigen::VectorXd A = Eigen::VectorXd::Constant(V.rows(),-2*M_PI);
+  Eigen::VectorXd A = Eigen::VectorXd::Constant(V.rows(),-2*igl::PI);
 
   for (unsigned i=0; i < F.rows(); ++i)
   {
@@ -834,7 +834,7 @@ void igl::copyleft::comiso::NRosyField::findCones(int N)
   I0 = I0 + A;
 
   // normalize
-  I0 = I0 / (2*M_PI);
+  I0 = I0 / (2*igl::PI);
 
   // round to integer (remove numerical noise)
   for (unsigned i=0; i < I0.size(); ++i)

+ 1 - 0
include/igl/copyleft/comiso/nrosy.h

@@ -13,6 +13,7 @@
 #include <Eigen/Sparse>
 #include <vector>
 #include "../../igl_inline.h"
+#include "../../PI.h"
 
 namespace igl
 {

+ 1 - 1
include/igl/cross_field_missmatch.cpp

@@ -65,7 +65,7 @@ namespace igl {
 
       //    std::cerr << "Dani: " << dir0(0) << " " << dir0(1) << " " << dir0(2) << " " << dir1Rot(0) << " " << dir1Rot(1) << " " << dir1Rot(2) << " " << angle_diff << std::endl;
 
-      double step=M_PI/2.0;
+      double step=igl::PI/2.0;
       int i=(int)std::floor((angle_diff/step)+0.5);
       int k=0;
       if (i>=0)

+ 5 - 5
include/igl/fast_winding_number.cpp

@@ -142,7 +142,7 @@ namespace igl {
     auto direct_eval = [](const RowVec & loc,
                           const Eigen::Matrix<real_ec,1,3> & anorm){
         real_wn wn = (loc(0)*anorm(0)+loc(1)*anorm(1)+loc(2)*anorm(2))
-                                    /(4.0*M_PI*std::pow(loc.norm(),3));
+                                    /(4.0*igl::PI*std::pow(loc.norm(),3));
         if(std::isnan(wn)){
             return 0.5;
         }else{
@@ -156,8 +156,8 @@ namespace igl {
       double r = loc.norm();
       if(EC.size()>3){
         Eigen::Matrix<real_ec,3,3> SecondDerivative =
-            Eigen::Matrix<real_ec,3,3>::Identity()/(4.0*M_PI*std::pow(r,3));
-        SecondDerivative += -3.0*loc.transpose()*loc/(4.0*M_PI*std::pow(r,5));
+            Eigen::Matrix<real_ec,3,3>::Identity()/(4.0*igl::PI*std::pow(r,3));
+        SecondDerivative += -3.0*loc.transpose()*loc/(4.0*igl::PI*std::pow(r,5));
         Eigen::Matrix<real_ec,1,9> derivative_vector =
           Eigen::Map<Eigen::Matrix<real_ec,1,9> >(SecondDerivative.data(),
                                                   SecondDerivative.size());
@@ -167,7 +167,7 @@ namespace igl {
           Eigen::Matrix<real_ec,3,3> ThirdDerivative;
           for(int i = 0; i < 3; i++){
               ThirdDerivative =
-                  15.0*loc(i)*loc.transpose()*loc/(4.0*M_PI*std::pow(r,7));
+                  15.0*loc(i)*loc.transpose()*loc/(4.0*igl::PI*std::pow(r,7));
               Eigen::Matrix<real_ec,3,3> Diagonal;
               Diagonal << loc(i), 0, 0,
               0, loc(i), 0,
@@ -178,7 +178,7 @@ namespace igl {
               Eigen::Matrix<real_ec,3,3> RowColT = RowCol.transpose();
               RowCol = RowCol + RowColT;
               ThirdDerivative +=
-                  -3.0/(4.0*M_PI*std::pow(r,5))*(RowCol+Diagonal);
+                  -3.0/(4.0*igl::PI*std::pow(r,5))*(RowCol+Diagonal);
               Eigen::Matrix<real_ec,1,9> derivative_vector =
                 Eigen::Map<Eigen::Matrix<real_ec,1,9> >(ThirdDerivative.data(),
                                                         ThirdDerivative.size());

+ 2 - 2
include/igl/flip_avoiding_line_search.cpp

@@ -38,8 +38,8 @@ namespace igl
           t=acos(t);
           a/=3; q=-2*sqrt(q);
           x[0]=q*cos(t/3)-a;
-          x[1]=q*cos((t+(2*M_PI))/3)-a;
-          x[2]=q*cos((t-(2*M_PI))/3)-a;
+          x[1]=q*cos((t+(2*igl::PI))/3)-a;
+          x[2]=q*cos((t-(2*igl::PI))/3)-a;
           return(3);
         }
         else

+ 1 - 0
include/igl/flip_avoiding_line_search.h

@@ -8,6 +8,7 @@
 #ifndef IGL_FLIP_AVOIDING_LINE_SEARCH_H
 #define IGL_FLIP_AVOIDING_LINE_SEARCH_H
 #include "igl_inline.h"
+#include "PI.h"
 
 #include <Eigen/Dense>
 

+ 1 - 1
include/igl/grad.cpp

@@ -148,7 +148,7 @@ IGL_INLINE void grad_tri(const Eigen::PlainObjectBase<DerivedV>&V,
       // Abstract equilateral triangle v1=(0,0), v2=(h,0), v3=(h/2, (sqrt(3)/2)*h)
 
       // get h (by the area of the triangle)
-      double h = sqrt( (dblA)/sin(M_PI / 3.0)); // (h^2*sin(60))/2. = Area => h = sqrt(2*Area/sin_60)
+      double h = sqrt( (dblA)/sin(igl::PI / 3.0)); // (h^2*sin(60))/2. = Area => h = sqrt(2*Area/sin_60)
 
       Eigen::Matrix<typename DerivedV::Scalar, 3, 1> v1,v2,v3;
       v1 << 0,0,0;

+ 2 - 2
include/igl/line_field_missmatch.cpp

@@ -65,7 +65,7 @@ private:
 
         double angle_diff = atan2(dir1Rot.dot(PD2.row(f0)),dir1Rot.dot(PD1.row(f0)));
 
-        double step=M_PI;
+        double step=igl::PI;
         int i=(int)std::floor((angle_diff/step)+0.5);
         assert((i>=-2)&&(i<=2));
         int k=0;
@@ -133,7 +133,7 @@ IGL_INLINE void igl::line_field_missmatch(const Eigen::PlainObjectBase<DerivedV>
     }
     Eigen::MatrixXd B1,B2,B3;
     igl::local_basis(V,F,B1,B2,B3);
-    PD2_combed = igl::rotate_vectors(PD1_combed, Eigen::VectorXd::Constant(1,M_PI/2), B1, B2);
+    PD2_combed = igl::rotate_vectors(PD1_combed, Eigen::VectorXd::Constant(1,igl::PI/2), B1, B2);
     igl::MissMatchCalculatorLine<DerivedV, DerivedF, DerivedO> sf(V, F, PD1_combed, PD2_combed);
     sf.calculateMissmatchLine(missmatch);
 }

+ 1 - 1
include/igl/map_vertices_to_circle.cpp

@@ -46,7 +46,7 @@ IGL_INLINE void igl::map_vertices_to_circle(
   UV.resize(bnd.size(),2);
   for (int i = 0; i < bnd.size(); i++)
   {
-    double frac = len[i] * 2. * M_PI / total_len;
+    double frac = len[i] * 2. * igl::PI / total_len;
     UV.row(map_ij[bnd[i]]) << cos(frac), sin(frac);
   }
 

+ 1 - 0
include/igl/map_vertices_to_circle.h

@@ -8,6 +8,7 @@
 #ifndef IGL_MAP_VERTICES_TO_CIRCLE_H
 #define IGL_MAP_VERTICES_TO_CIRCLE_H
 #include "igl_inline.h"
+#include "PI.h"
 
 #include <Eigen/Dense>
 #include <vector>

+ 4 - 4
include/igl/random_quaternion.cpp

@@ -16,9 +16,9 @@ IGL_INLINE Eigen::Quaternion<Scalar> igl::random_quaternion()
   };
 #ifdef false
   // http://mathproofs.blogspot.com/2005/05/uniformly-distributed-random-unit.html
-  const Scalar t0 = 2.*M_PI*unit_rand();
+  const Scalar t0 = 2.*igl::PI*unit_rand();
   const Scalar t1 = acos(1.-2.*unit_rand());
-  const Scalar t2 = 0.5*(M_PI*unit_rand() + acos(unit_rand()));
+  const Scalar t2 = 0.5*(igl::PI*unit_rand() + acos(unit_rand()));
   return Eigen::Quaternion<Scalar>(
     1.*sin(t0)*sin(t1)*sin(t2),
     1.*cos(t0)*sin(t1)*sin(t2),
@@ -63,8 +63,8 @@ IGL_INLINE Eigen::Quaternion<Scalar> igl::random_quaternion()
   const Scalar x2 = unit_rand();
   const Scalar r1 = sqrt(1.0 - x0);
   const Scalar r2 = sqrt(x0);
-  const Scalar t1 = 2.*M_PI*x1;
-  const Scalar t2 = 2.*M_PI*x2;
+  const Scalar t1 = 2.*igl::PI*x1;
+  const Scalar t2 = 2.*igl::PI*x2;
   const Scalar c1 = cos(t1);
   const Scalar s1 = sin(t1);
   const Scalar c2 = cos(t2);

+ 1 - 1
include/igl/shapeup.cpp

@@ -50,7 +50,7 @@ namespace igl
   
       //creating perfectly regular source polygon
       for (int j=0;j<N;j++)
-        sourcePolygon.row(j)<<cos(2*M_PI*(double)j/(double(N))), sin(2*M_PI*(double)j/(double(N))),0.0;
+        sourcePolygon.row(j)<<cos(2*igl::PI*(double)j/(double(N))), sin(2*igl::PI*(double)j/(double(N))),0.0;
   
       //finding closest similarity transformation between source and target
       Eigen::MatrixXd corrMat=sourcePolygon.transpose()*targetPolygon;

+ 1 - 0
include/igl/shapeup.h

@@ -14,6 +14,7 @@
 #include <igl/cat.h>
 #include <Eigen/Core>
 #include <vector>
+#include <igl/PI.h>
 
 
 //This file implements the following algorithm:

+ 1 - 1
tutorial/206_GeodesicDistance/main.cpp

@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
     igl::exact_geodesic(V,F,VS,FS,VT,FT,d);
     const double strip_size = 0.05;
     // The function should be 1 on each integer coordinate
-    d = (d/strip_size*M_PI).array().sin().abs().eval();
+    d = (d/strip_size*igl::PI).array().sin().abs().eval();
     // Compute per-vertex colors
     Eigen::MatrixXd C;
     igl::colormap(igl::COLOR_MAP_TYPE_INFERNO,d,false,C);

+ 1 - 1
tutorial/504_NRosyDesign/main.cpp

@@ -44,7 +44,7 @@ void representative_to_nrosy(
 
     for (unsigned j=0; j<N;++j)
     {
-      double anglej = angle + 2*M_PI*double(j)/double(N);
+      double anglej = angle + 2*igl::PI*double(j)/double(N);
       double xj = cos(anglej);
       double yj = sin(anglej);
       Y.row(i*N+j) = xj * B1.row(i) + yj * B2.row(i);

+ 1 - 1
tutorial/505_MIQ/main.cpp

@@ -260,7 +260,7 @@ int main(int argc, char *argv[])
     // Find the orthogonal vector
     MatrixXd B1, B2, B3;
     igl::local_basis(V, F, B1, B2, B3);
-    X2 = igl::rotate_vectors(X1, VectorXd::Constant(1, M_PI / 2), B1, B2);
+    X2 = igl::rotate_vectors(X1, VectorXd::Constant(1, igl::PI / 2), B1, B2);
 
     // Always work on the bisectors, it is more general
     igl::compute_frame_field_bisectors(V, F, X1, X2, BIS1, BIS2);

+ 1 - 1
tutorial/506_FrameField/main.cpp

@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
   MatrixXd B1,B2,B3;
   igl::local_basis(V_deformed,F,B1,B2,B3);
   X2_deformed =
-    igl::rotate_vectors(X1_deformed, VectorXd::Constant(1,M_PI/2), B1, B2);
+    igl::rotate_vectors(X1_deformed, VectorXd::Constant(1,igl::PI/2), B1, B2);
 
   // Global seamless parametrization
   igl::copyleft::comiso::miq(V_deformed,

+ 2 - 1
tutorial/701_Statistics/main.cpp

@@ -2,6 +2,7 @@
 #include <igl/internal_angles.h>
 #include <igl/is_irregular_vertex.h>
 #include <igl/readOBJ.h>
+#include <igl/PI.h>
 #include <Eigen/Core>
 #include <iostream>
 
@@ -44,7 +45,7 @@ int main(int argc, char *argv[])
   // Compute per face angles, min, max and standard deviation
   MatrixXd angles;
   igl::internal_angles(V,F,angles);
-  angles = 360.0 * (angles/(2*M_PI)); // Convert to degrees
+  angles = 360.0 * (angles/(2*igl::PI)); // Convert to degrees
 
   double angle_avg   = angles.mean();
   double angle_min   = angles.minCoeff();

+ 3 - 2
tutorial/707_SweptVolume/main.cpp

@@ -4,6 +4,7 @@
 #include <igl/copyleft/marching_cubes.h>
 #include <igl/copyleft/swept_volume.h>
 #include <igl/opengl/glfw/Viewer.h>
+#include <igl/PI.h>
 #include <Eigen/Core>
 #include <iostream>
 
@@ -20,8 +21,8 @@ int main(int argc, char * argv[])
   const auto & transform = [](const double t)->Eigen::Affine3d
   {
     Eigen::Affine3d T = Eigen::Affine3d::Identity();
-    T.rotate(Eigen::AngleAxisd(t*2.*M_PI,Eigen::Vector3d(0,1,0)));
-    T.translate(Eigen::Vector3d(0,0.125*cos(2.*M_PI*t),0));
+    T.rotate(Eigen::AngleAxisd(t*2.*igl::PI,Eigen::Vector3d(0,1,0)));
+    T.translate(Eigen::Vector3d(0,0.125*cos(2.*igl::PI*t),0));
     return T;
   };
   // Read in inputs as double precision floating point meshes

+ 1 - 1
tutorial/710_SLIM/main.cpp

@@ -372,7 +372,7 @@ void get_cube_corner_constraints(Eigen::MatrixXd& V, Eigen::MatrixXi& F, Eigen::
   b = igl::cat(1,b,edge4);
 
   bc.resize(b.rows(),3);
-  Eigen::Matrix3d m; m = Eigen::AngleAxisd(0.3 * M_PI, Eigen::Vector3d(1./sqrt(2.),1./sqrt(2.),0.)/*Eigen::Vector3d::UnitX()*/);
+  Eigen::Matrix3d m; m = Eigen::AngleAxisd(0.3 * igl::PI, Eigen::Vector3d(1./sqrt(2.),1./sqrt(2.),0.)/*Eigen::Vector3d::UnitX()*/);
   int i = 0;
   for (; i < cube_edge1.size(); i++) {
     Eigen::RowVector3d edge_rot_center(min_x,min_y,(min_z+max_z)/2.);