Browse Source

triangulate -> polygon_mesh_to_triangle_mesh

Former-commit-id: 5ecb9f996604db0200543c1890c299adfca9cfd3
Daniele Panozzo 11 years ago
parent
commit
9a9b58b84b

+ 3 - 3
examples/ambient-occlusion/example.cpp

@@ -13,7 +13,7 @@
 #include <igl/readWRL.h>
 #include <igl/trackball.h>
 #include <igl/list_to_matrix.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/material_colors.h>
 #include <igl/barycenter.h>
 #include <igl/matlab_format.h>
@@ -297,7 +297,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
 }
 
 
@@ -366,7 +366,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   // Compute normals, centroid, colors, bounding box diagonal

+ 7 - 7
examples/arap/example.cpp

@@ -24,7 +24,7 @@
 #include <igl/list_to_matrix.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/material_colors.h>
 #include <igl/barycenter.h>
 #include <igl/matlab_format.h>
@@ -109,7 +109,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -262,7 +262,7 @@ bool update_arap()
             //Quaterniond q(AngleAxisd(PI/1.5,Vector3d(0,1.0,0.1).normalized()));
             //const Vector3d a = bc.row(bi);
             //bc.row(bi) = (q*(a-t) + t) + Vector3d(1.5,0.1,0.9);
-                
+
 
             break;
           }
@@ -573,7 +573,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -625,7 +625,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
   glutPostRedisplay();
 }
 
@@ -681,7 +681,7 @@ int main(int argc, char * argv[])
       cerr<<"Bad V"<<endl;
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
   per_face_normals(V,F,N);
 
@@ -705,7 +705,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);

+ 6 - 6
examples/colored-mesh/example.cpp

@@ -17,7 +17,7 @@
 #include <igl/list_to_matrix.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/material_colors.h>
 #include <igl/barycenter.h>
 #include <igl/matlab_format.h>
@@ -96,7 +96,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -406,7 +406,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -468,7 +468,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
   glutPostRedisplay();
 }
 
@@ -539,7 +539,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
   if(!readDMAT(cfilename,Z))
   {
@@ -563,7 +563,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);

+ 8 - 8
examples/flare-eyes/example.cpp

@@ -3,7 +3,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -103,7 +103,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -227,7 +227,7 @@ void draw_eyes()
     LED_METHOD_TEXTURE_FLARE = 2
   } method = LED_METHOD_TEXTURE_FLARE;
 
-  
+
   for(int l = 0;l<NUM_LEDS;l++)
   {
     glPushMatrix();
@@ -306,7 +306,7 @@ void display()
   push_scene();
 
 
-  
+
   if(list_id == 0)
   {
     list_id = glGenLists(1);
@@ -496,7 +496,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -598,7 +598,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
 }
 
 int main(int argc, char * argv[])
@@ -671,7 +671,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   init_relative();
@@ -686,7 +686,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(),"open readonly=true");
   TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-axis-valuator-fixed-up");

+ 2 - 2
examples/intersections/example.cpp

@@ -16,7 +16,7 @@
 #include <igl/list_to_matrix.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/material_colors.h>
 #include <igl/barycenter.h>
 #include <igl/matlab_format.h>
@@ -615,7 +615,7 @@ int main(int argc, char * argv[])
       {
         return false;
       }
-      triangulate(vF,F);
+      polygon_mesh_to_triangle_mesh(vF,F);
     }
     // Compute normals, centroid, colors, bounding box diagonal
     per_face_normals(V,F,N);

+ 2 - 2
examples/patches/example.cpp

@@ -3,7 +3,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -766,7 +766,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
   MatrixXi F_unique;
   unique_simplices(F, F_unique);

+ 7 - 7
examples/randomly-sample-mesh/example.cpp

@@ -4,7 +4,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -93,7 +93,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -223,7 +223,7 @@ void display()
   glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR);
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
-  
+
   draw_mesh(V,F,N);
 
   glPointSize(3.);
@@ -381,7 +381,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -482,7 +482,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
 }
 
 int main(int argc, char * argv[])
