Browse Source

missing file and examples with new dependency namespaces

Former-commit-id: adb26ef69744e9e0809363d1e62eea8c18afe3a5
Alec Jacobson 10 năm trước cách đây
mục cha
commit
7dc6f085c5

+ 1 - 1
examples/MatlabWorkspace/example.cpp

@@ -24,7 +24,7 @@ int main(int argc, char * argv[])
   }
   MatrixXd M;
   readDMAT(argv[1],M);
-  MatlabWorkspace mat;
+  igl::matlab::MatlabWorkspace mat;
   mat.save(M,"M");
   mat.write(argv[2]);
 

+ 2 - 3
examples/ReAntTweakBar/example.cpp

@@ -32,7 +32,6 @@
 
 
 #include <igl/anttweakbar/ReAntTweakBar.h>
-using namespace igl;
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -75,7 +74,7 @@ float g_MatDiffuse[] = { 1.0f, 1.0f, 0.0f, 1.0f };
 double g_LightMultiplier = 1.0f;
 float g_LightDirection[] = { -0.57735f, -0.57735f, -0.57735f };
 
-ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 
 // Routine to set a quaternion from a rotation axis and angle
 // ( input axis = float[3] angle = float  output: quat = float[4] )
@@ -347,7 +346,7 @@ int main(int argc, char *argv[])
     // ShapeEV associates Shape enum values with labels that will be displayed instead of enum values
     TwEnumVal shapeEV[NUM_SHAPES] = { {SHAPE_TEAPOT, "Teapot"}, {SHAPE_TORUS, "Torus"}, {SHAPE_CONE, "Cone"} , {SHAPE_SPHERE, "Sphere"}};
     // Create a type for the enum shapeEV
-    TwType shapeType = ReTwDefineEnum("ShapeType", shapeEV, NUM_SHAPES);
+    TwType shapeType = igl::anttweakbar::ReTwDefineEnum("ShapeType", shapeEV, NUM_SHAPES);
     // add 'g_CurrentShape' to 'bar': this is a variable of type ShapeType. Its key shortcuts are [<] and [>].
     rebar.TwAddVarRW("Shape", shapeType, &g_CurrentShape, " keyIncr='<' keyDecr='>' help='Change object shape.' ");
   }

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

@@ -50,12 +50,12 @@ Eigen::MatrixXd V,N,C,mid;
 Eigen::MatrixXi F;
 // Bounding box diagonal length
 double bbd;
-igl::EmbreeIntersector ei;
+igl::embree::EmbreeIntersector ei;
 // Running ambient occlusion
 Eigen::VectorXd S;
 int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 bool lights_on = true;
 Eigen::Vector4f color(0.4,0.8,0.3,1.0);
 double ao_factor = 1.0;
@@ -156,7 +156,7 @@ void display()
     }
     VectorXd Si;
     const int num_samples = 20;
-    ambient_occlusion(ei,V,N,num_samples,Si);
+    igl::embree::ambient_occlusion(ei,V,N,num_samples,Si);
     S *= (double)tot_num_samples;
     S += Si*(double)num_samples;
     tot_num_samples += num_samples;

+ 28 - 27
examples/arap/example.cpp

@@ -1,39 +1,39 @@
-#include <igl/svd3x3/arap.h>
-#include <igl/writeDMAT.h>
-#include <igl/partition.h>
-#include <igl/harmonic.h>
+#include <igl/Camera.h>
+#include <igl/OpenGL_convenience.h>
+#include <igl/PI.h>
+#include <igl/STR.h>
+#include <igl/arap.h>
+#include <igl/barycenter.h>
 #include <igl/cotmatrix.h>
-#include <igl/massmatrix.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
+#include <igl/harmonic.h>
 #include <igl/invert_diag.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/jet.h>
+#include <igl/list_to_matrix.h>
+#include <igl/massmatrix.h>
+#include <igl/material_colors.h>
+#include <igl/matlab_format.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/partition.h>
+#include <igl/pathinfo.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_vertex_normals.h>
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
-#include <igl/readOBJ.h>
 #include <igl/readDMAT.h>
-#include <igl/readOFF.h>
 #include <igl/readMESH.h>
-#include <igl/jet.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/trackball.h>
-#include <igl/list_to_matrix.h>
+#include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/material_colors.h>
-#include <igl/barycenter.h>
-#include <igl/matlab_format.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeDMAT.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/pathinfo.h>
-#include <igl/Camera.h>
-#include <igl/get_seconds.h>
-#include <igl/PI.h>
-#include <igl/STR.h>
 
 #ifdef __APPLE__
 #  include <GLUT/glut.h>
