浏览代码

subdivision surface tutorial

Former-commit-id: 5997f29c9feb69fa39c82d9a4702905e3106a8fa
Alec Jacobson 8 年之前
父节点
当前提交
5b1f639225

+ 17 - 18
tutorial/711_Subdivision/main.cpp

@@ -12,23 +12,22 @@ int main(int argc, char * argv[])
 {
 {
   using namespace std;
   using namespace std;
   using namespace igl;
   using namespace igl;
-  Eigen::MatrixXi F,UF,LF,FF;
-  Eigen::MatrixXd V,UV,LV,FV;
+  Eigen::MatrixXi OF,F;
+  Eigen::MatrixXd OV,V;
   bool show_swept_volume = false;
   bool show_swept_volume = false;
   read_triangle_mesh(
   read_triangle_mesh(
-      TUTORIAL_SHARED_PATH "/decimated-knight.off",V,F);
+      TUTORIAL_SHARED_PATH "/decimated-knight.off",OV,OF);
+  V = OV;
+  F = OF;
   cout<<R"(Usage:
   cout<<R"(Usage:
-1  Original mesh
-2  In-plane upsampled mesh
-3  Loop subdivided mesh
-4  False barycentric subdivision
+1  Restore Original mesh
+2  Apply In-plane upsampled mesh
+3  Apply Loop subdivided mesh
+4  Apply False barycentric subdivision
 )";
 )";
   igl::viewer::Viewer viewer;
   igl::viewer::Viewer viewer;
   viewer.data.set_mesh(V,F);
   viewer.data.set_mesh(V,F);
   viewer.data.set_face_based(true);
   viewer.data.set_face_based(true);
-  igl::upsample(V,F,UV,UF);
-  igl::loop(V,F,LV,LF);
-  igl::false_barycentric_subdivision(V,F,FV,FF);
 
 
   viewer.callback_key_down =
   viewer.callback_key_down =
     [&](igl::viewer::Viewer & viewer, unsigned char key, int mod)->bool
     [&](igl::viewer::Viewer & viewer, unsigned char key, int mod)->bool
@@ -39,29 +38,29 @@ int main(int argc, char * argv[])
           return false;
           return false;
         case '1':
         case '1':
         {
         {
-          viewer.data.clear();
-          viewer.data.set_mesh(V,F);
+          V = OV;
+          F = OF;
           break;
           break;
         }
         }
         case '2':
         case '2':
         {
         {
-          viewer.data.clear();
-          viewer.data.set_mesh(UV,UF);
+          igl::upsample( Eigen::MatrixXd(V), Eigen::MatrixXi(F), V,F);
           break;
           break;
         }
         }
         case '3':
         case '3':
         {
         {
-          viewer.data.clear();
-          viewer.data.set_mesh(LV,LF);
+          igl::loop( Eigen::MatrixXd(V), Eigen::MatrixXi(F), V,F);
           break;
           break;
         }
         }
         case '4':
         case '4':
         {
         {
-          viewer.data.clear();
-          viewer.data.set_mesh(FV,FF);
+          igl::false_barycentric_subdivision(
+            Eigen::MatrixXd(V),Eigen::MatrixXi(F),V,F);
           break;
           break;
         }
         }
       }
       }
+      viewer.data.clear();
+      viewer.data.set_mesh(V,F);
       viewer.data.set_face_based(true);
       viewer.data.set_face_based(true);
       return true;
       return true;
     };
     };

+ 1 - 0
tutorial/images/decimated-knight-subdivision.gif.REMOVED.git-id

@@ -0,0 +1 @@
+c334c086e2f3ec1de26911b03329804c4ab90ea7

+ 5 - 0
tutorial/style.css

@@ -55,6 +55,11 @@ figcaption
   font-style: italic;
   font-style: italic;
 }
 }
 
 
+figcaption code
+{
+  font-style: normal;
+}
+
 pre, code {
 pre, code {
   font-size: 0.85em;
   font-size: 0.85em;
   font-family: Consolas, Inconsolata, Courier, monospace;
   font-family: Consolas, Inconsolata, Courier, monospace;

+ 1 - 1
tutorial/tutorial.html.REMOVED.git-id

@@ -1 +1 @@
-cd11b42bda4357cfaae8f62d5036f840df5b627d
+2d4017ae4cf96f5ddc6c543c54d15c47418217cb

+ 1 - 1
tutorial/tutorial.md.REMOVED.git-id

@@ -1 +1 @@
-d17b6043e03c640488d1b324beebc066cdc3c830
+86fc9b45d8af903432659f0f871aa865847ac98a