@@ -555,7 +555,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   init_relative();
@@ -571,7 +571,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");

+ 6 - 6
examples/rotate-widget/example.cpp

@@ -6,7 +6,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -99,7 +99,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -417,7 +417,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -509,7 +509,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
   glutPostRedisplay();
 }
 
@@ -583,7 +583,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   init_relative();
@@ -598,7 +598,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");

+ 12 - 12
examples/scene-rotation/example.cpp

@@ -1,4 +1,4 @@
-// Small GLUT application to test different scene rotation paradigms 
+// Small GLUT application to test different scene rotation paradigms
 //
 
 #include "trackball.h"
@@ -9,7 +9,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -107,7 +107,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -246,7 +246,7 @@ void display()
   glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR);
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
-  
+
   draw_mesh(V,F,N);
   pop_object();
 
@@ -306,7 +306,7 @@ void mouse_wheel(int wheel, int direction, int mouse_x, int mouse_y)
       break;
     default:
     case CENTER_TYPE_FPS:
-      // Move `eye` and `at` 
+      // Move `eye` and `at`
       camera.dolly((wheel==0?Vector3d(0,0,1):Vector3d(-1,0,0))*0.1*direction);
       break;
   }
@@ -408,13 +408,13 @@ void mouse_drag(int mouse_x, int mouse_y)
           down_camera.m_rotation_conj.coeffs().data()+4,
           down_quaternion);
         float new_quaternion[4];
-        
+
         const float center_x = ((float)width)/2.0;
         const float center_y = ((float)height)/2.0;
         const double speed = 2.0f;
         const float half_width =   ((float)width)/speed;
         const float half_height = ((float)height)/speed;