@@ -141,7 +141,7 @@ int selected_col = 0;
 double bbd;
 int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 
 int num_in_selection(const Eigen::VectorXi & S)
 {
@@ -708,7 +708,8 @@ int main(int argc, char * argv[])
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString(
+     "RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

+ 7 - 7
examples/bbw/main.cpp → examples/bbw/example.cpp

@@ -3,15 +3,15 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readMESH.h>
-#include <igl/tetgen/mesh_with_skeleton.h>
 #include <igl/faces_first.h>
 #include <igl/readTGF.h>
 #include <igl/launch_medit.h>
 #include <igl/boundary_conditions.h>
-#include <igl/bbw/bbw.h>
 #include <igl/writeDMAT.h>
 #include <igl/writeMESH.h>
 #include <igl/normalize_row_sums.h>
+#include <igl/bbw/bbw.h>
+#include <igl/tetgen/mesh_with_skeleton.h>
 
 #include <Eigen/Dense>
 
@@ -231,7 +231,7 @@ int main(int argc, char * argv[])
   MatrixXi TT;
   // New surface faces FF
   MatrixXi FF;
-  if(!mesh_with_skeleton(V,F,C,P,BE,CE,10,VV,TT,FF))
+  if(!igl::tetgen::mesh_with_skeleton(V,F,C,P,BE,CE,10,VV,TT,FF))
   {
     return 1;
   }
@@ -255,12 +255,12 @@ int main(int argc, char * argv[])
 
   // compute BBW 
   // Default bbw data and flags
-  BBWData bbw_data;
-  bbw_data.qp_solver = QP_SOLVER_IGL_ACTIVE_SET;
-  //bbw_data.qp_solver = QP_SOLVER_MOSEK;
+  igl::bbw::BBWData bbw_data;
+  bbw_data.qp_solver = igl::bbw::QP_SOLVER_IGL_ACTIVE_SET;
+  //bbw_data.qp_solver = igl::bbw::QP_SOLVER_MOSEK;
   // Weights matrix
   MatrixXd W;
-  if(!bbw(VV,TT,b,bc,bbw_data,W))
+  if(!igl::bbw::bbw(VV,TT,b,bc,bbw_data,W))
   {
     return 1;
   }

+ 5 - 3
examples/camera/example.cpp

@@ -64,7 +64,7 @@ enum CenterType
 
 int width,height;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 struct State
 {
   std::vector<igl::Camera> cameras;
@@ -666,10 +666,12 @@ int main(int argc, char * argv[])
   // Create a tweak bar
   rebar.TwNewBar("bar");
   TwDefine("bar label='camera' size='200 550' text=light alpha='200' color='68 68 68'");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType","igl_trackball,two_axis_fixed_up");
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString(
+      "RotationType","igl_trackball,two_axis_fixed_up");
   rebar.TwAddVarRW("rotation_type", RotationTypeTW,&rotation_type,
     "keyIncr=] keyDecr=[");
-  TwType CenterTypeTW = ReTwDefineEnumFromString("CenterType","orbit,fps");
+  TwType CenterTypeTW = igl::anttweakbar::ReTwDefineEnumFromString(
+      "CenterType","orbit,fps");
   rebar.TwAddVarRW("center_type", CenterTypeTW,&center_type,
     "keyIncr={ keyDecr=}");
   rebar.TwAddVarRW("rotation", TW_TYPE_QUAT4D,s.cameras[0].m_rotation_conj.coeffs().data(),"");

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

@@ -129,7 +129,7 @@ double bbd;
 Eigen::VectorXd S;
 int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 
 void reshape(int width,int height)
 {
@@ -567,7 +567,7 @@ int main(int argc, char * argv[])
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

+ 19 - 19
examples/components/example.cpp

@@ -1,24 +1,24 @@
-#include <igl/read_triangle_mesh.h>
-#include <igl/init_render_to_texture.h>
-#include <igl/draw_floor.h>
-#include <igl/report_gl_error.h>
-#include <igl/per_face_normals.h>
-#include <igl/trackball.h>
-#include <igl/snap_to_canonical_view_quat.h>
-#include <igl/REDRUM.h>
+#include <igl/C_STR.h>
 #include <igl/Camera.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/REDRUM.h>
+#include <igl/components.h>
+#include <igl/create_shader_program.h>
+#include <igl/draw_floor.h>
 #include <igl/get_seconds.h>
-#include <igl/jet.h>
-#include <igl/rgb_to_hsv.h>
 #include <igl/hsv_to_rgb.h>
+#include <igl/init_render_to_texture.h>
+#include <igl/jet.h>
+#include <igl/per_face_normals.h>
 #include <igl/randperm.h>
-#include <igl/boost/components.h>
-#include <igl/C_STR.h>
-#include <igl/write_triangle_mesh.h>
-#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/read_triangle_mesh.h>
+#include <igl/report_gl_error.h>
+#include <igl/rgb_to_hsv.h>
+#include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/create_shader_program.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/write_triangle_mesh.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -108,7 +108,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 // Forward
 void init_components();
@@ -1050,11 +1050,11 @@ int main(int argc, char * argv[])
   TwDefine("bar label='Components' size='200 550' text=light alpha='200' color='68 68 68'");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-axis-valuator-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
-  TwType CenterTypeTW = ReTwDefineEnumFromString("CenterType","orbit,fps");
+  TwType CenterTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("CenterType","orbit,fps");
   rebar.TwAddVarRW("center_type", CenterTypeTW,&center_type,
     "keyIncr={ keyDecr=}");
 

+ 11 - 11
examples/embree/example.cpp

@@ -1,14 +1,14 @@
-#include <igl/embree/EmbreeIntersector.h>
 #include <igl/OpenGL_convenience.h>
-#include <igl/per_face_normals.h>
-#include <igl/read_triangle_mesh.h>
-#include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
 #include <igl/draw_floor.h>
-#include <igl/unproject.h>
+#include <igl/draw_mesh.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/per_face_normals.h>
 #include <igl/quat_to_mat.h>
-#include <igl/trackball.h>
+#include <igl/read_triangle_mesh.h>
 #include <igl/report_gl_error.h>
+#include <igl/trackball.h>
+#include <igl/unproject.h>
+#include <igl/embree/EmbreeIntersector.h>
 
 #ifdef __APPLE__
 #  include <GLUT/glut.h>
@@ -37,9 +37,9 @@ double bbd;
 // Faces
 Eigen::MatrixXi F;
 // Embree intersection structure
-igl::EmbreeIntersector ei;
+igl::embree::EmbreeIntersector ei;
 // Hits collected
-std::vector<igl::Hit > hits;
+std::vector<igl::embree::Hit > hits;
 // Ray information, "projection screen" corners
 Eigen::Vector3f win_s,s,d,dir,NW,NE,SE,SW;
 // Textures and framebuffers for "projection screen"
@@ -213,7 +213,7 @@ void display()
   // Draw all hits
   glBegin(GL_POINTS);
   glColor3f(0,0.2,0.2);
-  for(vector<igl::Hit>::iterator hit = hits.begin();
+  for(vector<igl::embree::Hit>::iterator hit = hits.begin();
       hit != hits.end();
       hit++)
   {
@@ -327,7 +327,7 @@ void mouse_move(int mouse_x, int mouse_y)
   dir = d-s;
   int num_rays_shot;
   ei.intersectRay(s,dir,hits,num_rays_shot);
-  for(vector<igl::Hit>::iterator hit = hits.begin();
+  for(vector<igl::embree::Hit>::iterator hit = hits.begin();
       hit != hits.end();
       hit++)
   {

+ 0 - 30
examples/example_fun/Makefile

@@ -1,30 +0,0 @@
-.PHONY: all
-
-all: example_static example_header_only
-
-# Shared flags etc.
-include ../Makefile.conf
-
-CFLAGS+=-g
-INC=$(LIBIGL_INC)
-
-STATIC_LIB=-ligl -L../../lib -DIGL_STATIC_LIBRARY
-
-example_static: example_static.o
-	#g++ $(CFLAGS) -o example_static example_static.o $(lib) $(STATIC_LIB) ../../obj/example_fun.o
-	g++ $(CFLAGS) -o example_static example_static.o ../../obj/example_fun.o
-
-example_static.o: example.cpp
-	g++ $(CFLAGS) -c example.cpp -o example_static.o $(INC)
-
-example_header_only: example_header_only.o
-	g++ $(CFLAGS) -o example_header_only example_header_only.o $(lib)
-
-example_header_only.o: example.cpp
-	g++ $(CFLAGS) -c example.cpp -o example_header_only.o $(INC)
-
-clean:
-	rm -f example_static.o
-	rm -f example_static
-	rm -f example_header_only.o
-	rm -f example_header_only

+ 0 - 10
examples/example_fun/README

@@ -1,10 +0,0 @@
-This is a simple example program that shows how to link against the igl static
-library or use the igl library as a headers only library.
-
-
-To Build:
-  make
-
-To Run:
-  ./example_static
-  ./example_header_only

+ 0 - 16
examples/example_fun/example.cpp

@@ -1,16 +0,0 @@
-#include <igl/example_fun.h>
-using namespace igl;
-using namespace std;
-
-int main(int argc, char * argv[])
-{
-  double d = 4.4;
-  example_fun(d);
-  int i = 4;
-  example_fun(i);
-#ifndef IGL_STATIC_LIBRARY
-  const char * s = "string";
-  example_fun(s);
-#endif
-  return 0;
-}

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

@@ -1,30 +1,30 @@
-#include <igl/readOBJ.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
+#include <igl/Camera.h>
+#include <igl/PI.h>
+#include <igl/REDRUM.h>
+#include <igl/STR.h>
 #include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
+#include <igl/lens_flare.h>
 #include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
 #include <igl/material_colors.h>
-#include <igl/trackball.h>
-#include <igl/snap_to_canonical_view_quat.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/PI.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/readMESH.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
+#include <igl/readWRL.h>
 #include <igl/render_to_tga.h>
-#include <igl/STR.h>
-#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/report_gl_error.h>
+#include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/lens_flare.h>
-#include <igl/get_seconds.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -96,7 +96,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 bool is_animating = false;
 double animation_start_time = 0;
@@ -695,7 +695,7 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(),"open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-axis-valuator-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

+ 3 - 4
examples/get_seconds/example.cpp

@@ -1,12 +1,11 @@
-#include <cstdio>
-
 #include <igl/get_seconds.h>
-using namespace igl;
+#include <cstdio>
 #include <cmath>
-using namespace std;
 
 int main(int argc, char * argv[])
 {
+  using namespace igl;
+  using namespace std;
   double start = get_seconds();
   printf("start: %lgs\n",start);
   double lap = start;

+ 23 - 21
examples/intersections/example.cpp

@@ -1,31 +1,31 @@
+#include <igl/Camera.h>
 #include <igl/OpenGL_convenience.h>
-#include <igl/per_face_normals.h>
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
+#include <igl/barycenter.h>
+#include <igl/cat.h>
 #include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
+#include <igl/jet.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
+#include <igl/matlab_format.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
-#include <igl/readOBJ.h>
-#include <igl/writeOBJ.h>
 #include <igl/readDMAT.h>
-#include <igl/readOFF.h>
 #include <igl/readMESH.h>
-#include <igl/jet.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/trackball.h>
-#include <igl/list_to_matrix.h>
+#include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/material_colors.h>
-#include <igl/barycenter.h>
-#include <igl/matlab_format.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/pathinfo.h>
-#include <igl/Camera.h>
-#include <igl/cat.h>
-#include <igl/get_seconds.h>
 #include <igl/cgal/remesh_self_intersections.h>
 #include <igl/cgal/intersect_other.h>
 
@@ -138,7 +138,7 @@ double bbd;
 Eigen::VectorXd S;
 int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 
 void reshape(int width,int height)
 {
@@ -477,6 +477,7 @@ void color_selfintersections(
   Eigen::MatrixXd & C)
 {
   using namespace igl;
+  using namespace igl::cgal;
   using namespace Eigen;
   using namespace std;
   MatrixXd SV;
@@ -506,6 +507,7 @@ void color_intersections(
   Eigen::MatrixXd & D)
 {
   using namespace igl;
+  using namespace igl::cgal;
   using namespace Eigen;
   MatrixXi IF;
   const bool first_only = false;
@@ -663,7 +665,7 @@ int main(int argc, char * argv[])
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

+ 1 - 1
examples/mode/example.cpp

@@ -1,7 +1,7 @@
 // g++ -o main main.cpp -I. -I/usr/local/include/eigen3
+#include <igl/mode.h>
 #include <Eigen/Core>
 #include <iostream>
-#include <igl/mode.h>
 
 using namespace std;
 using namespace igl;

+ 12 - 12
examples/multi-viewport/example.cpp

@@ -1,21 +1,21 @@
+#include <igl/Camera.h>
+#include <igl/EPS.h>
 #include <igl/OpenGL_convenience.h>
-#include <igl/per_face_normals.h>
-#include <igl/read_triangle_mesh.h>
-#include <igl/normalize_row_lengths.h>
+#include <igl/STR.h>
+#include <igl/Viewport.h>
+#include <igl/canonical_quaternions.h>
+#include <igl/draw_beach_ball.h>
 #include <igl/draw_mesh.h>
-#include <igl/unproject.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/per_face_normals.h>
+#include <igl/project.h>
 #include <igl/quat_to_mat.h>
-#include <igl/trackball.h>
+#include <igl/read_triangle_mesh.h>
 #include <igl/report_gl_error.h>
-#include <igl/canonical_quaternions.h>
 #include <igl/snap_to_canonical_view_quat.h>
+#include <igl/trackball.h>
+#include <igl/unproject.h>
 #include <igl/unproject_to_zero_plane.h>
-#include <igl/Camera.h>
-#include <igl/STR.h>
-#include <igl/draw_beach_ball.h>
-#include <igl/Viewport.h>
-#include <igl/project.h>
-#include <igl/EPS.h>
 
 #ifdef __APPLE__
 #  include <OpenGL/gl.h>

+ 32 - 32
examples/patches/example.cpp

@@ -1,37 +1,37 @@
-#include <igl/readOBJ.h>
-#include <igl/readPLY.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
-#include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
-#include <igl/material_colors.h>
-#include <igl/trackball.h>
-#include <igl/snap_to_canonical_view_quat.h>
-#include <igl/REDRUM.h>
+#include <igl/C_STR.h>
 #include <igl/Camera.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/REDRUM.h>
+#include <igl/bfs_orient.h>
+#include <igl/components.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
-#include <igl/randperm.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
 #include <igl/normalize_row_lengths.h>
-#include <igl/boost/components.h>
-#include <igl/boost/bfs_orient.h>
 #include <igl/orient_outward.h>
-#include <igl/embree/reorient_facets_raycast.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/randperm.h>
+#include <igl/readMESH.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
+#include <igl/readPLY.h>
+#include <igl/readWRL.h>
+#include <igl/report_gl_error.h>
+#include <igl/snap_to_canonical_view_quat.h>
+#include <igl/snap_to_fixed_up.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
 #include <igl/unique_simplices.h>
-#include <igl/C_STR.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/write_triangle_mesh.h>
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/snap_to_fixed_up.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/embree/reorient_facets_raycast.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -121,7 +121,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 // Forward
 void init_patches();
@@ -578,7 +578,7 @@ void init_patches()
     case ORIENT_METHOD_AO:
     {
       cout<<"orient_outward_ao()"<<endl;
-      reorient_facets_raycast(V,F,F,I);
+      igl::embree::reorient_facets_raycast(V,F,F,I);
       break;
     }
     case ORIENT_METHOD_OUTWARD:
@@ -807,14 +807,14 @@ int main(int argc, char * argv[])
   TwDefine("bar label='Patches' size='200 550' text=light alpha='200' color='68 68 68'");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-axis-valuator-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
-  TwType CenterTypeTW = ReTwDefineEnumFromString("CenterType","orbit,fps");
+  TwType CenterTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("CenterType","orbit,fps");
   rebar.TwAddVarRW("center_type", CenterTypeTW,&center_type,
     "keyIncr={ keyDecr=}");
-  TwType OrientMethodTW = ReTwDefineEnumFromString("OrientMethod",
+  TwType OrientMethodTW = igl::anttweakbar::ReTwDefineEnumFromString("OrientMethod",
     "outward,ambient-occlusion");
   rebar.TwAddVarCB( "orient_method", OrientMethodTW,
     set_orient_method,get_orient_method,NULL,"keyIncr=< keyDecr=>");

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

@@ -1,27 +1,27 @@
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/readOBJ.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
+#include <igl/Camera.h>
+#include <igl/REDRUM.h>
 #include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
 #include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
 #include <igl/material_colors.h>
-#include <igl/trackball.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/random_points_on_mesh.h>
+#include <igl/readMESH.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
+#include <igl/readWRL.h>
+#include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/get_seconds.h>
-#include <igl/random_points_on_mesh.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -88,7 +88,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 void push_undo()
 {
@@ -589,7 +589,7 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

+ 2 - 2
examples/render_to_png/example.cpp

@@ -1,6 +1,6 @@
 #include <igl/get_seconds.h>
-#include <igl/png/render_to_png.h>
 #include <igl/material_colors.h>
+#include <igl/png/render_to_png.h>
 
 #ifdef __APPLE__
 #   include <GLUT/glut.h>
@@ -94,7 +94,7 @@ void Display(void)
   {
     stringstream padnum; 
     padnum << "render_to_png-example-" << setw(4) << setfill('0') << capture_count++ << ".png";
-    render_to_png(padnum.str(),width,height);
+    igl::png::render_to_png(padnum.str(),width,height);
     capture_on_next = false;
   }
   

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

@@ -1,28 +1,28 @@
+#include <igl/Camera.h>
+#include <igl/REDRUM.h>
 #include <igl/RotateWidget.h>
-#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/readMESH.h>
 #include <igl/readOBJ.h>
+#include <igl/readOFF.h>
 #include <igl/readTGF.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
-#include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
-#include <igl/material_colors.h>
-#include <igl/trackball.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/get_seconds.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -94,7 +94,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 void push_undo()
 {
@@ -616,7 +616,7 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");

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

@@ -3,29 +3,29 @@
 
 #include "trackball.h"
 
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/readOBJ.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
+#include <igl/Camera.h>
+#include <igl/REDRUM.h>
 #include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
 #include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
 #include <igl/material_colors.h>
-#include <igl/trackball.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/readMESH.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
+#include <igl/readWRL.h>
+#include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/get_seconds.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -101,7 +101,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 void push_undo()
 {
@@ -662,11 +662,11 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,bell_trackball,two-axis-valuator,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
-  TwType CenterTypeTW = ReTwDefineEnumFromString("CenterType","orbit,fps");
+  TwType CenterTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("CenterType","orbit,fps");
   rebar.TwAddVarRW("center_type", CenterTypeTW,&center_type,
     "keyIncr={ keyDecr=}");
   rebar.load(REBAR_NAME);

+ 22 - 25
examples/shadow-mapping/example.cpp

@@ -1,36 +1,33 @@
 // Small GLUT application to test shadow mapping for closed shapes
 //
 
-#include <igl/readOBJ.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
-#include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
-#include <igl/material_colors.h>
-#include <igl/trackball.h>
-#include <igl/snap_to_canonical_view_quat.h>
+#include <igl/C_STR.h>
 #include <igl/REDRUM.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
-#include <igl/randperm.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
 #include <igl/normalize_row_lengths.h>
-#include <igl/boost/components.h>
-#include <igl/boost/bfs_orient.h>
 #include <igl/orient_outward.h>
-//#include <igl/embree/orient_outward_ao.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/randperm.h>
+#include <igl/readMESH.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
+#include <igl/readWRL.h>
+#include <igl/report_gl_error.h>
+#include <igl/snap_to_canonical_view_quat.h>
+#include <igl/trackball.h>
 #include <igl/unique_simplices.h>
-#include <igl/C_STR.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/write_triangle_mesh.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -203,7 +200,7 @@ bool is_view_from_light = false;
 Eigen::Vector4f light_pos(9,9,1,1);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 // Forward
 void init_mesh();
@@ -840,7 +837,7 @@ int main(int argc, char * argv[])
   TwDefine("bar label='Shadow Mapping' size='200 550' text=light alpha='200' color='68 68 68'");
   rebar.TwAddVarRW("camera_zoom", TW_TYPE_DOUBLE,&s.camera.zoom,"");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,s.camera.rotation.coeffs().data(),"");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType","igl_trackball,two_axis_fixed_up");
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType","igl_trackball,two_axis_fixed_up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
   rebar.TwAddVarRW( "is_view_from_light",TW_TYPE_BOOLCPP,&is_view_from_light,

+ 41 - 41
examples/skeleton-builder/example.cpp

@@ -1,46 +1,46 @@
-#include <igl/draw_skeleton_vector_graphics.h>
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/read_triangle_mesh.h>
-#include <igl/readTGF.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
-#include <igl/report_gl_error.h>
-#include <igl/draw_mesh.h>
+#include <igl/Camera.h>
+#include <igl/REDRUM.h>
+#include <igl/REDRUM.h>
+#include <igl/adjacency_list.h>
+#include <igl/adjacency_matrix.h>
+#include <igl/boundary_conditions.h>
+#include <igl/centroid.h>
+#include <igl/colon.h>
 #include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
+#include <igl/draw_mesh.h>
+#include <igl/draw_skeleton_3d.h>
+#include <igl/draw_skeleton_vector_graphics.h>
+#include <igl/file_exists.h>
+#include <igl/forward_kinematics.h>
+#include <igl/get_seconds.h>
+#include <igl/lbs_matrix.h>
 #include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
 #include <igl/material_colors.h>
-#include <igl/trackball.h>
-#include <igl/snap_to_canonical_view_quat.h>
-#include <igl/snap_to_fixed_up.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/get_seconds.h>
-#include <igl/forward_kinematics.h>
-#include <igl/boundary_conditions.h>
+#include <igl/matlab_format.h>
 #include <igl/normalize_row_sums.h>
-#include <igl/lbs_matrix.h>
-#include <igl/sort_triangles.h>
-#include <igl/slice.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
 #include <igl/project.h>
-#include <igl/unproject.h>
-#include <igl/embree/EmbreeIntersector.h>
-#include <igl/embree/unproject_in_mesh.h>
-#include <igl/matlab_format.h>
+#include <igl/quat_to_mat.h>
+#include <igl/readTGF.h>
+#include <igl/read_triangle_mesh.h>
 #include <igl/remove_unreferenced.h>
-#include <igl/adjacency_list.h>
-#include <igl/adjacency_matrix.h>
+#include <igl/report_gl_error.h>
 #include <igl/right_axis.h>
-#include <igl/colon.h>
+#include <igl/slice.h>
+#include <igl/snap_to_canonical_view_quat.h>
+#include <igl/snap_to_fixed_up.h>
+#include <igl/sort_triangles.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
 #include <igl/unique.h>
-#include <igl/REDRUM.h>
+#include <igl/unproject.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/writeTGF.h>
-#include <igl/file_exists.h>
-#include <igl/centroid.h>
-#include <igl/draw_skeleton_3d.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/embree/EmbreeIntersector.h>
+#include <igl/embree/unproject_in_mesh.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -127,8 +127,8 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
-igl::EmbreeIntersector ei;
+igl::anttweakbar::ReTwBar rebar;
+igl::embree::EmbreeIntersector ei;
 
 void push_undo()
 {
@@ -668,7 +668,7 @@ void mouse_drag(int mouse_x, int mouse_y)
       s.C.conservativeResize(s.C.rows()+2,3);
       const int nc = s.C.rows();
       Vector3d obj;
-      int nhits = unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
+      int nhits = igl::embree::unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
       if(nhits == 0)
       {
         Vector3d pV_mid = project(Vcen);
@@ -688,7 +688,7 @@ void mouse_drag(int mouse_x, int mouse_y)
     }
     double z = 0;
     Vector3d obj,win;
-    int nhits = unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
+    int nhits = igl::embree::unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
     project(obj,win);
     z = win(2);
 
@@ -1016,7 +1016,7 @@ void key(unsigned char key, int mouse_x, int mouse_y)
       {
         Vector3d P = project((Vector3d)s.C.row(c));
         Vector3d obj;
-        int nhits = unproject_in_mesh(P(0),P(1),ei,obj);
+        int nhits = igl::embree::unproject_in_mesh(P(0),P(1),ei,obj);
         if(nhits > 0)
         {
           s.C.row(c) = obj;
@@ -1148,13 +1148,13 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
   rebar.TwAddVarRW("skeleton_on_top", TW_TYPE_BOOLCPP,&skeleton_on_top,"key=O");
   rebar.TwAddVarRW("wireframe", TW_TYPE_BOOLCPP,&wireframe,"key=l");
-  TwType SkelStyleTypeTW = ReTwDefineEnumFromString("SkelStyleType",
+  TwType SkelStyleTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("SkelStyleType",
     "3d,vector-graphics");
   rebar.TwAddVarRW("style",SkelStyleTypeTW,&skel_style,"");
   rebar.TwAddVarRW("alpha",TW_TYPE_DOUBLE,&alpha,

+ 18 - 18
examples/skeleton-poser/example.cpp

@@ -1,15 +1,12 @@
 #include <igl/Camera.h>
 #include <igl/MouseController.h>
 #include <igl/REDRUM.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
 #include <igl/STR.h>
 #include <igl/barycenter.h>
-#include <igl/bbw/bbw.h>
 #include <igl/bone_parents.h>
 #include <igl/boundary_conditions.h>
 #include <igl/boundary_facets.h>
 #include <igl/centroid.h>
-#include <igl/cgal/remesh_self_intersections.h>
 #include <igl/colon.h>
 #include <igl/draw_beach_ball.h>
 #include <igl/draw_floor.h>
@@ -20,6 +17,7 @@
 #include <igl/get_seconds.h>
 #include <igl/lbs_matrix.h>
 #include <igl/material_colors.h>
+#include <igl/next_filename.h>
 #include <igl/normalize_row_sums.h>
 #include <igl/pathinfo.h>
 #include <igl/per_face_normals.h>
@@ -31,18 +29,20 @@
 #include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/tetgen/mesh_with_skeleton.h>
-#include <igl/tetgen/tetrahedralize.h>
 #include <igl/trackball.h>
 #include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/volume.h>
 #include <igl/winding_number.h>
 #include <igl/writeDMAT.h>
-#include <igl/writeOBJ.h>
 #include <igl/writeMESH.h>
+#include <igl/writeOBJ.h>
 #include <igl/writeOFF.h>
 #include <igl/writeTGF.h>
-#include <igl/next_filename.h>
-#include <igl/volume.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
+#include <igl/bbw/bbw.h>
+#include <igl/cgal/remesh_self_intersections.h>
+#include <igl/tetgen/mesh_with_skeleton.h>
+#include <igl/tetgen/tetrahedralize.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -144,7 +144,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 void push_undo()
 {
@@ -770,7 +770,7 @@ bool clean(
 #ifdef VERBOSE
     cout<<"remesh_self_intersections"<<endl;
 #endif
-    remesh_self_intersections(V,F,{},CV,CF,_1,_2,IM);
+    igl::cgal::remesh_self_intersections(V,F,{},CV,CF,_1,_2,IM);
     for_each(CF.data(),CF.data()+CF.size(),[&IM](int & a){a=IM(a);});
     MatrixXd oldCV = CV;
     MatrixXi oldCF = CF;
@@ -786,7 +786,7 @@ bool clean(
 #ifdef VERBOSE
     cout<<"tetrahedralize"<<endl;
 #endif
-    if(tetrahedralize(CV,CF,"cYpC",TV,TT,_1) != 0)
+    if(igl::tetgen::tetrahedralize(CV,CF,"cYpC",TV,TT,_1) != 0)
     {
       cout<<REDRUM("CDT failed.")<<endl;
       return false;
@@ -843,7 +843,7 @@ bool robust_weights(
 #ifdef VERBOSE
     cout<<"mesh_with_skeleton"<<endl;
 #endif
-    if(!mesh_with_skeleton(CV,CF,C,{},BE,{},10,"pq1.5Y",TV,TT,_1))
+    if(!igl::tetgen::mesh_with_skeleton(CV,CF,C,{},BE,{},10,"pq1.5Y",TV,TT,_1))
     {
       cout<<REDRUM("tetgen failed.")<<endl;
       return false;
@@ -879,17 +879,17 @@ bool robust_weights(
   }
   // compute BBW
   // Default bbw data and flags
-  BBWData bbw_data;
+  igl::bbw::BBWData bbw_data;
   bbw_data.verbosity = 1;
 #ifdef IGL_NO_MOSEK
-  bbw_data.qp_solver = QP_SOLVER_IGL_ACTIVE_SET;
+  bbw_data.qp_solver = igl::bbw::QP_SOLVER_IGL_ACTIVE_SET;
   bbw_data.active_set_params.max_iter = 4;
 #else
   bbw_data.mosek_data.douparam[MSK_DPAR_INTPNT_TOL_REL_GAP]=1e-14;
-  bbw_data.qp_solver = QP_SOLVER_MOSEK;
+  bbw_data.qp_solver = igl::bbw::QP_SOLVER_MOSEK;
 #endif
   // Weights matrix
-  if(!bbw(TV,TT,b,bc,bbw_data,W))
+  if(!igl::bbw::bbw(TV,TT,b,bc,bbw_data,W))
   {
     return false;
   }
@@ -996,14 +996,14 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
   rebar.TwAddVarRW("wireframe", TW_TYPE_BOOLCPP,&wireframe,"key=l");
   rebar.TwAddVarRW("centroid_is_visible", TW_TYPE_BOOLCPP,&centroid_is_visible,
     "keyIncr=C keyDecr=c label='centroid visible?'");
-  TwType SkelStyleTypeTW = ReTwDefineEnumFromString("SkelStyleType",
+  TwType SkelStyleTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("SkelStyleType",
     "3d,vector-graphics");
   rebar.TwAddVarRW("style",SkelStyleTypeTW,&skel_style,"");
   rebar.load(REBAR_NAME);

+ 28 - 28
examples/skeleton/example.cpp

@@ -1,35 +1,35 @@
+#include <igl/Camera.h>
+#include <igl/REDRUM.h>
+#include <igl/boundary_conditions.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
 #include <igl/draw_skeleton_3d.h>
 #include <igl/draw_skeleton_vector_graphics.h>
-#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/forward_kinematics.h>
+#include <igl/get_seconds.h>
+#include <igl/lbs_matrix.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
+#include <igl/normalize_row_sums.h>
+#include <igl/pathinfo.h>
+#include <igl/per_face_normals.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
+#include <igl/quat_to_mat.h>
+#include <igl/readMESH.h>
 #include <igl/readOBJ.h>
+#include <igl/readOFF.h>
 #include <igl/readTGF.h>
-#include <igl/writeOBJ.h>
-#include <igl/writeOFF.h>
 #include <igl/readWRL.h>
 #include <igl/report_gl_error.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/readOFF.h>
-#include <igl/readMESH.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
-#include <igl/pathinfo.h>
-#include <igl/list_to_matrix.h>
-#include <igl/quat_to_mat.h>
-#include <igl/per_face_normals.h>
-#include <igl/material_colors.h>
-#include <igl/trackball.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/REDRUM.h>
-#include <igl/Camera.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/writeOBJ.h>
+#include <igl/writeOFF.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/get_seconds.h>
-#include <igl/forward_kinematics.h>
-#include <igl/tetgen/mesh_with_skeleton.h>
-#include <igl/boundary_conditions.h>
-#include <igl/normalize_row_sums.h>
-#include <igl/lbs_matrix.h>
 #include <igl/bbw/bbw.h>
+#include <igl/tetgen/mesh_with_skeleton.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -106,7 +106,7 @@ int width,height;
 Eigen::Vector4f light_pos(-0.1,-0.1,0.9,0);
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar;
+igl::anttweakbar::ReTwBar rebar;
 
 void push_undo()
 {
@@ -556,7 +556,7 @@ bool init_weights(
   MatrixXd VV;
   MatrixXi TT,FF,CE;
   VectorXi P;
-  if(!mesh_with_skeleton(V,F,C,P,BE,CE,10,VV,TT,FF))
+  if(!igl::tetgen::mesh_with_skeleton(V,F,C,P,BE,CE,10,VV,TT,FF))
   {
     return false;
   }
@@ -571,10 +571,10 @@ bool init_weights(
 
   // compute BBW
   // Default bbw data and flags
-  BBWData bbw_data;
+  igl::bbw::BBWData bbw_data;
   bbw_data.active_set_params.max_iter = 4;
   // Weights matrix
-  if(!bbw(VV,TT,b,bc,bbw_data,W))
+  if(!igl::bbw::bbw(VV,TT,b,bc,bbw_data,W))
   {
     return false;
   }
@@ -691,13 +691,13 @@ int main(int argc, char * argv[])
   rebar.TwNewBar("TweakBar");
   rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
   rebar.TwAddVarRW("skeleton_on_top", TW_TYPE_BOOLCPP,&skeleton_on_top,"key=O");
   rebar.TwAddVarRW("wireframe", TW_TYPE_BOOLCPP,&wireframe,"key=l");
-  TwType SkelStyleTypeTW = ReTwDefineEnumFromString("SkelStyleType",
+  TwType SkelStyleTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("SkelStyleType",
     "3d,vector-graphics");
   rebar.TwAddVarRW("style",SkelStyleTypeTW,&skel_style,"key=s");
   rebar.load(REBAR_NAME);

+ 0 - 23
examples/svd/Makefile

@@ -1,23 +0,0 @@
-.PHONY: all
-
-# Shared flags etc.
-include ../Makefile.conf
-
-all: example
-
-.PHONY: example
-
-igl_lib=../../
-
-CFLAGS+=-g
-inc=$(LIBIGL_INC) 
-lib=$(LIBIGL_LIB) -framework Accelerate
-
-example: example.o
-	g++ $(CFLAGS) -o example example.o $(lib)
-
-example.o: example.cpp
-	g++ $(CFLAGS) -c example.cpp -o example.o $(inc)
-clean:
-	rm -f example.o
-	rm -f example

+ 0 - 97
examples/svd/example.cpp

@@ -1,97 +0,0 @@
-int main(){}
-//#include <igl/svd.h>
-//#include <cstdlib>
-//#include <Accelerate/Accelerate.h>
-//#include <cstdio>
-//
-///* Auxiliary routines prototypes */
-//extern void print_matrix( char* desc, int m, int n, double* a, int lda );
-//
-///* Parameters */
-//
-//void print3x3(const char * s, double * a)
-//{
-//  printf("%s =\n",s);
-//  for(int i = 0;i<3;i++)
-//  {
-//    for(int j = 0;j<3;j++)
-//    {
-//      printf("%g ",a[j*3+i]);
-//    }
-//    printf("\n");
-//  }
-//  printf("\n");
-//}
-//
-//int main(int argc, char * argv[])
-//{
-//  //// List of rest positions
-//  ////        (0,1)
-//  ////         / \
-//  ////        /   \
-//  ////       /     \
-//  ////      /       \
-//  ////  (-1,0)-----(1,0)
-//  ////
-//  //double rest[3][3] = {
-//  //  {-1,0,0},
-//  //  {1,0,0},
-//  //  {0,1,0}};
-//  //// List of pose positions
-//  //// 
-//  //// (0,1)
-//  ////  |   \
-//  ////  |    \
-//  ////  |     (1,0)
-//  ////  |    /
-//  ////  |   /
-//  //// (0,-1)
-//  //double pose[3][3] = {
-//  //  {0,1,0},
-//  //  {0,-1,0},
-//  //  {1,0,0}};
-//  //// Compute covariance matrix C
-//  //double C[3*3];
-//  //// Initialize to zero
-//  //for(int i = 0;i<3*3;i++)
-//  //{
-//  //  C[i] = 0;
-//  //}
-//
-//  //// Loop over vertices
-//  //for(int i = 0;i<3;i++)
-//  //{
-//  //  // Compute outer product rest[i] * pose[i]
-//  //  // Loop over coordinates
-//  //  for(int j = 0;j<3;j++)
-//  //  {
-//  //    // Loop over coordinates
-//  //    for(int k = 0;k<3;k++)
-//  //    {
-//  //      C[k*3+j] = rest[i][j] * pose[i][k];
-//  //    }
-//  //  }
-//  //}
-//  //print3x3("C",C);
-//
-//
-//  //
-//  //double C[3*3] = {8,3,4,1,5,9,6,7,2};
-//  double C[3*3] = {5242.55,3364,-0,-8170.15,-5242.56,0,-0,-0,0};
-//  double u[3*3],s[3],vt[3*3];
-//  print3x3("C",C);
-//  // Compute SVD of C
-//  igl::svd3x3(C,u,s,vt);
-//  print3x3("u",u);
-//  print3x3("vt",vt);
-//
-//  // Compute R = u*vt
-//  double R[3*3];
-//  const double _3 = 3;
-//  const double _1 = 1;
-//  cblas_dgemm(CblasColMajor, CblasNoTrans,CblasNoTrans,3,3,3,1,u,3,vt,3,1,R,3);
-//  print3x3("RT (transposed to be row-major)",R);
-//
-//
-//  return 0;
-//}

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

@@ -1,34 +1,34 @@
+#include <igl/Camera.h>
 #include <igl/OpenGL_convenience.h>
+#include <igl/STR.h>
+#include <igl/barycenter.h>
+#include <igl/draw_floor.h>
+#include <igl/draw_mesh.h>
+#include <igl/get_seconds.h>
+#include <igl/jet.h>
+#include <igl/list_to_matrix.h>
+#include <igl/material_colors.h>
+#include <igl/matlab_format.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/pathinfo.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_vertex_normals.h>
-#include <igl/two_axis_valuator_fixed_up.h>
-#include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
+#include <igl/polygon_mesh_to_triangle_mesh.h>
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
-#include <igl/readOBJ.h>
 #include <igl/readDMAT.h>
-#include <igl/readOFF.h>
 #include <igl/readMESH.h>
-#include <igl/jet.h>
+#include <igl/readOBJ.h>
+#include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/trackball.h>
-#include <igl/list_to_matrix.h>
+#include <igl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/polygon_mesh_to_triangle_mesh.h>
-#include <igl/material_colors.h>
-#include <igl/barycenter.h>
-#include <igl/matlab_format.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/pathinfo.h>
-#include <igl/Camera.h>
-#include <igl/get_seconds.h>
 #include <igl/texture_from_tga.h>
+#include <igl/trackball.h>
+#include <igl/two_axis_valuator_fixed_up.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
 #include <igl/png/texture_from_file.h>
-#include <igl/png/texture_from_png.h>
-#include <igl/STR.h>
+
 #include <YImage.hpp>
 
 #ifdef __APPLE__
@@ -135,7 +135,7 @@ double bbd;
 Eigen::VectorXd S;
 int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 bool flip_y = false;
 bool rotate_xy = false;
 
@@ -581,7 +581,7 @@ int main(int argc, char * argv[])
     s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
   s.camera.push_away(3);
   s.camera.dolly_zoom(25-s.camera.m_angle);
-  TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
+  TwType RotationTypeTW = igl::anttweakbar::ReTwDefineEnumFromString("RotationType",
     "igl_trackball,two-a...-fixed-up");
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
@@ -615,7 +615,7 @@ int main(int argc, char * argv[])
 
 
   // Must be called after opengl context is initialized
-  if(!texture_from_file(tfilename,tex_id))
+  if(!igl::png::texture_from_file(tfilename,tex_id))
   {
     return 1;
   }

+ 12 - 13
examples/transparency/example.cpp

@@ -1,23 +1,22 @@
+#include <igl/EPS.h>
 #include <igl/OpenGL_convenience.h>
-#include <igl/per_face_normals.h>
-#include <igl/read_triangle_mesh.h>
-#include <igl/normalize_row_lengths.h>
+#include <igl/colon.h>
+#include <igl/draw_floor.h>
 #include <igl/draw_mesh.h>
 #include <igl/jet.h>
 #include <igl/material_colors.h>
-#include <igl/draw_floor.h>
-#include <igl/unproject.h>
+#include <igl/matlab_format.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/per_face_normals.h>
 #include <igl/quat_to_mat.h>
-#include <igl/trackball.h>
+#include <igl/read_triangle_mesh.h>
 #include <igl/report_gl_error.h>
-#include <igl/matlab_format.h>
-#include <igl/colon.h>
-#include <igl/slice.h>
 #include <igl/report_gl_error.h>
-#include <igl/anttweakbar/ReAntTweakBar.h>
-#include <igl/EPS.h>
-#define IGL_HEADER_ONLY
+#include <igl/slice.h>
 #include <igl/sort_triangles.h>
+#include <igl/trackball.h>
+#include <igl/unproject.h>
+#include <igl/anttweakbar/ReAntTweakBar.h>
 
 #ifdef __APPLE__
 #  include <GLUT/glut.h>
@@ -50,7 +49,7 @@ Eigen::MatrixXi F,sorted_F;
 double alpha = 0.2;
 
 #define REBAR_NAME "temp.rbr"
-igl::ReTwBar rebar; // Pointer to the tweak bar
+igl::anttweakbar::ReTwBar rebar; // Pointer to the tweak bar
 
 void reshape(int width,int height)
 {

+ 372 - 0
include/igl/ConjugateFFSolverData.h

@@ -0,0 +1,372 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2013 Olga Diamanti, 2015 Alec Jacobson
+//
+// 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_CONJUGATE_FF_SOLVER_DATA_H
+#define IGL_CONJUGATE_FF_SOLVER_DATA_H
+#include "igl_inline.h"
+#include <Eigen/Core>
+#include <Eigen/Sparse>
+
+namespace igl {
+  template <typename DerivedV, typename DerivedF>
+  class ConjugateFFSolverData
+  {
+    public:
+      const Eigen::PlainObjectBase<DerivedV> &V; int numV;
+      const Eigen::PlainObjectBase<DerivedF> &F; int numF;
+
+      Eigen::MatrixXi EV; int numE;
+      Eigen::MatrixXi F2E;
+      Eigen::MatrixXi E2F;
+      Eigen::VectorXd K;
+
+      Eigen::VectorXi isBorderEdge;
+      int numInteriorEdges;
+      Eigen::Matrix<int,Eigen::Dynamic,2> E2F_int;
+      Eigen::VectorXi indInteriorToFull;
+      Eigen::VectorXi indFullToInterior;
+
+      Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
+
+
+      Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,1> kmin, kmax;
+      Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,2> dmin, dmax;
+      Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,3> dmin3, dmax3;
+
+      Eigen::VectorXd nonPlanarityMeasure;
+      Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > planarityWeight;
+
+      //conjugacy matrix
+      std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,4> > H;
+
+      //conjugacy matrix eigenvectors and (scaled) eigenvalues
+      std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,4> > UH;
+      std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,1> > s;
+
+      //laplacians
+      Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> DDA, DDB;
+
+  private:
+    IGL_INLINE void computeCurvatureAndPrincipals();
+    IGL_INLINE void precomputeConjugacyStuff();
+    IGL_INLINE void computeLaplacians();
+    IGL_INLINE void computek();
+    IGL_INLINE void computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D);
+
+    IGL_INLINE void precomputeInteriorEdges();
+
+public:
+    IGL_INLINE ConjugateFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
+                                   const Eigen::PlainObjectBase<DerivedF> &_F);
+    IGL_INLINE void evaluateConjugacy(const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvU,
+                                      const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvV,
+                                      Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &conjValues) const ;
+  };
+}
+
+#include <igl/colon.h>
+#include <igl/edge_topology.h>
+#include <igl/false_barycentric_subdivision.h>
+#include <igl/local_basis.h>
+#include <igl/principal_curvature.h>
+#include <igl/sparse.h>
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE igl::ConjugateFFSolverData<DerivedV, DerivedF>::
+ConjugateFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
+                  const Eigen::PlainObjectBase<DerivedF> &_F):
+V(_V),
+numV(_V.rows()),
+F(_F),
+numF(_F.rows())
+{
+  igl::edge_topology(V,F,EV,F2E,E2F);
+  numE = EV.rows();
+
+  precomputeInteriorEdges();
+
+  igl::local_basis(V,F,B1,B2,FN);
+
+  computek();
+
+  computeLaplacians();
+
+  computeCurvatureAndPrincipals();
+  precomputeConjugacyStuff();
+
+};
+
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::computeCurvatureAndPrincipals()
+{
+  Eigen::MatrixXd VCBary;
+  Eigen::MatrixXi FCBary;
+
+  VCBary.setZero(numV+numF,3);
+  FCBary.setZero(3*numF,3);
+  igl::false_barycentric_subdivision(V, F, VCBary, FCBary);
+
+  Eigen::MatrixXd dmax3_,dmin3_;
+  igl::principal_curvature(VCBary, FCBary, dmax3_, dmin3_, kmax, kmin, 5,true);
+
+  dmax3 = dmax3_.bottomRows(numF);
+  dmin3 = dmin3_.bottomRows(numF);
+
+  kmax = kmax.bottomRows(numF);
+  kmin = kmin.bottomRows(numF);
+
+  //  kmax = dmax3.rowwise().norm();
+  //  kmin = dmin3.rowwise().norm();
+
+  dmin3.rowwise().normalize();
+  dmax3.rowwise().normalize();
+  dmax.setZero(numF,2);
+  dmin.setZero(numF,2);
+  for (int i= 0; i <numF; ++i)
+  {
+    if(kmin[i] != kmin[i] || kmax[i] != kmax[i] || (dmin3.row(i).array() != dmin3.row(i).array()).any() || (dmax3.row(i).array() != dmax3.row(i).array()).any())
+    {
+      kmin[i] = 0;
+      kmax[i] = 0;
+      dmin3.row(i) = B1.row(i);
+      dmax3.row(i) = B2.row(i);
+    }
+    else
+    {
+      dmax3.row(i) = (dmax3.row(i) - (dmax3.row(i).dot(FN.row(i)))*FN.row(i)).normalized();
+      dmin3.row(i) = dmin3.row(i) - (dmin3.row(i).dot(FN.row(i)))*FN.row(i);
+      dmin3.row(i) = (dmin3.row(i) - (dmin3.row(i).dot(dmax3.row(i)))*dmax3.row(i)).normalized();
+      if ((dmin3.row(i).cross(dmax3.row(i))).dot(FN.row(i))<0)
+        dmin3.row(i) = -dmin3.row(i);
+    }
+    dmax.row(i) << dmax3.row(i).dot(B1.row(i)), dmax3.row(i).dot(B2.row(i));
+    dmax.row(i).normalize();
+    dmin.row(i) << dmin3.row(i).dot(B1.row(i)), dmin3.row(i).dot(B2.row(i));
+    dmin.row(i).normalize();
+
+  }
+
+  nonPlanarityMeasure = kmax.cwiseAbs().array()*kmin.cwiseAbs().array();
+  typename DerivedV::Scalar minP = nonPlanarityMeasure.minCoeff();
+  typename DerivedV::Scalar maxP = nonPlanarityMeasure.maxCoeff();
+  nonPlanarityMeasure = (nonPlanarityMeasure.array()-minP)/(maxP-minP);
+  Eigen::VectorXi I = igl::colon<typename DerivedF::Scalar>(0, numF-1);
+  igl::sparse(I, I, nonPlanarityMeasure, numF, numF, planarityWeight);
+
+}
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::precomputeConjugacyStuff()
+{
+  H.resize(numF);
+  UH.resize(numF);
+  s.resize(numF);
+
+  for (int i = 0; i<numF; ++i)
+  {
+    //compute conjugacy matrix
+    typename DerivedV::Scalar e1x = dmin(i,0), e1y = dmin(i,1), e2x = dmax(i,0), e2y = dmax(i,1), k1 = kmin[i], k2 = kmax[i];
+
+    H[i]<<
+    0,          0, k1*e1x*e1x, k1*e1x*e1y,
+    0,          0, k1*e1x*e1y, k1*e1y*e1y,
+    k2*e2x*e2x, k2*e2x*e2y,          0,          0,
+    k2*e2x*e2y, k2*e2y*e2y,          0,          0;
+    Eigen::Matrix<typename DerivedV::Scalar, 4, 4> Ht = H[i].transpose();
+    H[i] = .5*(H[i]+Ht);
+
+    Eigen::EigenSolver<Eigen::Matrix<typename DerivedV::Scalar, 4, 4> > es(H[i]);
+    s[i] = es.eigenvalues().real();//ok to do this because H symmetric
+    //scale
+    s[i] = s[i]/(s[i].cwiseAbs().minCoeff());
+    UH[i] = es.eigenvectors().real();
+
+
+  }
+}
+
+
+template <typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::computeLaplacians()
+{
+  computeCoefficientLaplacian(2, DDA);
+
+  computeCoefficientLaplacian(4, DDB);
+}
+
+template<typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
+precomputeInteriorEdges()
+{
+  // Flag border edges
+  numInteriorEdges = 0;
+  isBorderEdge.setZero(numE,1);
+  indFullToInterior = -1.*Eigen::VectorXi::Ones(numE,1);
+
+  for(unsigned i=0; i<numE; ++i)
+  {
+    if ((E2F(i,0) == -1) || ((E2F(i,1) == -1)))
+      isBorderEdge[i] = 1;
+    else
+    {
+      indFullToInterior[i] = numInteriorEdges;
+      numInteriorEdges++;
+    }
+  }
+
+  E2F_int.resize(numInteriorEdges, 2);
+  indInteriorToFull.setZero(numInteriorEdges,1);
+  int ii = 0;
+  for (int k=0; k<numE; ++k)
+  {
+    if (isBorderEdge[k])
+      continue;
+    E2F_int.row(ii) = E2F.row(k);
+    indInteriorToFull[ii] = k;
+    ii++;
+  }
+
+}
+
+
+
+template<typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
+computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D)
+{
+  std::vector<Eigen::Triplet<std::complex<typename DerivedV::Scalar> >> tripletList;
+
+  // For every non-border edge
+  for (unsigned eid=0; eid<numE; ++eid)
+  {
+    if (!isBorderEdge[eid])
+    {
+      int fid0 = E2F(eid,0);
+      int fid1 = E2F(eid,1);
+
+      tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
+                                                                                     fid0,
+                                                                                     std::complex<typename DerivedV::Scalar>(1.)));
+      tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
+                                                                                     fid1,
+                                                                                     std::complex<typename DerivedV::Scalar>(1.)));
+      tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
+                                                                                     fid1,
+                                                                                     -1.*std::polar(1.,-1.*n*K[eid])));
+      tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
+                                                                                     fid0,
+                                                                                     -1.*std::polar(1.,1.*n*K[eid])));
+
+    }
+  }
+  D.resize(numF,numF);
+  D.setFromTriplets(tripletList.begin(), tripletList.end());
+
+
+}
+
+template<typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
+computek()
+{
+  K.setZero(numE);
+  // For every non-border edge
+  for (unsigned eid=0; eid<numE; ++eid)
+  {
+    if (!isBorderEdge[eid])
+    {
+      int fid0 = E2F(eid,0);
+      int fid1 = E2F(eid,1);
+
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N0 = FN.row(fid0);
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N1 = FN.row(fid1);
+
+      // find common edge on triangle 0 and 1
+      int fid0_vc = -1;
+      int fid1_vc = -1;
+      for (unsigned i=0;i<3;++i)
+      {
+        if (F2E(fid0,i) == eid)
+          fid0_vc = i;
+        if (F2E(fid1,i) == eid)
+          fid1_vc = i;
+      }
+      assert(fid0_vc != -1);
+      assert(fid1_vc != -1);
+
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> common_edge = V.row(F(fid0,(fid0_vc+1)%3)) - V.row(F(fid0,fid0_vc));
+      common_edge.normalize();
+
+      // Map the two triangles in a new space where the common edge is the x axis and the N0 the z axis
+      Eigen::Matrix<typename DerivedV::Scalar, 3, 3> P;
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> o = V.row(F(fid0,fid0_vc));
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> tmp = -N0.cross(common_edge);
+      P << common_edge, tmp, N0;
+      //      P.transposeInPlace();
+
+
+      Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V0;
+      V0.row(0) = V.row(F(fid0,0)) -o;
+      V0.row(1) = V.row(F(fid0,1)) -o;
+      V0.row(2) = V.row(F(fid0,2)) -o;
+
+      V0 = (P*V0.transpose()).transpose();
+
+      Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V1;
+      V1.row(0) = V.row(F(fid1,0)) -o;
+      V1.row(1) = V.row(F(fid1,1)) -o;
+      V1.row(2) = V.row(F(fid1,2)) -o;
+      V1 = (P*V1.transpose()).transpose();
+
+      // compute rotation R such that R * N1 = N0
+      // i.e. map both triangles to the same plane
+      double alpha = -atan2(V1((fid1_vc+2)%3,2),V1((fid1_vc+2)%3,1));
+
+      Eigen::Matrix<typename DerivedV::Scalar, 3, 3> R;
+      R << 1,          0,            0,
+      0, cos(alpha), -sin(alpha) ,
+      0, sin(alpha),  cos(alpha);
+      V1 = (R*V1.transpose()).transpose();
+
+      // measure the angle between the reference frames
+      // k_ij is the angle between the triangle on the left and the one on the right
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref0 = V0.row(1) - V0.row(0);
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref1 = V1.row(1) - V1.row(0);
+
+      ref0.normalize();
+      ref1.normalize();
+
+      double ktemp = atan2(ref1(1),ref1(0)) - atan2(ref0(1),ref0(0));
+
+      // just to be sure, rotate ref0 using angle ktemp...
+      Eigen::Matrix<typename DerivedV::Scalar, 2, 2> R2;
+      R2 << cos(ktemp), -sin(ktemp), sin(ktemp), cos(ktemp);
+
+      Eigen::Matrix<typename DerivedV::Scalar, 1, 2> tmp1 = R2*(ref0.head(2)).transpose();
+
+      K[eid] = ktemp;
+    }
+  }
+
+}
+
+template<typename DerivedV, typename DerivedF>
+IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
+evaluateConjugacy(const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvU,
+                   const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvV,
+                  Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &conjValues) const 
+{
+  conjValues.resize(numF,1);
+  for (int j =0; j<numF; ++j)
+  {
+    Eigen::Matrix<typename DerivedV::Scalar, 4, 1> x; x<<pvU.row(j).transpose(), pvV.row(j).transpose();
+    conjValues[j] = x.transpose()*H[j]*x;
+  }
+}
+
+#endif