-        
+
         ::trackball(new_quaternion,
           (float)(center_x-down_x)/half_width,
           (float)(down_y-center_y)/half_height,
@@ -435,7 +435,7 @@ void mouse_drag(int mouse_x, int mouse_y)
         const double speed = 2.0;
         if(axis.norm() != 0)
         {
-          q = 
+          q =
             Quaterniond(
               AngleAxisd(
                 M_PI*axis.norm()/(double)width*speed/2.0,
@@ -446,7 +446,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -565,7 +565,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
 }
 
 int main(int argc, char * argv[])
@@ -638,7 +638,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   init_relative();
@@ -653,7 +653,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
     "igl_trackball,bell_trackball,two-axis-valuator,two-a...-fixed-up");

+ 14 - 14
examples/shadow-mapping/example.cpp

@@ -6,7 +6,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -89,9 +89,9 @@ bool initialize_shadows(
   glGenTextures(1, &shadowMapTexture);
   glBindTexture(GL_TEXTURE_2D, shadowMapTexture);
   glTexImage2D(
-    GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 
+    GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
     factor*windowWidth,
-    factor*windowHeight, 
+    factor*windowHeight,
     0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -103,16 +103,16 @@ bool initialize_shadows(
   glGenFramebuffersEXT(1, &fbo);
   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
   glFramebufferTexture2DEXT(
-    GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, 
+    GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D,
     shadowMapTexture,0);
   // Attach color render buffer
   glGenRenderbuffersEXT(1,&cfbo);
   glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,cfbo);
-  glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, 
+  glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8,
     factor*windowWidth, factor*windowHeight);
   //-------------------------
   //Attach color buffer to FBO
-  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 
+  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
     GL_RENDERBUFFER_EXT, cfbo);
   //-------------------------
   //Does the GPU support current FBO configuration?
@@ -140,7 +140,7 @@ struct Mesh
   Eigen::MatrixXi F;
   Eigen::Affine3d a,da;
   Mesh():V(),N(),F(),a(Eigen::Affine3d::Identity()),da(Eigen::Affine3d::Identity())
-  { 
+  {
     using namespace Eigen;
     Quaterniond r(Eigen::Vector4d::Random());
     Quaterniond i(1,0,0,0);
@@ -368,7 +368,7 @@ void draw_objects()
     draw_mesh(mesh.V,mesh.F,mesh.N);
     glPopMatrix();
   }
-  
+
   // Draw a nice floor
   glPushMatrix();
   {
@@ -451,7 +451,7 @@ void display()
       is_animating = false;
     }
     Quaterniond q;
-    q.coeffs() = 
+    q.coeffs() =
       animation_to_quat.coeffs()*t + animation_from_quat.coeffs()*(1.-t);
     q.normalize();
     copy(q.coeffs().data(),q.coeffs().data()+4,s.camera.rotation);
@@ -496,7 +496,7 @@ void mouse_wheel(int wheel, int direction, int mouse_x, int mouse_y)
       const double a_diff = 1.0;
       s.camera.angle += double(direction)*a_diff;
       const double min_angle = 15.0;
-      s.camera.angle = 
+      s.camera.angle =
         min(90.0,max(min_angle,s.camera.angle));
     }
   }
@@ -596,7 +596,7 @@ void mouse_drag(int mouse_x, int mouse_y)
         Vector3d axis(0,1,0);
         const double speed = 2.0;
         Quaterniond q;
-        q = down_q * 
+        q = down_q *
           Quaterniond(
             AngleAxisd(
               M_PI*((double)(mouse_x-down_x))/(double)width*speed/2.0,
@@ -607,7 +607,7 @@ void mouse_drag(int mouse_x, int mouse_y)
           const double speed = 2.0;
           if(axis.norm() != 0)
           {
-            q = 
+            q =
               Quaterniond(
                 AngleAxisd(
                   M_PI*(mouse_y-down_y)/(double)width*speed/2.0,
@@ -708,7 +708,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -808,7 +808,7 @@ int main(int argc, char * argv[])
       {
         return 1;
       }
-      triangulate(vF,mesh.F);
+      polygon_mesh_to_triangle_mesh(vF,mesh.F);
     }
     init_mesh(mesh);
   }

+ 8 - 8
examples/skeleton/example.cpp

@@ -7,7 +7,7 @@
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -112,7 +112,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -273,7 +273,7 @@ void display()
     T.block(e*(dim+1),0,dim+1,dim) =
       a.matrix().transpose().block(0,0,dim+1,dim);
   }
-  
+
   if(wireframe)
   {
     glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
@@ -434,7 +434,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -524,7 +524,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
 }
 
 bool init_weights(
@@ -554,7 +554,7 @@ bool init_weights(
     return false;
   }
 
-  // compute BBW 
+  // compute BBW
   // Default bbw data and flags
   BBWData bbw_data;
   bbw_data.active_set_params.max_iter = 4;
@@ -641,7 +641,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
 
   readTGF(skel_filename,C,BE);
@@ -674,7 +674,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");

+ 6 - 6
examples/textured-mesh/example.cpp

@@ -17,7 +17,7 @@
 #include <igl/list_to_matrix.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/material_colors.h>
 #include <igl/barycenter.h>
 #include <igl/matlab_format.h>
@@ -101,7 +101,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData)
   using namespace igl;
   const RotationType old_rotation_type = rotation_type;
   rotation_type = *(const RotationType *)(value);
-  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && 
+  if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP &&
     old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP)
   {
     push_undo();
@@ -457,7 +457,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       }
       case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP:
       {
-        // Rotate according to two axis valuator with fixed up vector 
+        // Rotate according to two axis valuator with fixed up vector
         two_axis_valuator_fixed_up(
           width, height,
           2.0,
@@ -494,7 +494,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
         cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
       }
   }
-  
+
   glutPostRedisplay();
 }
 
@@ -532,7 +532,7 @@ int main(int argc, char * argv[])
       cerr<<"Bad V"<<endl;
       return 1;
     }
-    triangulate(vF,F);
+    polygon_mesh_to_triangle_mesh(vF,F);
   }
   if(vTC.size() > 0)
   {
@@ -577,7 +577,7 @@ int main(int argc, char * argv[])
   }
   // Create a tweak bar
   rebar.TwNewBar("TweakBar");
-  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, 
+  rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);

+ 6 - 6
examples/upright/example.cpp

@@ -4,7 +4,7 @@
 // Demonstrates trackball mouse camera control and undo/redo stack with
 // immutable state object (i.e. not with reverse operations).
 //
-// Reads (V,F) from .obj,.off,.wrl files and saves (V,F) to .obj,.off. Any 
+// Reads (V,F) from .obj,.off,.wrl files and saves (V,F) to .obj,.off. Any
 // normals, texture coordinates, etc. in the input file will be ignored and
 // lost in the output file.
 //
@@ -12,7 +12,7 @@
 #include <igl/writeOBJ.h>
 #include <igl/writeOFF.h>
 #include <igl/readWRL.h>
-#include <igl/triangulate.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
 #include <igl/draw_mesh.h>
@@ -184,7 +184,7 @@ void display()
   glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR);
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
-  
+
   draw_mesh(s.V,s.F,s.N);
 
   glDisable(GL_LIGHTING);
@@ -281,7 +281,7 @@ void bake()
   s.V.col(0).array() -= s.Vmid(0);
   s.V.col(1).array() -= s.Vmid(1);
   s.V.col(2).array() -= s.Vmid(2);
-  s.V *= 2./s.bbd; 
+  s.V *= 2./s.bbd;
   s.V = (s.V * s.rot.matrix().transpose()).eval();
 }
 
@@ -433,7 +433,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
     default:
       cout<<"Unknown key command: '"<<key<<"' ("<<int(key)<<")"<<endl;
   }
-  
+
   glutPostRedisplay();
 }
 
@@ -511,7 +511,7 @@ int main(int argc, char * argv[])
     {
       return 1;
     }
-    triangulate(vF,s.F);
+    polygon_mesh_to_triangle_mesh(vF,s.F);
   }
 
   init_relative();

+ 8 - 8
include/igl/triangulate.cpp → include/igl/polygon_mesh_to_triangle_mesh.cpp

@@ -1,14 +1,14 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
-#include "triangulate.h"
+#include "polygon_mesh_to_triangle_mesh.h"
 
 template <typename Index, typename DerivedF>
-IGL_INLINE void igl::triangulate(
+IGL_INLINE void igl::polygon_mesh_to_triangle_mesh(
   const std::vector<std::vector<Index> > & vF,
   Eigen::PlainObjectBase<DerivedF>& F)
 {
@@ -56,5 +56,5 @@ IGL_INLINE void igl::triangulate(
 
 #ifndef IGL_HEADER_ONLY
 // Explicit template instanciation
-template void igl::triangulate<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::polygon_mesh_to_triangle_mesh<int, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 5 - 5
include/igl/triangulate.h → include/igl/polygon_mesh_to_triangle_mesh.h

@@ -1,12 +1,12 @@
 // This file is part of libigl, a simple c++ geometry processing library.
 //
-// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
+// Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@gmail.com>
 //
 // This Source Code Form is subject to the terms of the Mozilla Public License
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_TRIANGULATE_H
-#define IGL_TRIANGULATE_H
+#ifndef IGL_POLYGON_MESH_TO_TRIANGLE_MESH_H
+#define IGL_POLYGON_MESH_TO_TRIANGLE_MESH_H
 #include "igl_inline.h"
 
 #ifndef IGL_NO_EIGEN
@@ -32,13 +32,13 @@ namespace igl
   //   list_to_matrix(vV,V);
   //   triangulate(vF,F);
   template <typename Index, typename DerivedF>
-  IGL_INLINE void triangulate(
+  IGL_INLINE void polygon_mesh_to_triangle_mesh(
     const std::vector<std::vector<Index> > & vF,
     Eigen::PlainObjectBase<DerivedF>& F);
 }
 
 #ifdef IGL_HEADER_ONLY
-#  include "triangulate.cpp"
+#  include "polygon_mesh_to_triangle_mesh.cpp"
 #endif
 
 #endif