├── Eigen ├── Eigen ├── src │ ├── Core │ │ ├── util │ │ │ ├── NonMPL2.h │ │ │ ├── CMakeLists.txt │ │ │ └── ReenableStupidWarnings.h │ │ ├── arch │ │ │ ├── CMakeLists.txt │ │ │ ├── SSE │ │ │ │ └── CMakeLists.txt │ │ │ ├── NEON │ │ │ │ └── CMakeLists.txt │ │ │ ├── AltiVec │ │ │ │ └── CMakeLists.txt │ │ │ └── Default │ │ │ │ └── CMakeLists.txt │ │ ├── products │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── QR │ │ └── CMakeLists.txt │ ├── SVD │ │ └── CMakeLists.txt │ ├── misc │ │ └── CMakeLists.txt │ ├── Jacobi │ │ └── CMakeLists.txt │ ├── LU │ │ ├── arch │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── plugins │ │ └── CMakeLists.txt │ ├── Cholesky │ │ └── CMakeLists.txt │ ├── SparseLU │ │ └── CMakeLists.txt │ ├── SparseQR │ │ └── CMakeLists.txt │ ├── StlSupport │ │ └── CMakeLists.txt │ ├── Eigenvalues │ │ └── CMakeLists.txt │ ├── Householder │ │ └── CMakeLists.txt │ ├── SPQRSupport │ │ └── CMakeLists.txt │ ├── SparseCore │ │ ├── CMakeLists.txt │ │ └── SparseFuzzy.h │ ├── MetisSupport │ │ └── CMakeLists.txt │ ├── Geometry │ │ ├── arch │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── PaStiXSupport │ │ └── CMakeLists.txt │ ├── CholmodSupport │ │ └── CMakeLists.txt │ ├── OrderingMethods │ │ └── CMakeLists.txt │ ├── PardisoSupport │ │ └── CMakeLists.txt │ ├── SparseCholesky │ │ └── CMakeLists.txt │ ├── SuperLUSupport │ │ └── CMakeLists.txt │ ├── UmfPackSupport │ │ └── CMakeLists.txt │ ├── Eigen2Support │ │ ├── Geometry │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── Macros.h │ ├── IterativeLinearSolvers │ │ └── CMakeLists.txt │ └── CMakeLists.txt ├── Dense ├── ArrayTemp ├── Householder ├── CMakeLists.txt ├── Sparse ├── Jacobi ├── StdList ├── QtAlignedMalloc ├── MetisSupport ├── LeastSquares ├── StdDeque ├── StdVector ├── Cholesky ├── PardisoSupport ├── SVD ├── SPQRSupport ├── QR ├── SparseQR └── LU ├── test.png ├── unsupported ├── test │ └── FFT.cpp ├── doc │ ├── CMakeLists.txt │ ├── examples │ │ ├── MatrixExponential.cpp │ │ ├── MatrixPower.cpp │ │ ├── MatrixLogarithm.cpp │ │ ├── MatrixPower_optimal.cpp │ │ ├── MatrixSquareRoot.cpp │ │ ├── MatrixFunction.cpp │ │ ├── MatrixSine.cpp │ │ ├── MatrixSinh.cpp │ │ ├── PolynomialUtils1.cpp │ │ └── CMakeLists.txt │ └── Overview.dox ├── Eigen │ ├── src │ │ ├── SVD │ │ │ ├── CMakeLists.txt │ │ │ └── doneInBDCSVD.txt │ │ ├── BVH │ │ │ └── CMakeLists.txt │ │ ├── FFT │ │ │ └── CMakeLists.txt │ │ ├── Skyline │ │ │ └── CMakeLists.txt │ │ ├── Splines │ │ │ └── CMakeLists.txt │ │ ├── AutoDiff │ │ │ └── CMakeLists.txt │ │ ├── Polynomials │ │ │ └── CMakeLists.txt │ │ ├── SparseExtra │ │ │ └── CMakeLists.txt │ │ ├── NumericalDiff │ │ │ └── CMakeLists.txt │ │ ├── LevenbergMarquardt │ │ │ └── CMakeLists.txt │ │ ├── MatrixFunctions │ │ │ └── CMakeLists.txt │ │ ├── IterativeSolvers │ │ │ └── CMakeLists.txt │ │ ├── KroneckerProduct │ │ │ └── CMakeLists.txt │ │ ├── MoreVectorization │ │ │ └── CMakeLists.txt │ │ ├── NonLinearOptimization │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── MoreVectorization │ ├── Splines │ ├── ArpackSupport │ ├── KroneckerProduct │ └── Skyline └── CMakeLists.txt ├── igl ├── xml │ └── README ├── tetgen │ └── README ├── boolean │ ├── MeshBooleanType.h │ ├── to_cork_mesh.h │ └── from_cork_mesh.h ├── WindingNumberMethod.h ├── random_quaternion.h ├── dot.cpp ├── file_exists.cpp ├── PI.h ├── NormalType.h ├── point_in_circle.cpp ├── is_planar.cpp ├── igl_inline.h ├── writeWRL.h ├── matlab │ ├── mexErrMsgTxt.cpp │ ├── mexErrMsgTxt.h │ ├── parse_rhs.h │ └── prepare_lhs.h ├── deprecated.h ├── SolverStatus.h ├── triangles_from_strip.cpp ├── fit_rigid.cpp ├── compile_and_link_program.h ├── get_seconds_hires.h ├── mod.cpp ├── STR.h ├── triangle_fan.h ├── C_STR.h ├── path_to_executable.h ├── any_of.cpp ├── dot.h ├── bone_parents.cpp ├── embree │ ├── Hit.h │ └── Embree_convenience.h ├── quad_planarity.h ├── canonical_quaternions.cpp ├── exterior_edges.h ├── cgal │ ├── RemeshSelfIntersectionsParam.h │ └── polyhedron_to_mesh.h ├── ONE.h ├── ZERO.h ├── example_fun.cpp ├── up_axis.cpp ├── angular_distance.cpp ├── init_render_to_texture.h ├── random_quaternion.cpp ├── EPS.cpp ├── is_file.cpp ├── any_of.h ├── right_axis.cpp ├── nchoosek.h ├── print_gl_get.h ├── print_shader_info_log.h ├── writeOFF.h ├── print_program_info_log.h ├── snap_to_fixed_up.cpp ├── draw_beach_ball.h ├── null.cpp ├── dot_row.cpp ├── mosek │ ├── mosek_guarded.cpp │ └── mosek_guarded.h ├── bounding_box_diagonal.cpp ├── median.h ├── gl_type_size.h ├── report_gl_error.cpp ├── IO ├── dirname.h ├── is_dir.cpp ├── basename.h ├── column_to_quats.cpp ├── gl_type_size.cpp ├── sort_angles.h ├── quat_conjugate.cpp ├── max_size.h ├── min_size.h ├── ceil.h ├── floor.h ├── file_dialog_open.h ├── fit_rigid.h ├── mod.h ├── compile_shader.cpp ├── file_exists.h ├── get_seconds.cpp ├── load_shader.cpp ├── example_fun.h ├── is_planar.h ├── file_dialog_save.h ├── bounding_box_diagonal.h ├── compile_shader.h ├── randperm.h ├── is_readable.h ├── print_program_info_log.cpp ├── is_writable.h ├── print_vector.h ├── report_gl_error.h ├── angular_distance.h ├── is_dir.h ├── cocoa_key_to_anttweakbar_key.h ├── median.cpp ├── random_dir.h ├── readCSV.h ├── texture_from_tga.h ├── file_contents_as_string.h ├── uniform_type_to_string.h ├── is_file.h ├── get_seconds_hires.cpp ├── directed_edge_orientations.cpp ├── mat_to_quat.h ├── quat_mult.h ├── quats_to_column.cpp ├── sample_edges.cpp ├── normalize_quat.h ├── bone_parents.h ├── quat_to_mat.h ├── is_sparse.cpp ├── speye.cpp ├── axis_angle_to_quat.h ├── load_shader.h ├── file_contents_as_string.cpp ├── triangles_from_strip.h ├── print_shader_info_log.cpp ├── compile_and_link_program.cpp ├── reorder.h ├── directed_edge_parents.h ├── orth.cpp ├── rotate_by_quat.h ├── point_in_circle.h ├── print_gl_get.cpp ├── draw_rectangular_marquee.h ├── face_occurrences.h ├── quat_conjugate.h ├── directed_edge_parents.cpp ├── edges.h ├── OpenGL_convenience.h ├── column_to_quats.h ├── normalize_row_sums.h ├── next_filename.cpp ├── null.h ├── average_onto_faces.cpp ├── fit_plane.h ├── round.h ├── is_sparse.h ├── get_seconds.h └── rows_to_matrix.h ├── resources └── shaders │ ├── ellipseshader.frag │ ├── text.frag │ ├── text.vert │ ├── stroke.frag │ ├── segmentation.frag │ ├── stroke.vert │ ├── ellipseshader.vert │ ├── box.vert │ ├── phongvshader.vert │ ├── segmentation.vert │ ├── box.frag │ └── phongfshader.frag ├── utils ├── matlabengine.cpp ├── matlabengine.h ├── contourparams.h └── contourparams.cpp ├── .gitignore ├── main.cpp ├── widgets └── suggestivecontourspanel.h ├── Info.plist ├── trimesh └── faceflip.cc ├── mesh └── segmentsgraph.h ├── optimisation └── utility_functions.h ├── README.md └── OpenGL └── trackball.h /Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msurguy/how2sketch/master/test.png -------------------------------------------------------------------------------- /unsupported/test/FFT.cpp: -------------------------------------------------------------------------------- 1 | #define test_FFTW test_FFT 2 | #include "FFTW.cpp" 3 | -------------------------------------------------------------------------------- /igl/xml/README: -------------------------------------------------------------------------------- 1 | IGL xml serializer 2 | 3 | Dependencies: 4 | tinyxml2 5 | 6 | Travel to $IGL/external/tinyxml2 -------------------------------------------------------------------------------- /Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /unsupported/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) 2 | 3 | add_subdirectory(examples) 4 | add_subdirectory(snippets) 5 | -------------------------------------------------------------------------------- /igl/tetgen/README: -------------------------------------------------------------------------------- 1 | IGL interface to tetgen library 2 | 3 | Dependencies: 4 | tetgen 5 | 6 | Travel to $IGL/external/tetgen and issue: 7 | make -f Makefile.igl tetlib 8 | -------------------------------------------------------------------------------- /resources/shaders/ellipseshader.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout( location = 0 ) out vec4 color; 4 | 5 | 6 | void main() 7 | { 8 | color = vec4(1, 0, 0, 1); 9 | } 10 | -------------------------------------------------------------------------------- /Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SparseLU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseLU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseLU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseLU COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SparseQR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseQR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseQR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseQR/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}unsupported/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/BVH/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_BVH_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_BVH_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/BVH COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/FFT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_FFT_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_FFT_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/FFT COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /Eigen/src/SPQRSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SPQRSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SPQRSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SPQRSupport/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SparseCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCore_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCore_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCore COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/MetisSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MetisSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MetisSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/MetisSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/PaStiXSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PastixSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PastixSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PaStiXSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/Skyline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Skyline_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Skyline_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/Skyline COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/Splines/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Splines_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Splines_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/Splines COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/CholmodSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_CholmodSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/OrderingMethods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_OrderingMethods_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_OrderingMethods_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/OrderingMethods COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/PardisoSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PardisoSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PardisoSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PardisoSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SparseCholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SuperLUSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SuperLUSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SuperLUSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SuperLUSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/UmfPackSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_UmfPackSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_UmfPackSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/UmfPackSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/AutoDiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_AutoDiff_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_AutoDiff_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/AutoDiff COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/Polynomials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Polynomials_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Polynomials_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/Polynomials COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/SparseExtra/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseExtra_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseExtra_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/SparseExtra COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/NumericalDiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_NumericalDiff_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_NumericalDiff_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/NumericalDiff COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /unsupported/Eigen/src/LevenbergMarquardt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LevenbergMarquardt_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LevenbergMarquardt_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LevenbergMarquardt COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/MatrixFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MatrixFunctions_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MatrixFunctions_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/MatrixFunctions COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/IterativeLinearSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeLinearSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeLinearSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/IterativeLinearSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/IterativeSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/KroneckerProduct/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_KroneckerProduct_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_KroneckerProduct_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/KroneckerProduct COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/MoreVectorization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MoreVectorization_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MoreVectorization_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/MoreVectorization COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /unsupported/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Eigen) 2 | add_subdirectory(doc EXCLUDE_FROM_ALL) 3 | if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) 4 | add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest 5 | else() 6 | add_subdirectory(test EXCLUDE_FROM_ALL) 7 | endif() 8 | -------------------------------------------------------------------------------- /resources/shaders/text.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | 4 | uniform sampler2D textTexture; 5 | in vec2 texc; 6 | 7 | layout( location = 0 ) out vec4 color; 8 | 9 | void main() 10 | { 11 | vec3 rgb = texture(textTexture, texc).rgb; 12 | color = vec4(rgb, 1); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/NonLinearOptimization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_NonLinearOptimization_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_NonLinearOptimization_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/NonLinearOptimization COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /resources/shaders/text.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | layout (location = 1) in vec2 texCoord; 5 | 6 | out vec2 texc; // Normal in eye coordinates 7 | uniform mat4 matrix; 8 | 9 | void main() 10 | { 11 | gl_Position = matrix*vertex; 12 | texc = texCoord; 13 | } 14 | -------------------------------------------------------------------------------- /resources/shaders/stroke.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | 4 | 5 | layout( location = 0 ) out vec4 color; 6 | 7 | uniform bool isCurrent; 8 | in vec3 vcolour; 9 | 10 | void main() { 11 | 12 | if(isCurrent) 13 | color = vec4(0.5); 14 | else 15 | color = vec4(0.0, 0.0, 0.0, 0.5); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /utils/matlabengine.cpp: -------------------------------------------------------------------------------- 1 | #include "matlabengine.h" 2 | 3 | 4 | MatlabEngine* MatlabEngine::instance = nullptr; 5 | 6 | MatlabEngine::MatlabEngine() 7 | { 8 | bool loaded = engine = engOpen(""); 9 | assert(loaded); 10 | } 11 | 12 | auto MatlabEngine::getEngine() -> Engine* 13 | { 14 | return engine; 15 | } 16 | -------------------------------------------------------------------------------- /Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /Eigen/ArrayTemp: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /resources/shaders/segmentation.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | //in vec3 EyeNormal; // Normal in eye coordinates 4 | //in vec4 EyePosition; // Position in eye coordinates 5 | 6 | //in float depth; 7 | 8 | layout( location = 0 ) out vec4 color; 9 | 10 | in vec3 vcolour; 11 | 12 | void main() { 13 | vec3 c = vec3(0.5, 0.7, 0.4); 14 | color = vec4(vcolour, 1.0); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /igl/boolean/MeshBooleanType.h: -------------------------------------------------------------------------------- 1 | #ifndef MESH_BOOLEAN_TYPE_H 2 | #define MESH_BOOLEAN_TYPE_H 3 | 4 | namespace igl 5 | { 6 | enum MeshBooleanType 7 | { 8 | MESH_BOOLEAN_TYPE_UNION = 0, 9 | MESH_BOOLEAN_TYPE_INTERSECT = 1, 10 | MESH_BOOLEAN_TYPE_MINUS = 2, 11 | MESH_BOOLEAN_TYPE_XOR = 3, 12 | MESH_BOOLEAN_TYPE_RESOLVE = 4, 13 | NUM_MESH_BOOLEAN_TYPES = 5 14 | }; 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /resources/shaders/stroke.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | layout (location = 1) in vec4 new_vertex; 5 | 6 | uniform mat4 projMatrix; 7 | uniform mat4 viewMatrix; 8 | uniform bool isCurrent; 9 | 10 | void main(void) 11 | { 12 | // if(isCurrent) 13 | // gl_Position = projMatrix * new_vertex; 14 | // else 15 | gl_Position = projMatrix * vertex; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /igl/WindingNumberMethod.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_WINDINGNUMBERMETHOD_H 2 | #define IGL_WINDINGNUMBERMETHOD_H 3 | namespace igl 4 | { 5 | enum WindingNumberMethod 6 | { 7 | EXACT_WINDING_NUMBER_METHOD = 0, // Exact hierarchical evaluation 8 | APPROX_SIMPLE_WINDING_NUMBER_METHOD = 1, 9 | APPROX_CACHE_WINDING_NUMBER_METHOD = 2, // Approximate hierarchical evaluation 10 | NUM_WINDING_NUMBER_METHODS = 3 11 | }; 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /igl/random_quaternion.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_RANDOM_QUATERNION_H 2 | #define IGL_RANDOM_QUATERNION_H 3 | #include "igl_inline.h" 4 | #include 5 | namespace igl 6 | { 7 | // Return a random quaternion via uniform sampling of the 4-sphere 8 | template 9 | IGL_INLINE Eigen::Quaternion random_quaternion(); 10 | } 11 | #ifndef IGL_STATIC_LIBRARY 12 | #include "random_quaternion.cpp" 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixExponential.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | 10 | MatrixXd A(3,3); 11 | A << 0, -pi/4, 0, 12 | pi/4, 0, 0, 13 | 0, 0, 0; 14 | std::cout << "The matrix A is:\n" << A << "\n\n"; 15 | std::cout << "The matrix exponential of A is:\n" << A.exp() << "\n\n"; 16 | } 17 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixPower.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | Matrix3d A; 10 | A << cos(1), -sin(1), 0, 11 | sin(1), cos(1), 0, 12 | 0 , 0 , 1; 13 | std::cout << "The matrix A is:\n" << A << "\n\n" 14 | "The matrix power A^(pi/4) is:\n" << A.pow(pi/4) << std::endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(AutoDiff) 2 | ADD_SUBDIRECTORY(BVH) 3 | ADD_SUBDIRECTORY(FFT) 4 | ADD_SUBDIRECTORY(IterativeSolvers) 5 | ADD_SUBDIRECTORY(MatrixFunctions) 6 | ADD_SUBDIRECTORY(MoreVectorization) 7 | ADD_SUBDIRECTORY(NonLinearOptimization) 8 | ADD_SUBDIRECTORY(NumericalDiff) 9 | ADD_SUBDIRECTORY(Polynomials) 10 | ADD_SUBDIRECTORY(Skyline) 11 | ADD_SUBDIRECTORY(SparseExtra) 12 | ADD_SUBDIRECTORY(KroneckerProduct) 13 | ADD_SUBDIRECTORY(Splines) 14 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixLogarithm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | using std::sqrt; 9 | MatrixXd A(3,3); 10 | A << 0.5*sqrt(2), -0.5*sqrt(2), 0, 11 | 0.5*sqrt(2), 0.5*sqrt(2), 0, 12 | 0, 0, 1; 13 | std::cout << "The matrix A is:\n" << A << "\n\n"; 14 | std::cout << "The matrix logarithm of A is:\n" << A.log() << "\n"; 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | qrc_*.cpp 24 | ui_*.h 25 | Makefile* 26 | *-build-* 27 | 28 | # QtCreator 29 | 30 | *.autosave 31 | 32 | #QtCtreator Qml 33 | *.qmlproject.user 34 | *.qmlproject.user.* 35 | 36 | build/* 37 | build-* 38 | *.DS_Store 39 | -------------------------------------------------------------------------------- /unsupported/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_HEADERS AdolcForward BVH IterativeSolvers MatrixFunctions MoreVectorization AutoDiff AlignedVector3 Polynomials 2 | FFT NonLinearOptimization SparseExtra IterativeSolvers 3 | NumericalDiff Skyline MPRealSupport OpenGLSupport KroneckerProduct Splines LevenbergMarquardt 4 | ) 5 | 6 | install(FILES 7 | ${Eigen_HEADERS} 8 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel 9 | ) 10 | 11 | add_subdirectory(src) 12 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_CPP 2 | #define MAIN_CPP 3 | 4 | 5 | #include 6 | #include "widgets/mainwindow.h" 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | auto format = QSurfaceFormat(); 11 | format.setVersion(4,3); 12 | format.setSamples(4); 13 | format.setProfile(QSurfaceFormat::CoreProfile); 14 | QSurfaceFormat::setDefaultFormat(format); 15 | QApplication a(argc, argv); 16 | MainWindow w; 17 | w.show(); 18 | w.resize(1200, 800); 19 | return a.exec(); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixPower_optimal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | Matrix4cd A = Matrix4cd::Random(); 9 | MatrixPower Apow(A); 10 | 11 | std::cout << "The matrix A is:\n" << A << "\n\n" 12 | "A^3.1 is:\n" << Apow(3.1) << "\n\n" 13 | "A^3.3 is:\n" << Apow(3.3) << "\n\n" 14 | "A^3.7 is:\n" << Apow(3.7) << "\n\n" 15 | "A^3.9 is:\n" << Apow(3.9) << std::endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixSquareRoot.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | 10 | MatrixXd A(2,2); 11 | A << cos(pi/3), -sin(pi/3), 12 | sin(pi/3), cos(pi/3); 13 | std::cout << "The matrix A is:\n" << A << "\n\n"; 14 | std::cout << "The matrix square root of A is:\n" << A.sqrt() << "\n\n"; 15 | std::cout << "The square of the last matrix is:\n" << A.sqrt() * A.sqrt() << "\n"; 16 | } 17 | -------------------------------------------------------------------------------- /resources/shaders/ellipseshader.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | 5 | uniform mat4 mvMatrix; 6 | uniform mat4 projMatrix; 7 | uniform mat3 ellipse_rotation; 8 | uniform vec3 translation; 9 | uniform float radius; 10 | 11 | void main() { 12 | 13 | 14 | vec4 newVertex = vertex; 15 | newVertex[0] *= radius; 16 | newVertex[2] *= radius; 17 | 18 | vec3 rotated = translation + ellipse_rotation*newVertex.xyz; 19 | 20 | gl_Position = projMatrix*mvMatrix*vec4(rotated.xyz, newVertex[3]); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /resources/shaders/box.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | 5 | uniform mat4 mvMatrix; 6 | uniform mat4 projMatrix; 7 | uniform bool hasGeomShader; 8 | 9 | out vec2 ab_line; 10 | out vec2 a_point; 11 | /* 12 | ; 13 | uniform mat3 normalMatrix; 14 | */ 15 | 16 | void main() { 17 | 18 | //Only setting these for when no geometry shadder is used 19 | ab_line = vec2(0,0); 20 | a_point = vec2(0,0); 21 | 22 | if(!hasGeomShader) 23 | gl_Position = projMatrix*mvMatrix*vertex; 24 | else 25 | gl_Position = mvMatrix*vertex; 26 | } 27 | -------------------------------------------------------------------------------- /resources/shaders/phongvshader.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | layout (location = 1) in vec3 normal; 5 | 6 | 7 | out vec3 EyeNormal; // Normal in eye coordinates 8 | out vec4 EyePosition; 9 | out vec3 normal_test; 10 | 11 | uniform mat4 projMatrix; 12 | uniform mat4 mvMatrix; 13 | uniform mat3 normalMatrix; 14 | uniform mat4 modelMatrix; 15 | 16 | void main() { 17 | normal_test = normal; 18 | EyeNormal = normalize(normalMatrix * normal); 19 | EyePosition = mvMatrix * vertex; 20 | gl_Position = projMatrix*mvMatrix*vertex; 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /igl/dot.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "dot.h" 9 | 10 | // http://www.antisphere.com/Wiki/tools:anttweakbar 11 | IGL_INLINE double igl::dot( 12 | const double *a, 13 | const double *b) 14 | { 15 | return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; 16 | } 17 | -------------------------------------------------------------------------------- /igl/file_exists.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "file_exists.h" 9 | 10 | #include 11 | 12 | IGL_INLINE bool igl::file_exists(const std::string filename) 13 | { 14 | struct stat status; 15 | return (stat(filename.c_str(),&status)==0); 16 | } 17 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | std::complex expfn(std::complex x, int) 7 | { 8 | return std::exp(x); 9 | } 10 | 11 | int main() 12 | { 13 | const double pi = std::acos(-1.0); 14 | 15 | MatrixXd A(3,3); 16 | A << 0, -pi/4, 0, 17 | pi/4, 0, 0, 18 | 0, 0, 0; 19 | 20 | std::cout << "The matrix A is:\n" << A << "\n\n"; 21 | std::cout << "The matrix exponential of A is:\n" 22 | << A.matrixFunction(expfn) << "\n\n"; 23 | } 24 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixSine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | MatrixXd A = MatrixXd::Random(3,3); 9 | std::cout << "A = \n" << A << "\n\n"; 10 | 11 | MatrixXd sinA = A.sin(); 12 | std::cout << "sin(A) = \n" << sinA << "\n\n"; 13 | 14 | MatrixXd cosA = A.cos(); 15 | std::cout << "cos(A) = \n" << cosA << "\n\n"; 16 | 17 | // The matrix functions satisfy sin^2(A) + cos^2(A) = I, 18 | // like the scalar functions. 19 | std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n"; 20 | } 21 | -------------------------------------------------------------------------------- /unsupported/doc/examples/MatrixSinh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | MatrixXf A = MatrixXf::Random(3,3); 9 | std::cout << "A = \n" << A << "\n\n"; 10 | 11 | MatrixXf sinhA = A.sinh(); 12 | std::cout << "sinh(A) = \n" << sinhA << "\n\n"; 13 | 14 | MatrixXf coshA = A.cosh(); 15 | std::cout << "cosh(A) = \n" << coshA << "\n\n"; 16 | 17 | // The matrix functions satisfy cosh^2(A) - sinh^2(A) = I, 18 | // like the scalar functions. 19 | std::cout << "cosh^2(A) - sinh^2(A) = \n" << coshA*coshA - sinhA*sinhA << "\n\n"; 20 | } 21 | -------------------------------------------------------------------------------- /igl/PI.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PI_H 9 | #define IGL_PI_H 10 | namespace igl 11 | { 12 | // Use standard mathematical constants' M_PI if available 13 | #ifdef M_PI 14 | const double PI = M_PI; 15 | #else 16 | const double PI = 3.1415926535897932384626433832795; 17 | #endif 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /utils/matlabengine.h: -------------------------------------------------------------------------------- 1 | #ifndef MATLABENGINE_H 2 | #define MATLABENGINE_H 3 | 4 | #include "matrix.h" 5 | #include "mex.h" 6 | #include "engine.h" 7 | 8 | class MatlabEngine 9 | { 10 | public: 11 | static MatlabEngine* getInstance() 12 | { 13 | if(!instance) 14 | instance = new MatlabEngine(); 15 | return instance; 16 | } 17 | auto getEngine() -> Engine*; 18 | private: 19 | MatlabEngine(); 20 | static MatlabEngine* instance; 21 | Engine* engine; 22 | MatlabEngine(MatlabEngine const&) = delete; 23 | void operator=(MatlabEngine const&) = delete; 24 | 25 | }; 26 | 27 | #endif // MATLABENGINE_H 28 | -------------------------------------------------------------------------------- /igl/NormalType.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_NORMALTYPE_H 9 | #define IGL_NORMALTYPE_H 10 | 11 | namespace igl 12 | { 13 | enum NormalType 14 | { 15 | PER_VERTEX_NORMALS, 16 | PER_FACE_NORMALS, 17 | PER_CORNER_NORMALS 18 | }; 19 | # define NUM_NORMAL_TYPE 3 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /igl/point_in_circle.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "point_in_circle.h" 9 | 10 | IGL_INLINE bool igl::point_in_circle( 11 | const double qx, 12 | const double qy, 13 | const double cx, 14 | const double cy, 15 | const double r) 16 | { 17 | return (qx-cx)*(qx-cx) + (qy-cy)*(qy-cy) - r*r < 0; 18 | } 19 | -------------------------------------------------------------------------------- /igl/is_planar.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "is_planar.h" 9 | IGL_INLINE bool igl::is_planar(const Eigen::MatrixXd & V) 10 | { 11 | if(V.size() == 0) return false; 12 | if(V.cols() == 2) return true; 13 | for(int i = 0;i 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | // This should *NOT* be contained in a IGL_*_H ifdef, since it may be defined 9 | // differently based on when it is included 10 | #ifdef IGL_INLINE 11 | #undef IGL_INLINE 12 | #endif 13 | 14 | #ifndef IGL_STATIC_LIBRARY 15 | # define IGL_INLINE inline 16 | #else 17 | # define IGL_INLINE 18 | #endif 19 | -------------------------------------------------------------------------------- /Eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Householder_Module Householder module 9 | * This module provides Householder transformations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | */ 15 | 16 | #include "src/Householder/Householder.h" 17 | #include "src/Householder/HouseholderSequence.h" 18 | #include "src/Householder/BlockHouseholder.h" 19 | 20 | #include "src/Core/util/ReenableStupidWarnings.h" 21 | 22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 24 | -------------------------------------------------------------------------------- /Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /igl/writeWRL.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_WRITE_WRL_H 2 | #define IGL_WRITE_WRL_H 3 | #include "igl_inline.h" 4 | #include 5 | #include 6 | namespace igl 7 | { 8 | // Write mesh to a .wrl file 9 | // 10 | // Inputs: 11 | // str path to .wrl file 12 | // V #V by 3 list of vertex positions 13 | // F #F by 3 list of triangle indices 14 | // Returns true iff succes 15 | template 16 | IGL_INLINE bool writeWRL( 17 | const std::string & str, 18 | const Eigen::PlainObjectBase & V, 19 | const Eigen::PlainObjectBase & F); 20 | } 21 | #ifndef IGL_STATIC_LIBRARY 22 | #include "writeWRL.cpp" 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /igl/matlab/mexErrMsgTxt.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "mexErrMsgTxt.h" 9 | 10 | // Overload mexErrMsgTxt to check an assertion then print text only if 11 | // assertion fails 12 | #include "mex.h" 13 | IGL_INLINE void igl::mexErrMsgTxt(bool assertion, const char * text) 14 | { 15 | if(!assertion) 16 | { 17 | ::mexErrMsgTxt(text); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /igl/deprecated.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_DEPRECATED_H 2 | #define IGL_DEPRECATED_H 3 | // Macro for marking a function as deprecated. 4 | // 5 | // http://stackoverflow.com/a/295229/148668 6 | #ifdef __GNUC__ 7 | #define IGL_DEPRECATED(func) func __attribute__ ((deprecated)) 8 | #elif defined(_MSC_VER) 9 | #define IGL_DEPRECATED(func) __declspec(deprecated) func 10 | #else 11 | #pragma message("WARNING: You need to implement IGL_DEPRECATED for this compiler") 12 | #define IGL_DEPRECATED(func) func 13 | #endif 14 | // Usage: 15 | // 16 | // template IGL_INLINE void my_func(Arg1 a); 17 | // 18 | // becomes 19 | // 20 | // template IGL_INLINE IGL_DEPRECATED(void my_func(Arg1 a)); 21 | #endif 22 | -------------------------------------------------------------------------------- /Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | /** \defgroup Sparse_Module Sparse meta-module 5 | * 6 | * Meta-module including all related modules: 7 | * - \ref SparseCore_Module 8 | * - \ref OrderingMethods_Module 9 | * - \ref SparseCholesky_Module 10 | * - \ref SparseLU_Module 11 | * - \ref SparseQR_Module 12 | * - \ref IterativeLinearSolvers_Module 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "SparseCore" 20 | #include "OrderingMethods" 21 | #include "SparseCholesky" 22 | #include "SparseLU" 23 | #include "SparseQR" 24 | #include "IterativeLinearSolvers" 25 | 26 | #endif // EIGEN_SPARSE_MODULE_H 27 | 28 | -------------------------------------------------------------------------------- /unsupported/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /widgets/suggestivecontourspanel.h: -------------------------------------------------------------------------------- 1 | #ifndef SUGGESTIVECONTOURSPANEL_H 2 | #define SUGGESTIVECONTOURSPANEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class SuggestiveContoursPanel :public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | SuggestiveContoursPanel(); 13 | ~SuggestiveContoursPanel(); 14 | auto init() -> void; 15 | private: 16 | QVBoxLayout* items; 17 | private slots: 18 | void cLimitValueChanged(double val); 19 | void scLimitValueChanged(double val); 20 | void dwkrLimitValueChanged(double val); 21 | void jeroenToggled(bool val); 22 | signals: 23 | void updateViewer(); 24 | }; 25 | 26 | #endif // SUGGESTIVECONTOURSPANEL_H 27 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /igl/SolverStatus.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_SOLVER_STATUS_H 9 | #define IGL_SOLVER_STATUS_H 10 | namespace igl 11 | { 12 | enum SolverStatus 13 | { 14 | // Good 15 | SOLVER_STATUS_CONVERGED = 0, 16 | // OK 17 | SOLVER_STATUS_MAX_ITER = 1, 18 | // Bad 19 | SOLVER_STATUS_ERROR = 2, 20 | NUM_SOLVER_STATUSES = 3, 21 | }; 22 | }; 23 | #endif 24 | -------------------------------------------------------------------------------- /igl/triangles_from_strip.cpp: -------------------------------------------------------------------------------- 1 | #include "triangles_from_strip.h" 2 | #include 3 | 4 | template 5 | IGL_INLINE void igl::triangles_from_strip( 6 | const Eigen::MatrixBase& S, 7 | Eigen::PlainObjectBase& F) 8 | { 9 | using namespace std; 10 | F.resize(S.size()-2,3); 11 | for(int s = 0;s < S.size()-2;s++) 12 | { 13 | if(s%2 == 0) 14 | { 15 | F(s,0) = S(s+2); 16 | F(s,1) = S(s+1); 17 | F(s,2) = S(s+0); 18 | }else 19 | { 20 | F(s,0) = S(s+0); 21 | F(s,1) = S(s+1); 22 | F(s,2) = S(s+2); 23 | } 24 | } 25 | } 26 | 27 | #ifdef IGL_STATIC_LIBRARY 28 | // Explicit template specialization 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/fit_rigid.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "fit_rigid.h" 9 | #include "procrustes.h" 10 | 11 | IGL_INLINE void igl::fit_rigid( 12 | const Eigen::MatrixXd & A, 13 | const Eigen::MatrixXd & B, 14 | Eigen::Rotation2Dd & R, 15 | Eigen::RowVector2d & t) 16 | { 17 | using namespace Eigen; 18 | Matrix2d Rmat; 19 | procrustes(A,B,Rmat,t); 20 | R.fromRotationMatrix(Rmat); 21 | } 22 | -------------------------------------------------------------------------------- /igl/compile_and_link_program.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_COMPILE_AND_LINK_PROGRAM_H 2 | #define IGL_COMPILE_AND_LINK_PROGRAM_H 3 | #include "igl_inline.h" 4 | #include "OpenGL_convenience.h" 5 | namespace igl 6 | { 7 | // Compile and link very simple vertex/fragment shaders 8 | // 9 | // Inputs: 10 | // v_str string of vertex shader contents 11 | // f_str string of fragment shader contents 12 | // Returns id of program 13 | // 14 | // Known bugs: this seems to duplicate `create_shader_program` with less 15 | // functionality. 16 | IGL_INLINE GLuint compile_and_link_program( 17 | const char * v_str, const char * f_str); 18 | } 19 | #ifndef IGL_STATIC_LIBRARY 20 | # include "compile_and_link_program.cpp" 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /igl/matlab/mexErrMsgTxt.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MEXERRMSGTXT_H 9 | #define IGL_MEXERRMSGTXT_H 10 | #include "../igl_inline.h" 11 | namespace igl 12 | { 13 | // Wrapper for mexErrMsgTxt that only calls error if test fails 14 | IGL_INLINE void mexErrMsgTxt(bool test, const char * message); 15 | } 16 | #ifndef IGL_STATIC_LIBRARY 17 | # include "mexErrMsgTxt.cpp" 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /igl/get_seconds_hires.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_GET_SECONDS_HIRES_H 9 | #define IGL_GET_SECONDS_HIRES_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Return the current time in seconds using performance counters 15 | IGL_INLINE double get_seconds_hires(); 16 | } 17 | 18 | #ifndef IGL_STATIC_LIBRARY 19 | # include "get_seconds_hires.cpp" 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /igl/mod.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "mod.h" 9 | 10 | template 11 | IGL_INLINE void igl::mod( 12 | const Eigen::PlainObjectBase & A, 13 | const int base, 14 | Eigen::PlainObjectBase & B) 15 | { 16 | B.resize(A.rows(),A.cols()); 17 | for(int i = 0;i 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_STR_H 9 | #define IGL_STR_H 10 | // http://stackoverflow.com/a/2433143/148668 11 | #include 12 | #include 13 | // Suppose you have a function: 14 | // void func(std::string c); 15 | // Then you can write: 16 | // func(STR("foo"<<1<<"bar")); 17 | #define STR(X) static_cast(std::ostringstream().flush() << X).str() 18 | #endif 19 | -------------------------------------------------------------------------------- /unsupported/doc/examples/PolynomialUtils1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Vector4d roots = Vector4d::Random(); 10 | cout << "Roots: " << roots.transpose() << endl; 11 | Eigen::Matrix polynomial; 12 | roots_to_monicPolynomial( roots, polynomial ); 13 | cout << "Polynomial: "; 14 | for( int i=0; i<4; ++i ){ cout << polynomial[i] << ".x^" << i << "+ "; } 15 | cout << polynomial[4] << ".x^4" << endl; 16 | Vector4d evaluation; 17 | for( int i=0; i<4; ++i ){ 18 | evaluation[i] = poly_eval( polynomial, roots[i] ); } 19 | cout << "Evaluation of the polynomial at the roots: " << evaluation.transpose(); 20 | } 21 | -------------------------------------------------------------------------------- /Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Jacobi_Module Jacobi module 9 | * This module provides Jacobi and Givens rotations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | * 15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 16 | * - MatrixBase::applyOnTheLeft() 17 | * - MatrixBase::applyOnTheRight(). 18 | */ 19 | 20 | #include "src/Jacobi/Jacobi.h" 21 | 22 | #include "src/Core/util/ReenableStupidWarnings.h" 23 | 24 | #endif // EIGEN_JACOBI_MODULE_H 25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 26 | 27 | -------------------------------------------------------------------------------- /igl/triangle_fan.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_TRIANGLE_FAN_H 2 | #define IGL_TRIANGLE_FAN_H 3 | #include "igl_inline.h" 4 | #include 5 | namespace igl 6 | { 7 | // Given a list of faces tesselate all of the "exterior" edges forming another 8 | // list of 9 | // 10 | // Inputs: 11 | // E #E by simplex_size-1 list of exterior edges (see exterior_edges.h) 12 | // Outputs: 13 | // cap #cap by simplex_size list of "faces" tessleating the boundary edges 14 | IGL_INLINE void triangle_fan( 15 | const Eigen::MatrixXi & E, 16 | Eigen::MatrixXi & cap); 17 | // In-line version 18 | IGL_INLINE Eigen::MatrixXi triangle_fan( const Eigen::MatrixXi & E); 19 | } 20 | #ifndef IGL_STATIC_LIBRARY 21 | # include "triangle_fan.cpp" 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrincipalClass 6 | NSApplication 7 | CFBundleIconFile 8 | 9 | CFBundlePackageType 10 | APPL 11 | CFBundleGetInfoString 12 | Created by Qt/QMake 13 | CFBundleSignature 14 | ???? 15 | CFBundleExecutable 16 | drawing_assistant 17 | CFBundleIdentifier 18 | com.yourcompany.drawing_assistant 19 | NOTE 20 | This file was generated by Qt/QMake. 21 | 22 | 23 | -------------------------------------------------------------------------------- /igl/C_STR.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_C_STR_H 9 | #define IGL_C_STR_H 10 | // http://stackoverflow.com/a/2433143/148668 11 | // Suppose you have a function: 12 | // void func(const char * c); 13 | // Then you can write: 14 | // func(C_STR("foo"<<1<<"bar")); 15 | #include 16 | #include 17 | #define C_STR(X) static_cast(std::ostringstream().flush() << X).str().c_str() 18 | #endif 19 | -------------------------------------------------------------------------------- /igl/matlab/parse_rhs.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_PARSE_RHS_H 2 | #define IGL_PARSE_RHS_H 3 | #include 4 | #include 5 | #include 6 | namespace igl 7 | { 8 | // Reads in a matrix as a double 9 | // 10 | // Inputs: 11 | // prhs points to rhs argument 12 | // Outputs: 13 | // V M by N matrix 14 | template 15 | IGL_INLINE void parse_rhs_double( 16 | const mxArray *prhs[], 17 | Eigen::PlainObjectBase & V); 18 | // Reads in a matrix and subtracts 1 19 | template 20 | IGL_INLINE void parse_rhs_index( 21 | const mxArray *prhs[], 22 | Eigen::PlainObjectBase & V); 23 | }; 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "parse_rhs.cpp" 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/path_to_executable.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PATH_TO_EXECUTABLE_H 9 | #define IGL_PATH_TO_EXECUTABLE_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Return the path of the current executable. 15 | // Note: Tested for Mac OS X 16 | IGL_INLINE std::string path_to_executable(); 17 | } 18 | #ifndef IGL_STATIC_LIBRARY 19 | # include "path_to_executable.cpp" 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /resources/shaders/segmentation.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout (location = 0) in vec4 vertex; 4 | layout (location = 7) in vec3 colour; 5 | 6 | //layout (location = 1) in vec3 normal; 7 | 8 | uniform mat4 mvMatrix; 9 | uniform mat4 modelMatrix; 10 | //uniform mat3 normalMatrix; 11 | uniform mat4 projMatrix; 12 | out vec3 vcolour; 13 | //out float depth; 14 | 15 | //out vec3 EyeNormal; // Normal in eye coordinates 16 | //out vec4 EyePosition; // Position in eye coordinates 17 | 18 | void main() 19 | { 20 | //EyeNormal = normalize(normalMatrix * normal); 21 | //EyePosition = mvMatrix * vertex; 22 | 23 | gl_Position = projMatrix * mvMatrix * vertex; 24 | vcolour = colour; 25 | //scolour = seg_colour; 26 | //depth = gl_Position.z; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /unsupported/doc/Overview.dox: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | /** \mainpage Eigen's unsupported modules 4 | 5 | This is the API documentation for Eigen's unsupported modules. 6 | 7 | These modules are contributions from various users. They are provided "as is", without any support. 8 | 9 | Click on the \e Modules tab at the top of this page to get a list of all unsupported modules. 10 | 11 | Don't miss the official Eigen documentation. 12 | 13 | */ 14 | 15 | /* 16 | 17 | \defgroup Unsupported_modules Unsupported modules 18 | 19 | The unsupported modules are contributions from various users. They are 20 | provided "as is", without any support. Nevertheless, some of them are 21 | subject to be included in Eigen in the future. 22 | 23 | */ 24 | 25 | } 26 | -------------------------------------------------------------------------------- /unsupported/doc/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB examples_SRCS "*.cpp") 2 | 3 | ADD_CUSTOM_TARGET(unsupported_examples) 4 | 5 | INCLUDE_DIRECTORIES(../../../unsupported ../../../unsupported/test) 6 | 7 | FOREACH(example_src ${examples_SRCS}) 8 | GET_FILENAME_COMPONENT(example ${example_src} NAME_WE) 9 | ADD_EXECUTABLE(example_${example} ${example_src}) 10 | if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) 11 | target_link_libraries(example_${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) 12 | endif() 13 | ADD_CUSTOM_COMMAND( 14 | TARGET example_${example} 15 | POST_BUILD 16 | COMMAND example_${example} 17 | ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out 18 | ) 19 | ADD_DEPENDENCIES(unsupported_examples example_${example}) 20 | ENDFOREACH(example_src) 21 | -------------------------------------------------------------------------------- /trimesh/faceflip.cc: -------------------------------------------------------------------------------- 1 | /* 2 | Szymon Rusinkiewicz 3 | Princeton University 4 | 5 | faceflip.cc 6 | Flip the order of vertices in each face. Turns the mesh inside out. 7 | */ 8 | 9 | #include "TriMesh.h" 10 | #include "TriMesh_algo.h" 11 | #define dprintf TriMesh::dprintf 12 | using namespace std; 13 | 14 | 15 | namespace trimesh { 16 | 17 | void faceflip(TriMesh *mesh) 18 | { 19 | bool had_tstrips = !mesh->tstrips.empty(); 20 | mesh->need_faces(); 21 | mesh->tstrips.clear(); 22 | 23 | dprintf("Flipping faces... "); 24 | int nf = mesh->faces.size(); 25 | #pragma omp parallel for 26 | for (int i = 0; i < nf; i++) 27 | swap(mesh->faces[i][0], mesh->faces[i][2]); 28 | dprintf("Done.\n"); 29 | 30 | if (had_tstrips) 31 | mesh->need_tstrips(); 32 | } 33 | 34 | }; // namespace trimesh 35 | -------------------------------------------------------------------------------- /Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /igl/any_of.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "any_of.h" 9 | #include 10 | template 11 | IGL_INLINE bool igl::any_of(const Mat & S) 12 | { 13 | return std::any_of(S.data(),S.data()+S.size(),[](bool s){return s;}); 14 | } 15 | 16 | #ifdef IGL_STATIC_LIBRARY 17 | // Explicit template specialization 18 | template bool igl::any_of >(Eigen::Matrix const&); 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /igl/dot.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_DOT_H 9 | #define IGL_DOT_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Computes out = dot(a,b) 14 | // Inputs: 15 | // a left 3d vector 16 | // b right 3d vector 17 | // Returns scalar dot product 18 | IGL_INLINE double dot( 19 | const double *a, 20 | const double *b); 21 | } 22 | 23 | #ifndef IGL_STATIC_LIBRARY 24 | # include "dot.cpp" 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /igl/bone_parents.cpp: -------------------------------------------------------------------------------- 1 | #include "bone_parents.h" 2 | 3 | template 4 | IGL_INLINE void igl::bone_parents( 5 | const Eigen::PlainObjectBase& BE, 6 | Eigen::PlainObjectBase& P) 7 | { 8 | P.resize(BE.rows(),1); 9 | // Stupid O(n²) version 10 | for(int e = 0;e, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); 25 | #endif 26 | -------------------------------------------------------------------------------- /igl/embree/Hit.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 2014 Christian Schüller 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla Public License 7 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 8 | // obtain one at http://mozilla.org/MPL/2.0/. 9 | #ifndef IGL_HIT_H 10 | #define IGL_HIT_H 11 | 12 | namespace igl 13 | { 14 | // Reimplementation of the embree::Hit struct from embree1.0 15 | struct Hit 16 | { 17 | int id; // primitive id 18 | int gid; // geometry id 19 | float u,v; // barycentric coordinates 20 | float t; // distance = direction*t to intersection 21 | }; 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /igl/quad_planarity.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_QUAD_PLANARITY_H 2 | #define IGL_QUAD_PLANARITY_H 3 | #include "igl_inline.h" 4 | #include 5 | namespace igl 6 | { 7 | // Compute planarity of the faces of a quad mesh 8 | // Inputs: 9 | // V #V by 3 eigen Matrix of mesh vertex 3D positions 10 | // F #F by 4 eigen Matrix of face (quad) indices 11 | // Output: 12 | // P #F by 1 eigen Matrix of mesh face (quad) planarities 13 | // 14 | template 15 | IGL_INLINE void quad_planarity( 16 | const Eigen::PlainObjectBase& V, 17 | const Eigen::PlainObjectBase& F, 18 | Eigen::PlainObjectBase & P); 19 | } 20 | 21 | #ifndef IGL_STATIC_LIBRARY 22 | # include "quad_planarity.cpp" 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /igl/canonical_quaternions.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "canonical_quaternions.h" 9 | 10 | template <> IGL_INLINE float igl::CANONICAL_VIEW_QUAT(int i, int j) 11 | { 12 | return (float)igl::CANONICAL_VIEW_QUAT_F[i][j]; 13 | } 14 | template <> IGL_INLINE double igl::CANONICAL_VIEW_QUAT(int i, int j) 15 | { 16 | return (double)igl::CANONICAL_VIEW_QUAT_D[i][j]; 17 | } 18 | 19 | #ifdef IGL_STATIC_LIBRARY 20 | // Explicit template specialization 21 | #endif 22 | -------------------------------------------------------------------------------- /mesh/segmentsgraph.h: -------------------------------------------------------------------------------- 1 | #ifndef SEGMENTSGRAPH_H 2 | #define SEGMENTSGRAPH_H 3 | 4 | //QT 5 | #include 6 | #include 7 | 8 | //std 9 | #include 10 | 11 | //Custom 12 | #include "mesh/meshsegment.h" 13 | 14 | class SegmentsGraph : public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | SegmentsGraph(QObject *parent = 0); 19 | auto loadSegments(QString dir, QJsonArray jsonArray, 20 | trimesh::point mean, float max_coeff) -> void; 21 | auto loadPrimitives(QJsonArray jsonPrimitives, Eigen::Matrix3f rot, Eigen::Matrix3f invRot) -> void; 22 | auto getSegments(std::vector& segs) -> void; 23 | 24 | signals: 25 | 26 | public slots: 27 | 28 | private: 29 | std::vector segments; 30 | 31 | }; 32 | 33 | #endif // SEGMENTSGRAPH_H 34 | -------------------------------------------------------------------------------- /igl/boolean/to_cork_mesh.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_TO_CORK_MESH_H 2 | #define IGL_TO_CORK_MESH_H 3 | #ifndef IGL_NO_CORK 4 | #include 5 | #include 6 | #include 7 | namespace igl 8 | { 9 | // Convert a (V,F) mesh to a cork's triangle mesh representation. 10 | // 11 | // Inputs: 12 | // V #V by 3 list of vertex positions 13 | // F #F by 3 list of triangle indices into V 14 | // Outputs: 15 | // mesh cork representation of mesh 16 | template < 17 | typename DerivedV, 18 | typename DerivedF> 19 | IGL_INLINE void to_cork_mesh( 20 | const Eigen::PlainObjectBase & V, 21 | const Eigen::PlainObjectBase & F, 22 | CorkTriMesh & mesh); 23 | } 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "to_cork_mesh.cpp" 26 | #endif 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_METISSUPPORT_MODULE_H 2 | #define EIGEN_METISSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | 13 | /** \ingroup Support_modules 14 | * \defgroup MetisSupport_Module MetisSupport module 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 20 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 21 | */ 22 | 23 | 24 | #include "src/MetisSupport/MetisSupport.h" 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_METISSUPPORT_MODULE_H 29 | -------------------------------------------------------------------------------- /igl/boolean/from_cork_mesh.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_FROM_CORK_MESH_H 2 | #define IGL_FROM_CORK_MESH_H 3 | #ifndef IGL_NO_CORK 4 | #include 5 | #include 6 | #include 7 | namespace igl 8 | { 9 | // Convert cork's triangle mesh representation to a (V,F) mesh. 10 | // 11 | // Inputs: 12 | // mesh cork representation of mesh 13 | // Outputs: 14 | // V #V by 3 list of vertex positions 15 | // F #F by 3 list of triangle indices into V 16 | template < 17 | typename DerivedV, 18 | typename DerivedF> 19 | IGL_INLINE void from_cork_mesh( 20 | const CorkTriMesh & mesh, 21 | Eigen::PlainObjectBase & V, 22 | Eigen::PlainObjectBase & F); 23 | } 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "from_cork_mesh.cpp" 26 | #endif 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/exterior_edges.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_EXTERIOR_EDGES_H 2 | #define IGL_EXTERIOR_EDGES_H 3 | #include "igl_inline.h" 4 | #include 5 | namespace igl 6 | { 7 | // EXTERIOR_EDGES Determines boundary "edges" and also edges with an 8 | // odd number of occurances where seeing edge (i,j) counts as +1 and seeing 9 | // the opposite edge (j,i) counts as -1 10 | // 11 | // Inputs: 12 | // F #F by simplex_size list of "faces" 13 | // Outputs: 14 | // E #E by simplex_size-1 list of exterior edges 15 | // 16 | IGL_INLINE void exterior_edges( 17 | const Eigen::MatrixXi & F, 18 | Eigen::MatrixXi & E); 19 | // Inline version 20 | IGL_INLINE Eigen::MatrixXi exterior_edges( const Eigen::MatrixXi & F); 21 | } 22 | #ifndef IGL_STATIC_LIBRARY 23 | # include "exterior_edges.cpp" 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /igl/cgal/RemeshSelfIntersectionsParam.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_REMESH_SELF_INTERSECTIONS_PARAM_H 9 | #define IGL_REMESH_SELF_INTERSECTIONS_PARAM_H 10 | 11 | namespace igl 12 | { 13 | // Optional Parameters 14 | // DetectOnly Only compute IF, leave VV and FF alone 15 | struct RemeshSelfIntersectionsParam 16 | { 17 | bool detect_only; 18 | bool first_only; 19 | RemeshSelfIntersectionsParam():detect_only(false),first_only(false){}; 20 | }; 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /igl/ONE.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ONE_H 9 | #define IGL_ONE_H 10 | // Often one needs a reference to a dummy variable containing one as its 11 | // value, for example when using AntTweakBar's 12 | // TwSetParam( "3D View", "opened", TW_PARAM_INT32, 1, &INT_ONE); 13 | namespace igl 14 | { 15 | const char CHAR_ONE = 1; 16 | const int INT_ONE = 1; 17 | const unsigned int UNSIGNED_INT_ONE = 1; 18 | const double DOUBLE_ONE = 1; 19 | const float FLOAT_ONE = 1; 20 | } 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /igl/ZERO.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ZERO_H 9 | #define IGL_ZERO_H 10 | // Often one needs a reference to a dummy variable containing zero as its 11 | // value, for example when using AntTweakBar's 12 | // TwSetParam( "3D View", "opened", TW_PARAM_INT32, 1, &INT_ZERO); 13 | namespace igl 14 | { 15 | const char CHAR_ZERO = 0; 16 | const int INT_ZERO = 0; 17 | const unsigned int UNSIGNED_INT_ZERO = 0; 18 | const double DOUBLE_ZERO = 0; 19 | const float FLOAT_ZERO = 0; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /igl/example_fun.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "example_fun.h" 9 | #include 10 | 11 | template 12 | IGL_INLINE bool igl::example_fun(const Printable & input) 13 | { 14 | using namespace std; 15 | cout<<"example_fun: "<(const double& input); 22 | template bool igl::example_fun(const int& input); 23 | #endif 24 | -------------------------------------------------------------------------------- /igl/up_axis.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "up_axis.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include "OpenGL_convenience.h" 12 | 13 | IGL_INLINE void igl::up_axis(double * x, double * y, double * z) 14 | { 15 | double mv[16]; 16 | glGetDoublev(GL_MODELVIEW_MATRIX, mv); 17 | igl::up_axis(mv,x,y,z); 18 | } 19 | 20 | IGL_INLINE void igl::up_axis(const double *mv, double * x, double * y, double * z) 21 | { 22 | *x = -mv[0*4+1]; 23 | *y = -mv[1*4+1]; 24 | *z = -mv[2*4+1]; 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/angular_distance.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "angular_distance.h" 9 | #include 10 | #include 11 | IGL_INLINE double igl::angular_distance( 12 | const Eigen::Quaterniond & A, 13 | const Eigen::Quaterniond & B) 14 | { 15 | assert(fabs(A.norm()-1) 6 | namespace igl 7 | { 8 | // Create a texture+framebuffer+depthbuffer triplet bound for rendering into 9 | // the texture; 10 | // 11 | // Inputs: 12 | // width image width 13 | // height image height 14 | // Outputs: 15 | // tex_id id of the texture 16 | // fbo_id id of the frame buffer object 17 | // dfbo_id id of the depth frame buffer object 18 | IGL_INLINE void init_render_to_texture( 19 | const size_t width, 20 | const size_t height, 21 | GLuint & tex_id, 22 | GLuint & fbo_id, 23 | GLuint & dfbo_id); 24 | } 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "init_render_to_texture.cpp" 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/random_quaternion.cpp: -------------------------------------------------------------------------------- 1 | #include "random_quaternion.h" 2 | 3 | template 4 | IGL_INLINE Eigen::Quaternion igl::random_quaternion() 5 | { 6 | // http://mathproofs.blogspot.com/2005/05/uniformly-distributed-random-unit.html 7 | const auto & unit_rand = []()->Scalar 8 | { 9 | return ((Scalar)rand() / (Scalar)RAND_MAX); 10 | }; 11 | const Scalar t0 = 2.*M_PI*unit_rand(); 12 | const Scalar t1 = acos(1.-2.*unit_rand()); 13 | const Scalar t2 = 0.5*(M_PI*unit_rand() + acos(unit_rand())); 14 | return Eigen::Quaternion( 15 | 1.*sin(t0)*sin(t1)*sin(t2), 16 | 1.*cos(t0)*sin(t1)*sin(t2), 17 | 1.*cos(t1)*sin(t2), 18 | 1.*cos(t2)); 19 | } 20 | 21 | #ifdef IGL_STATIC_LIBRARY 22 | // Explicit template specialization 23 | template Eigen::Quaternion igl::random_quaternion(); 24 | #endif 25 | -------------------------------------------------------------------------------- /Eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | /** \defgroup LeastSquares_Module LeastSquares module 19 | * This module provides linear regression and related features. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/Eigen2Support/LeastSquares.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN2_SUPPORT 31 | 32 | #endif // EIGEN_REGRESSION_MODULE_H 33 | -------------------------------------------------------------------------------- /igl/EPS.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "EPS.h" 9 | 10 | template <> IGL_INLINE float igl::EPS() 11 | { 12 | return igl::FLOAT_EPS; 13 | } 14 | template <> IGL_INLINE double igl::EPS() 15 | { 16 | return igl::DOUBLE_EPS; 17 | } 18 | 19 | template <> IGL_INLINE float igl::EPS_SQ() 20 | { 21 | return igl::FLOAT_EPS_SQ; 22 | } 23 | template <> IGL_INLINE double igl::EPS_SQ() 24 | { 25 | return igl::DOUBLE_EPS_SQ; 26 | } 27 | 28 | #ifdef IGL_STATIC_LIBRARY 29 | // Explicit template specialization 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/is_file.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "is_file.h" 9 | 10 | #include 11 | #ifdef _WIN32 12 | # ifndef S_ISREG 13 | # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 14 | # endif 15 | #endif 16 | IGL_INLINE bool igl::is_file(const char * filename) 17 | { 18 | struct stat status; 19 | if(stat(filename,&status)!=0) 20 | { 21 | // path does not exist 22 | return false; 23 | } 24 | // Tests whether existing path is a regular file 25 | return S_ISREG(status.st_mode); 26 | } 27 | -------------------------------------------------------------------------------- /igl/any_of.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ANY_OF_H 9 | #define IGL_ANY_OF_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Wrapper for STL `any_of` for matrix types 14 | // 15 | // Inputs: 16 | // S matrix 17 | // Returns whether any entries are true 18 | // 19 | // Seems that Eigen (now) implements this for `Eigen::Array` 20 | template 21 | IGL_INLINE bool any_of(const Mat & S); 22 | } 23 | #ifndef IGL_STATIC_LIBRARY 24 | # include "any_of.cpp" 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /igl/right_axis.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "right_axis.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include "OpenGL_convenience.h" 12 | 13 | IGL_INLINE void igl::right_axis(double * x, double * y, double * z) 14 | { 15 | double mv[16]; 16 | glGetDoublev(GL_MODELVIEW_MATRIX, mv); 17 | igl::right_axis(mv,x,y,z); 18 | } 19 | 20 | IGL_INLINE void igl::right_axis(const double * mv,double * x, double * y, double * z) 21 | { 22 | *x = -mv[0*4+0]; 23 | *y = -mv[1*4+0]; 24 | *z = -mv[2*4+0]; 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /igl/nchoosek.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Olga Diamanti 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef IGL_NCHOOSEK 10 | #define IGL_NCHOOSEK 11 | #include "igl_inline.h" 12 | #include 13 | 14 | #include 15 | 16 | namespace igl { 17 | IGL_INLINE void nchoosek(int offset, 18 | int k, 19 | int N, 20 | std::vector > &allCombs); 21 | } 22 | 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | #include "nchoosek.cpp" 26 | #endif 27 | 28 | 29 | #endif /* defined(IGL_NCHOOSEK) */ 30 | -------------------------------------------------------------------------------- /igl/print_gl_get.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PRINT_GL_GET_H 9 | #define IGL_PRINT_GL_GET_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | namespace igl 16 | { 17 | // Prints the value of pname found by issuing glGet*(pname,*) 18 | // Inputs: 19 | // pname enum key to gl parameter 20 | IGL_INLINE void print_gl_get(GLenum pname); 21 | } 22 | 23 | #ifndef IGL_STATIC_LIBRARY 24 | # include "print_gl_get.cpp" 25 | #endif 26 | 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/print_shader_info_log.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PRINT_SHADER_INFO_LOG_H 9 | #define IGL_PRINT_SHADER_INFO_LOG_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | namespace igl 16 | { 17 | // Inputs: 18 | // obj OpenGL index of shader to print info log about 19 | IGL_INLINE void print_shader_info_log(const GLuint obj); 20 | } 21 | 22 | #ifndef IGL_STATIC_LIBRARY 23 | # include "print_shader_info_log.cpp" 24 | #endif 25 | 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/writeOFF.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_WRITEOFF_H 9 | #define IGL_WRITEOFF_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace igl 16 | { 17 | template 18 | IGL_INLINE bool writeOFF( 19 | const std::string str, 20 | const Eigen::PlainObjectBase& V, 21 | const Eigen::PlainObjectBase& F); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "writeOFF.cpp" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /igl/print_program_info_log.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PRINT_PROGRAM_INFO_LOG_H 9 | #define IGL_PRINT_PROGRAM_INFO_LOG_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | namespace igl 16 | { 17 | // Inputs: 18 | // obj OpenGL index of program to print info log about 19 | IGL_INLINE void print_program_info_log(const GLuint obj); 20 | } 21 | 22 | #ifndef IGL_STATIC_LIBRARY 23 | # include "print_program_info_log.cpp" 24 | #endif 25 | 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/snap_to_fixed_up.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "snap_to_fixed_up.h" 9 | 10 | IGL_INLINE void igl::snap_to_fixed_up( 11 | const Eigen::Quaterniond & q, 12 | Eigen::Quaterniond & s) 13 | { 14 | using namespace Eigen; 15 | const Vector3d up = q.matrix() * Vector3d(0,1,0); 16 | Vector3d proj_up(0,up(1),up(2)); 17 | if(proj_up.norm() == 0) 18 | { 19 | proj_up = Vector3d(0,1,0); 20 | } 21 | proj_up.normalize(); 22 | Quaterniond dq; 23 | dq = Quaterniond::FromTwoVectors(up,proj_up); 24 | s = dq * q; 25 | } 26 | -------------------------------------------------------------------------------- /igl/draw_beach_ball.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_DRAW_BEACH_BALL_H 9 | #define IGL_DRAW_BEACH_BALL_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | namespace igl 14 | { 15 | // Draw a beach ball icon/glyph (from AntTweakBar) at the current origin 16 | // according to the current orientation: ball has radius 0.75 and axis have 17 | // length 1.15 18 | IGL_INLINE void draw_beach_ball(); 19 | } 20 | 21 | #ifndef IGL_STATIC_LIBRARY 22 | # include "draw_beach_ball.cpp" 23 | #endif 24 | 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /igl/null.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "null.h" 9 | #include "EPS.h" 10 | 11 | template 12 | IGL_INLINE void igl::null( 13 | const Eigen::PlainObjectBase & A, 14 | Eigen::PlainObjectBase & N) 15 | { 16 | using namespace Eigen; 17 | typedef typename DerivedA::Scalar Scalar; 18 | JacobiSVD svd(A, ComputeFullV); 19 | svd.setThreshold(A.cols() * svd.singularValues().maxCoeff() * EPS()); 20 | N = svd.matrixV().rightCols(A.cols()-svd.rank()); 21 | } 22 | -------------------------------------------------------------------------------- /igl/dot_row.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Daniele Panozzo 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "igl/dot_row.h" 9 | 10 | template 11 | IGL_INLINE Eigen::PlainObjectBase igl::dot_row( 12 | const Eigen::PlainObjectBase& A, 13 | const Eigen::PlainObjectBase& B 14 | ) 15 | { 16 | assert(A.rows() == B.rows()); 17 | assert(A.cols() == B.cols()); 18 | 19 | return (A.array() * B.array()).rowwise().sum(); 20 | } 21 | 22 | #ifdef IGL_STATIC_LIBRARY 23 | // Explicit template specialization 24 | // generated by autoexplicit.sh 25 | #endif 26 | -------------------------------------------------------------------------------- /igl/mosek/mosek_guarded.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "mosek_guarded.h" 9 | #include 10 | 11 | IGL_INLINE MSKrescodee igl::mosek_guarded(const MSKrescodee r) 12 | { 13 | using namespace std; 14 | if(r != MSK_RES_OK) 15 | { 16 | /* In case of an error print error code and description. */ 17 | char symname[MSK_MAX_STR_LEN]; 18 | char desc[MSK_MAX_STR_LEN]; 19 | MSK_getcodedesc(r,symname,desc); 20 | cerr<<"MOSEK ERROR ("< 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "bounding_box_diagonal.h" 9 | #include "mat_max.h" 10 | #include "mat_min.h" 11 | #include 12 | 13 | IGL_INLINE double igl::bounding_box_diagonal( 14 | const Eigen::MatrixXd & V) 15 | { 16 | using namespace Eigen; 17 | VectorXd maxV,minV; 18 | VectorXi maxVI,minVI; 19 | mat_max(V,1,maxV,maxVI); 20 | mat_min(V,1,minV,minVI); 21 | return sqrt((maxV-minV).array().square().sum()); 22 | } 23 | 24 | #ifdef IGL_STATIC_LIBRARY 25 | // Explicit template instanciation 26 | #endif 27 | -------------------------------------------------------------------------------- /igl/median.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MEDIAN_H 9 | #define IGL_MEDIAN_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Compute the median of an eigen vector 15 | // 16 | // Inputs: 17 | // V #V list of unsorted values 18 | // Outputs: 19 | // m median of those values 20 | // Returns true on success, false on failure 21 | IGL_INLINE bool median(const Eigen::VectorXd & V, double & m); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "median.cpp" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/mosek/mosek_guarded.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MOSEK_GUARDED_H 9 | #define IGL_MOSEK_GUARDED_H 10 | #include "../igl_inline.h" 11 | 12 | #include "mosek.h" 13 | namespace igl 14 | { 15 | // Little function to wrap around mosek call to handle errors 16 | // 17 | // Inputs: 18 | // r mosek error code returned from mosek call 19 | // Returns r untouched 20 | IGL_INLINE MSKrescodee mosek_guarded(const MSKrescodee r); 21 | } 22 | 23 | #ifndef IGL_STATIC_LIBRARY 24 | # include "mosek_guarded.cpp" 25 | #endif 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /igl/gl_type_size.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_GL_TYPE_SIZE_H 9 | #define IGL_GL_TYPE_SIZE_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | namespace igl 16 | { 17 | // Return the number of bytes for a given OpenGL type 18 | // Inputs: 19 | // type enum value of opengl type 20 | // Returns size in bytes of type 21 | IGL_INLINE int gl_type_size(const GLenum type); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "gl_type_size.cpp" 26 | #endif 27 | 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/report_gl_error.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "report_gl_error.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include 12 | #include "verbose.h" 13 | 14 | IGL_INLINE GLenum igl::report_gl_error(const std::string id) 15 | { 16 | GLenum err = glGetError(); 17 | if(GL_NO_ERROR != err) 18 | { 19 | verbose("GL_ERROR: "); 20 | fprintf(stderr,"%s%s\n",id.c_str(),gluErrorString(err)); 21 | } 22 | return err; 23 | } 24 | 25 | IGL_INLINE GLenum igl::report_gl_error() 26 | { 27 | return igl::report_gl_error(std::string("")); 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /resources/shaders/box.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | layout( location = 0 ) out vec4 color; 4 | 5 | uniform vec3 box_colour; 6 | uniform bool hasGeomShader; 7 | uniform bool dashedLines; 8 | 9 | in vec2 ab_line; 10 | in vec2 a_point; 11 | 12 | void main() 13 | { 14 | 15 | float alpha = hasGeomShader ? 0.5 : 1.0; 16 | if(dashedLines) 17 | { 18 | vec2 ap_line = a_point - gl_FragCoord.xy; 19 | vec2 line_proj = a_point + dot(ap_line, ab_line) / dot(ab_line, ab_line) * ab_line; 20 | 21 | if (cos(0.4*abs(distance(a_point, line_proj))) + 0.1 > 0.0) 22 | { 23 | color = vec4(255,0,0,0); 24 | } 25 | else 26 | { 27 | color = vec4(box_colour[0], box_colour[1], box_colour[2], 0.2); 28 | } 29 | } 30 | else 31 | { 32 | color = vec4(box_colour[0], box_colour[1], box_colour[2], alpha); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /igl/IO: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IO 9 | #define IGL_IO 10 | // Input and output functions 11 | #include "read_triangle_mesh.h" 12 | #include "readDMAT.h" 13 | #include "readMESH.h" 14 | #include "readNODE.h" 15 | #include "readOBJ.h" 16 | #include "readOFF.h" 17 | #include "readTGF.h" 18 | #include "readWRL.h" 19 | #include "readCSV.h" 20 | #include "file_contents_as_string.h" 21 | #include "write_triangle_mesh.h" 22 | #include "writeDMAT.h" 23 | #include "writeMESH.h" 24 | #include "writeOBJ.h" 25 | #include "writeOFF.h" 26 | #include "writeTGF.h" 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/dirname.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_DIRNAME_H 9 | #define IGL_DIRNAME_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Function like PHP's dirname: /etc/passwd --> /etc, 17 | // Input: 18 | // path string containing input path 19 | // Returns string containing dirname (see php's dirname) 20 | // 21 | // See also: basename, pathinfo 22 | IGL_INLINE std::string dirname(const std::string & path); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "dirname.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Cholesky_Module Cholesky module 9 | * 10 | * 11 | * 12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 13 | * Those decompositions are accessible via the following MatrixBase methods: 14 | * - MatrixBase::llt(), 15 | * - MatrixBase::ldlt() 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | */ 21 | 22 | #include "src/misc/Solve.h" 23 | #include "src/Cholesky/LLT.h" 24 | #include "src/Cholesky/LDLT.h" 25 | #ifdef EIGEN_USE_LAPACKE 26 | #include "src/Cholesky/LLT_MKL.h" 27 | #endif 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_CHOLESKY_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | -------------------------------------------------------------------------------- /igl/is_dir.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "is_dir.h" 9 | 10 | #include 11 | 12 | #ifndef S_ISDIR 13 | #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 14 | #endif 15 | 16 | #ifndef S_ISREG 17 | #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 18 | #endif 19 | 20 | IGL_INLINE bool igl::is_dir(const char * filename) 21 | { 22 | struct stat status; 23 | if(stat(filename,&status)!=0) 24 | { 25 | // path does not exist 26 | return false; 27 | } 28 | // Tests whether existing path is a directory 29 | return S_ISDIR(status.st_mode); 30 | } 31 | -------------------------------------------------------------------------------- /igl/basename.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_BASENAME_H 9 | #define IGL_BASENAME_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Function like PHP's basename: /etc/sudoers.d --> sudoers.d 17 | // Input: 18 | // path string containing input path 19 | // Returns string containing basename (see php's basename) 20 | // 21 | // See also: dirname, pathinfo 22 | IGL_INLINE std::string basename(const std::string & path); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "basename.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/column_to_quats.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "column_to_quats.h" 9 | IGL_INLINE bool igl::column_to_quats( 10 | const Eigen::VectorXd & Q, 11 | std::vector< 12 | Eigen::Quaterniond,Eigen::aligned_allocator > & vQ) 13 | { 14 | using namespace Eigen; 15 | if(Q.size() % 4 != 0) 16 | { 17 | return false; 18 | } 19 | const int nQ = Q.size()/4; 20 | vQ.resize(nQ); 21 | for(int q=0;q 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "gl_type_size.h" 9 | #ifndef IGL_NO_OPENGL 10 | #include 11 | 12 | IGL_INLINE int igl::gl_type_size(const GLenum type) 13 | { 14 | switch(type) 15 | { 16 | case GL_DOUBLE: 17 | return 8; 18 | break; 19 | case GL_FLOAT: 20 | return 4; 21 | break; 22 | case GL_INT: 23 | return 4; 24 | break; 25 | default: 26 | // should handle all other GL_[types] 27 | assert(false && "Implementation incomplete."); 28 | break; 29 | } 30 | return -1; 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /igl/sort_angles.h: -------------------------------------------------------------------------------- 1 | #ifndef SORT_ANGLES_H 2 | #define SORT_ANGLES_H 3 | 4 | #include "igl_inline.h" 5 | 6 | namespace igl { 7 | // Sort angles in ascending order in a numerically robust way. 8 | // 9 | // Instead of computing angles using atan2(y, x), sort directly on (y, x). 10 | // 11 | // Inputs: 12 | // M: m by n matrix of scalars. (n >= 2). Assuming the first column of M 13 | // contains values for y, and the second column is x. Using the rest 14 | // of the columns as tie-breaker. 15 | // R: an array of m indices. M.row(R[i]) contains the i-th smallest 16 | // angle. 17 | template 18 | IGL_INLINE void sort_angles( 19 | const Eigen::PlainObjectBase& M, 20 | Eigen::PlainObjectBase& R); 21 | } 22 | 23 | #ifndef IGL_STATIC_LIBRARY 24 | #include "sort_angles.cpp" 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/quat_conjugate.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "quat_conjugate.h" 9 | 10 | template 11 | IGL_INLINE void igl::quat_conjugate( 12 | const Q_type *q1, 13 | Q_type *out) 14 | { 15 | out[0] = -q1[0]; 16 | out[1] = -q1[1]; 17 | out[2] = -q1[2]; 18 | out[3] = q1[3]; 19 | } 20 | 21 | #ifdef IGL_STATIC_LIBRARY 22 | // Explicit template specialization 23 | // generated by autoexplicit.sh 24 | template void igl::quat_conjugate(double const*, double*); 25 | // generated by autoexplicit.sh 26 | template void igl::quat_conjugate(float const*, float*); 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/max_size.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MAX_SIZE_H 9 | #define IGL_MAX_SIZE_H 10 | #include "igl_inline.h" 11 | #include 12 | 13 | namespace igl 14 | { 15 | // Determine max size of lists in a vector 16 | // Template: 17 | // T some list type object that implements .size() 18 | // Inputs: 19 | // V vector of list types T 20 | // Returns max .size() found in V, returns -1 if V is empty 21 | template 22 | IGL_INLINE int max_size(const std::vector & V); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "max_size.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /optimisation/utility_functions.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILITY_FUNCTIONS_H 2 | #define UTILITY_FUNCTIONS_H 3 | 4 | #include "Eigen/Core" 5 | #include "Eigen/Geometry" 6 | #include "Eigen/Dense" 7 | #include 8 | #include 9 | 10 | namespace utility 11 | { 12 | auto completeNormal(Eigen::Matrix face1) -> Eigen::Vector3f; 13 | auto completeCentroid(Eigen::Matrix face1) -> Eigen::Vector3f; 14 | auto hasCoPlanarRelation(Eigen::Matrix face1, Eigen::Matrix face2) -> bool; 15 | auto hasOrthogonalRelation(Eigen::Matrix face1, Eigen::Matrix face2) -> int; 16 | auto hasCoAxialRelation(int axis1, Eigen::Matrix face1, int axis2, Eigen::Matrix face2) -> bool; 17 | auto findMidPlane(int axisId, Eigen::Matrix faceA, Eigen::Matrix faceB) -> Eigen::Matrix; 18 | } 19 | #endif // UTILITY_FUNCTIONS_H 20 | -------------------------------------------------------------------------------- /igl/min_size.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MIN_SIZE_H 9 | #define IGL_MIN_SIZE_H 10 | #include "igl_inline.h" 11 | #include 12 | 13 | namespace igl 14 | { 15 | // Determine min size of lists in a vector 16 | // Template: 17 | // T some list type object that implements .size() 18 | // Inputs: 19 | // V vector of list types T 20 | // Returns min .size() found in V, returns -1 if V is empty 21 | template 22 | IGL_INLINE int min_size(const std::vector & V); 23 | } 24 | 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "min_size.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/ceil.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_CEIL_H 9 | #define IGL_CEIL_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Ceil a given matrix to nearest integers 15 | // 16 | // Inputs: 17 | // X m by n matrix of scalars 18 | // Outputs: 19 | // Y m by n matrix of ceiled integers 20 | template < typename DerivedX, typename DerivedY> 21 | IGL_INLINE void ceil( 22 | const Eigen::PlainObjectBase& X, 23 | Eigen::PlainObjectBase& Y); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "ceil.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/floor.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FLOOR_H 9 | #define IGL_FLOOR_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Floor a given matrix to nearest integers 15 | // 16 | // Inputs: 17 | // X m by n matrix of scalars 18 | // Outputs: 19 | // Y m by n matrix of floored integers 20 | template < typename DerivedX, typename DerivedY> 21 | IGL_INLINE void floor( 22 | const Eigen::PlainObjectBase& X, 23 | Eigen::PlainObjectBase& Y); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "floor.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/file_dialog_open.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Daniele Panozzo 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FILE_DIALOG_OPEN_H 9 | #define IGL_FILE_DIALOG_OPEN_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Returns a string with a path to an existing file 17 | // The string is returned empty if no file is selected 18 | // (on Linux machines, it assumes that Zenity is installed) 19 | // 20 | // Usage: 21 | // std::string str = get_open_file_path(); 22 | IGL_INLINE std::string file_dialog_open(); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "file_dialog_open.cpp" 27 | #endif 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /igl/fit_rigid.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FIT_RIGID_H 9 | #define IGL_FIT_RIGID_H 10 | 11 | #warning "Deprecated. Use igl/procrustes.h instead" 12 | #include "igl_inline.h" 13 | #include 14 | #include 15 | 16 | namespace igl 17 | { 18 | // Deprecated: please use procrustes(...) instead. 19 | // Fit a rigid 20 | IGL_INLINE void fit_rigid( 21 | const Eigen::MatrixXd & A, 22 | const Eigen::MatrixXd & B, 23 | Eigen::Rotation2Dd & R, 24 | Eigen::RowVector2d & t); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "fit_rigid.cpp" 29 | #endif 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /igl/matlab/prepare_lhs.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_PREPARE_LHS_H 2 | #define IGL_PREPARE_LHS_H 3 | #include 4 | #include 5 | #include 6 | namespace igl 7 | { 8 | // Writes out a matrix as a double 9 | // 10 | // Inputs: 11 | // prhs points to rhs argument 12 | // Outputs: 13 | // V M by N matrix 14 | template 15 | IGL_INLINE void prepare_lhs_double( 16 | const Eigen::PlainObjectBase & V, 17 | mxArray *plhs[]); 18 | // Casts to logical 19 | template 20 | IGL_INLINE void prepare_lhs_logical( 21 | const Eigen::PlainObjectBase & V, 22 | mxArray *plhs[]); 23 | // Writes out a matrix and adds 1 24 | template 25 | IGL_INLINE void prepare_lhs_index( 26 | const Eigen::PlainObjectBase & V, 27 | mxArray *plhs[]); 28 | }; 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "prepare_lhs.cpp" 31 | #endif 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /igl/mod.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MOD_H 9 | #define IGL_MOD_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Compute elementwise mod: B = A % base 15 | // 16 | // Inputs: 17 | // A m by n matrix 18 | // base number to mod against 19 | // Outputs: 20 | // B m by n matrix 21 | template 22 | IGL_INLINE void mod( 23 | const Eigen::PlainObjectBase & A, 24 | const int base, 25 | Eigen::PlainObjectBase & B); 26 | } 27 | #ifndef IGL_STATIC_LIBRARY 28 | #include "mod.cpp" 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/compile_shader.cpp: -------------------------------------------------------------------------------- 1 | #include "compile_shader.h" 2 | #include "report_gl_error.h" 3 | #include 4 | 5 | IGL_INLINE GLuint igl::compile_shader(const GLint type, const char * str) 6 | { 7 | GLuint id = glCreateShader(type); 8 | igl::report_gl_error("glCreateShader: "); 9 | glShaderSource(id,1,&str,NULL); 10 | igl::report_gl_error("glShaderSource: "); 11 | glCompileShader(id); 12 | igl::report_gl_error("glCompileShader: "); 13 | 14 | GLint status; 15 | glGetShaderiv(id, GL_COMPILE_STATUS, &status); 16 | if (status != GL_TRUE) 17 | { 18 | char buffer[512]; 19 | if (type == GL_VERTEX_SHADER) 20 | std::cerr << "Vertex shader:" << std::endl; 21 | else if (type == GL_FRAGMENT_SHADER) 22 | std::cerr << "Fragment shader:" << std::endl; 23 | std::cerr << str << std::endl << std::endl; 24 | glGetShaderInfoLog(id, 512, NULL, buffer); 25 | std::cerr << "Error: " << std::endl << buffer << std::endl; 26 | } 27 | return id; 28 | } 29 | -------------------------------------------------------------------------------- /igl/file_exists.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FILE_EXISTS_H 9 | #define IGL_FILE_EXISTS_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Check if a file or directory exists like PHP's file_exists function: 15 | // http://php.net/manual/en/function.file-exists.php 16 | // Input: 17 | // filename path to file 18 | // Returns true if file exists and is readable and false if file doesn't 19 | // exist or *is not readable* 20 | IGL_INLINE bool file_exists(const std::string filename); 21 | } 22 | 23 | #ifndef IGL_STATIC_LIBRARY 24 | # include "file_exists.cpp" 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/get_seconds.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "get_seconds.h" 9 | // NULL for Linux 10 | #include 11 | 12 | #if _WIN32 13 | # include 14 | IGL_INLINE double igl::get_seconds() 15 | { 16 | // This does not work on mac os x with glut in the main loop 17 | return double(clock())/CLOCKS_PER_SEC; 18 | } 19 | #else 20 | # include 21 | IGL_INLINE double igl::get_seconds() 22 | { 23 | timeval time; 24 | gettimeofday(&time, NULL); 25 | return time.tv_sec + time.tv_usec / 1e6; 26 | // This does not work on mac os x with glut in the main loop 27 | //return double(clock())/CLOCKS_PER_SEC; 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /utils/contourparams.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTOURPARAMS_H 2 | #define CONTOURPARAMS_H 3 | 4 | 5 | class ContourParams 6 | { 7 | public: 8 | static ContourParams* getInstance() 9 | { 10 | if(!instance) 11 | instance = new ContourParams(); 12 | return instance; 13 | } 14 | auto getCLimit() -> float; 15 | auto setCLimit(float val) -> void; 16 | auto getJeroenMethod() -> bool; 17 | auto setJeroenMethod(bool val) -> void; 18 | auto getScLimit() -> float; 19 | auto setScLimit(float val) -> void; 20 | auto getDwkrLimit() -> float; 21 | auto setDwkrLimit(float val) -> void; 22 | private: 23 | ContourParams(); 24 | static ContourParams* instance; 25 | bool jeroenmethod; 26 | float cLimit; 27 | float scLimit; 28 | float dwkrLimit; 29 | 30 | //Needed for singleton 31 | ContourParams(ContourParams const&) = delete; 32 | void operator=(ContourParams const&) = delete; 33 | }; 34 | 35 | #endif // CONTOURPARAMS_H 36 | -------------------------------------------------------------------------------- /igl/load_shader.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "load_shader.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | // Copyright Denis Kovacs 4/10/08 12 | #include "print_shader_info_log.h" 13 | #include 14 | IGL_INLINE GLuint igl::load_shader(const char *src,const GLenum type) 15 | { 16 | GLuint s = glCreateShader(type); 17 | if(s == 0) 18 | { 19 | fprintf(stderr,"Error: load_shader() failed to create shader.\n"); 20 | return 0; 21 | } 22 | // Pass shader source string 23 | glShaderSource(s, 1, &src, NULL); 24 | glCompileShader(s); 25 | // Print info log (if any) 26 | igl::print_shader_info_log(s); 27 | return s; 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #define EIGEN_PARDISOSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup PardisoSupport_Module PardisoSupport module 14 | * 15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 23 | * 24 | */ 25 | 26 | #include "src/PardisoSupport/PardisoSupport.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 31 | -------------------------------------------------------------------------------- /igl/example_fun.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_EXAMPLE_FUN_H 9 | #define IGL_EXAMPLE_FUN_H 10 | 11 | #include "igl_inline.h" 12 | 13 | namespace igl 14 | { 15 | // This is an example of a function, it takes a templated parameter and 16 | // shovels it into cout 17 | // 18 | // Templates: 19 | // T type that supports 20 | // Input: 21 | // input some input of a Printable type 22 | // Returns true for the sake of returning something 23 | template 24 | IGL_INLINE bool example_fun(const Printable & input); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "example_fun.cpp" 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /igl/is_planar.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_PLANAR_H 9 | #define IGL_IS_PLANAR_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Determin if a set of points lies on the XY plane 17 | // 18 | // Inputs: 19 | // V #V by dim list of vertex positions 20 | // Return true if a mesh has constant value of 0 in z coordinate 21 | // 22 | // Known bugs: Doesn't determine if vertex is flat if it doesn't lie on the 23 | // XY plane. 24 | IGL_INLINE bool is_planar(const Eigen::MatrixXd & V); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "is_planar.cpp" 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/file_dialog_save.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Daniele Panozzo 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FILE_DIALOG_SAVE_H 9 | #define IGL_FILE_DIALOG_SAVE_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Returns a string with a path to a new/existing file 17 | // The string is returned empty if no file is selected 18 | // (on Linux machines, it assumes that Zenity is installed) 19 | // 20 | // Usage: 21 | // char buffer[FILE_DIALOG_MAX_BUFFER]; 22 | // get_save_file_path(buffer); 23 | IGL_INLINE std::string file_dialog_save(); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "file_dialog_save.cpp" 28 | #endif 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /Eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | /** \defgroup SVD_Module SVD module 11 | * 12 | * 13 | * 14 | * This module provides SVD decomposition for matrices (both real and complex). 15 | * This decomposition is accessible via the following MatrixBase method: 16 | * - MatrixBase::jacobiSvd() 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/SVD/JacobiSVD.h" 25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 26 | #include "src/SVD/JacobiSVD_MKL.h" 27 | #endif 28 | #include "src/SVD/UpperBidiagonalization.h" 29 | 30 | #ifdef EIGEN2_SUPPORT 31 | #include "src/Eigen2Support/SVD.h" 32 | #endif 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_SVD_MODULE_H 37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 38 | -------------------------------------------------------------------------------- /igl/bounding_box_diagonal.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_BOUNDING_BOX_DIAGONAL_H 9 | #define IGL_BOUNDING_BOX_DIAGONAL_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Compute the length of the diagonal of a given meshes axis-aligned bounding 15 | // box 16 | // 17 | // Inputs: 18 | // V #V by 3 list of vertex positions 19 | // F #F by 3 list of triangle indices into V 20 | // Returns length of bounding box diagonal 21 | IGL_INLINE double bounding_box_diagonal( const Eigen::MatrixXd & V); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "bounding_box_diagonal.cpp" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /unsupported/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "src/Splines/SplineFwd.h" 28 | #include "src/Splines/Spline.h" 29 | #include "src/Splines/SplineFitting.h" 30 | 31 | #endif // EIGEN_SPLINES_MODULE_H 32 | -------------------------------------------------------------------------------- /igl/compile_shader.h: -------------------------------------------------------------------------------- 1 | #ifndef IGL_COMPILE_SHADER_H 2 | #define IGL_COMPILE_SHADER_H 3 | #include "OpenGL_convenience.h" 4 | #include "igl_inline.h" 5 | namespace igl 6 | { 7 | // Compile a shader given type and string of shader code 8 | // 9 | // Inputs: 10 | // type either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER 11 | // str contents of shader code 12 | // Returns result of glCreateShader (id of shader) 13 | // 14 | // Example: 15 | // GLuint vid = compile_shader(GL_VERTEX_SHADER,vertex_shader.c_str()); 16 | // GLuint fid = compile_shader(GL_FRAGMENT_SHADER,fragment_shader.c_str()); 17 | // GLuint prog_id = glCreateProgram(); 18 | // glAttachShader(prog_id,vid); 19 | // glAttachShader(prog_id,fid); 20 | // glLinkProgram(prog_id); 21 | // 22 | // Known bugs: seems to be duplicate of `load_shader` 23 | IGL_INLINE GLuint compile_shader(const GLint type, const char * str); 24 | } 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "compile_shader.cpp" 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/randperm.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_RANDPERM_H 9 | #define IGL_RANDPERM_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Like matlab's randperm(n) but minus 1 15 | // 16 | // Inputs: 17 | // n number of elements 18 | // Outputs: 19 | // I n list of rand permutation of 0:n-1 20 | template 21 | IGL_INLINE void randperm( 22 | const int n, 23 | Eigen::PlainObjectBase & I); 24 | template 25 | IGL_INLINE Eigen::PlainObjectBase randperm( const int n); 26 | } 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "randperm.cpp" 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # how2sketch 2 | This is the code for the following paper: 3 | 4 | Hennessey, James W., Han Liu, Holger Winnemöller, Mira Dontcheva and Niloy J. Mitra. “How2Sketch: generating easy-to-follow tutorials for sketching 3D objects.” I3D (2017) 5 | 6 | The code in this repo contains the core algorithms for candidate generation, selection and tutorial generation from the paper. It outputs a json file for a seperate application to view the tutorial. The code is currently being released for documentation purposes of the implementation only. We hope to release a single more user-friendly application later. 7 | 8 | ## Dependencies 9 | * QT 10 | * Gurobi 11 | * GGAL 12 | * Eigen 13 | * IGL 14 | 15 | ## Interface Instructions 16 | * File -> Import.... (json file of segments/prmitives) 17 | * Select "Segment Boxes" radio button 18 | * Find relations (highlighted in red) using the "Find" button 19 | * Generate candidates 20 | * View candidates by selecting "Complete Candidate" button 21 | * Run Optimisation 22 | * Save (JSON File) 23 | -------------------------------------------------------------------------------- /igl/is_readable.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_READABLE_H 9 | #define IGL_IS_READABLE_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Check if a file is reabable like PHP's is_readable function: 14 | // http://www.php.net/manual/en/function.is-readable.php 15 | // Input: 16 | // filename path to file 17 | // Returns true if file exists and is readable and false if file doesn't 18 | // exist or *is not readable* 19 | // 20 | // Note: Windows version will not check user or group ids 21 | IGL_INLINE bool is_readable(const char * filename); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "is_readable.cpp" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/print_program_info_log.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "print_program_info_log.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include 12 | #include 13 | // Copyright Denis Kovacs 4/10/08 14 | IGL_INLINE void igl::print_program_info_log(const GLuint obj) 15 | { 16 | GLint infologLength = 0; 17 | GLint charsWritten = 0; 18 | char *infoLog; 19 | 20 | glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength); 21 | 22 | if (infologLength > 0) 23 | { 24 | infoLog = (char *)malloc(infologLength); 25 | glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog); 26 | printf("%s\n",infoLog); 27 | free(infoLog); 28 | } 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/is_writable.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_WRITABLE_H 9 | #define IGL_IS_WRITABLE_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Check if a file exists *and* is writable like PHP's is_writable function: 14 | // http://www.php.net/manual/en/function.is-writable.php 15 | // Input: 16 | // filename path to file 17 | // Returns true if file exists and is writable and false if file doesn't 18 | // exist or *is not writable* 19 | // 20 | // Note: Windows version will not test group and user id 21 | IGL_INLINE bool is_writable(const char * filename); 22 | } 23 | 24 | #ifndef IGL_STATIC_LIBRARY 25 | # include "is_writable.cpp" 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/print_vector.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_PRINT_VECTOR_H 9 | #define IGL_PRINT_VECTOR_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | namespace igl 14 | { 15 | // Not clear what these are supposed to be doing. Currently they print 16 | // vectors to standard error... 17 | template 18 | IGL_INLINE void print_vector( std::vector& v); 19 | template 20 | IGL_INLINE void print_vector( std::vector< std::vector >& v); 21 | template 22 | IGL_INLINE void print_vector(std::vector< std::vector< std::vector > >& v); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "print_vector.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/report_gl_error.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_REPORT_GL_ERROR_H 9 | #define IGL_REPORT_GL_ERROR_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | #include 16 | 17 | namespace igl 18 | { 19 | // Print last OpenGL error to stderr prefixed by specified id string 20 | // Inputs: 21 | // id string to appear before any error msgs 22 | // Returns result of glGetError() 23 | IGL_INLINE GLenum report_gl_error(const std::string id); 24 | // No prefix 25 | IGL_INLINE GLenum report_gl_error(); 26 | } 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "report_gl_error.cpp" 30 | #endif 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /igl/angular_distance.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ANGULAR_DISTANCE_H 9 | #define IGL_ANGULAR_DISTANCE_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // The "angular distance" between two unit quaternions is the angle of the 15 | // smallest rotation (treated as an Axis and Angle) that takes A to B. 16 | // 17 | // Inputs: 18 | // A unit quaternion 19 | // B unit quaternion 20 | // Returns angular distance 21 | IGL_INLINE double angular_distance( 22 | const Eigen::Quaterniond & A, 23 | const Eigen::Quaterniond & B); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | #include "angular_distance.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/is_dir.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_DIR_H 9 | #define IGL_IS_DIR_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Act like php's is_dir function 14 | // http://php.net/manual/en/function.is-dir.php 15 | // Tells whether the given filename is a directory. 16 | // Input: 17 | // filename Path to the file. If filename is a relative filename, it will 18 | // be checked relative to the current working directory. 19 | // Returns TRUE if the filename exists and is a directory, FALSE 20 | // otherwise. 21 | IGL_INLINE bool is_dir(const char * filename); 22 | 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "is_dir.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/cocoa_key_to_anttweakbar_key.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_COCOA_KEY_TO_ANTTWEAKBAR_KEY_H 9 | #define IGL_COCOA_KEY_TO_ANTTWEAKBAR_KEY_H 10 | #ifndef IGL_NO_ANTTWEAKBAR 11 | #include "igl_inline.h" 12 | 13 | 14 | namespace igl 15 | { 16 | // Convert an unsigned char (like that from Cocoa apps) to AntTweakBar key 17 | // code. 18 | // See also: TranslateKey() in TwMgr.cpp in AntTweakBar source 19 | // Inputs: 20 | // key unsigned char key from keyboard 21 | // Returns int of new key code 22 | IGL_INLINE int cocoa_key_to_anttweakbar_key(int key); 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "cocoa_key_to_anttweakbar_key.cpp" 27 | #endif 28 | 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/median.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "median.h" 9 | #include "matrix_to_list.h" 10 | 11 | #include 12 | #include 13 | 14 | IGL_INLINE bool igl::median(const Eigen::VectorXd & V, double & m) 15 | { 16 | using namespace std; 17 | if(V.size() == 0) 18 | { 19 | return false; 20 | } 21 | vector vV; 22 | matrix_to_list(V,vV); 23 | // http://stackoverflow.com/a/1719155/148668 24 | size_t n = vV.size()/2; 25 | nth_element(vV.begin(),vV.begin()+n,vV.end()); 26 | if(vV.size()%2==0) 27 | { 28 | nth_element(vV.begin(),vV.begin()+n-1,vV.end()); 29 | m = 0.5*(vV[n]+vV[n-1]); 30 | }else 31 | { 32 | m = vV[n]; 33 | } 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /igl/random_dir.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_RANDOM_DIR_H 9 | #define IGL_RANDOM_DIR_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Generate a uniformly random unit direction in 3D, return as vector 17 | IGL_INLINE Eigen::Vector3d random_dir(); 18 | // Generate n stratified uniformly random unit directions in 3d, return as rows 19 | // of an n by 3 matrix 20 | // 21 | // Inputs: 22 | // n number of directions 23 | // Return n by 3 matrix of random directions 24 | IGL_INLINE Eigen::MatrixXd random_dir_stratified(const int n); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "random_dir.cpp" 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /igl/readCSV.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_READ_CSV_H 9 | #define IGL_READ_CSV_H 10 | 11 | #include "igl/igl_inline.h" 12 | #include 13 | #include 14 | #include 15 | 16 | namespace igl 17 | { 18 | // read a matrix from a csv file into a Eigen matrix 19 | // Templates: 20 | // Scalar type for the matrix 21 | // Inputs: 22 | // str path to .csv file 23 | // Outputs: 24 | // M eigen matrix 25 | template 26 | IGL_INLINE bool readCSV( 27 | const std::string str, 28 | Eigen::Matrix& M); 29 | } 30 | 31 | #ifndef IGL_STATIC_LIBRARY 32 | # include "readCSV.cpp" 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /igl/texture_from_tga.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_TEXTURE_FROM_TGA_H 9 | #define IGL_TEXTURE_FROM_TGA_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | #include 16 | 17 | namespace igl 18 | { 19 | // Read an image from a .tga file and use it as a texture 20 | // 21 | // Input: 22 | // tga_file path to .tga file 23 | // Output: 24 | // id of generated openGL texture 25 | // Returns true on success, false on failure 26 | IGL_INLINE bool texture_from_tga(const std::string tga_file, GLuint & id); 27 | } 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "texture_from_tga.cpp" 31 | #endif 32 | 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/file_contents_as_string.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FILE_CONTENTS_AS_STRING_H 9 | #define IGL_FILE_CONTENTS_AS_STRING_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | namespace igl 14 | { 15 | // Read a files contents as plain text into a given string 16 | // Inputs: 17 | // file_name path to file to be read 18 | // Outputs: 19 | // content output string containing contents of the given file 20 | // Returns true on succes, false on error 21 | IGL_INLINE bool file_contents_as_string( 22 | const std::string file_name, 23 | std::string & content); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "file_contents_as_string.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/uniform_type_to_string.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_UNIFORM_TYPE_TO_STRING_H 9 | #define IGL_UNIFORM_TYPE_TO_STRING_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include 14 | 15 | #include "OpenGL_convenience.h" 16 | 17 | namespace igl 18 | { 19 | // Convert a GL uniform variable type (say, returned from 20 | // glGetActiveUniform) and output a string naming that type 21 | // Inputs: 22 | // type enum for given type 23 | // Returns string name of that type 24 | IGL_INLINE std::string uniform_type_to_string(const GLenum type); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "uniform_type_to_string.cpp" 29 | #endif 30 | 31 | #endif 32 | #endif 33 | -------------------------------------------------------------------------------- /unsupported/Eigen/ArpackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_ARPACKSUPPORT_MODULE_H 10 | #define EIGEN_ARPACKSUPPORT_MODULE_H 11 | 12 | #include 13 | 14 | #include 15 | 16 | /** \defgroup ArpackSupport_Module Arpack support module 17 | * 18 | * This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition. 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include 26 | #include "src/Eigenvalues/ArpackSelfAdjointEigenSolver.h" 27 | 28 | #include 29 | 30 | #endif // EIGEN_ARPACKSUPPORT_MODULE_H 31 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 32 | -------------------------------------------------------------------------------- /igl/is_file.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_FILE_H 9 | #define IGL_IS_FILE_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Act like php's is_file function 14 | // http://php.net/manual/en/function.is-file.php 15 | // Tells whether the given filename is a regular file. 16 | // Input: 17 | // filename Path to the file. If filename is a relative filename, it will 18 | // be checked relative to the current working directory. 19 | // Returns TRUE if the filename exists and is a regular file, FALSE 20 | // otherwise. 21 | IGL_INLINE bool is_file(const char * filename); 22 | 23 | } 24 | 25 | #ifndef IGL_STATIC_LIBRARY 26 | # include "is_file.cpp" 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /unsupported/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | namespace Eigen { 17 | 18 | /** 19 | * \defgroup KroneckerProduct_Module KroneckerProduct module 20 | * 21 | * This module contains an experimental Kronecker product implementation. 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | } // namespace Eigen 29 | 30 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 31 | 32 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 33 | 34 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 35 | -------------------------------------------------------------------------------- /utils/contourparams.cpp: -------------------------------------------------------------------------------- 1 | #include "contourparams.h" 2 | 3 | ContourParams* ContourParams::instance = nullptr; 4 | 5 | ContourParams::ContourParams() 6 | : jeroenmethod(true) 7 | , cLimit(1.0f) 8 | , scLimit(1.0f) 9 | , dwkrLimit(1.0f) 10 | { 11 | 12 | } 13 | 14 | 15 | auto ContourParams::getCLimit() -> float 16 | { 17 | return cLimit; 18 | } 19 | 20 | auto ContourParams::setCLimit(float val) -> void 21 | { 22 | cLimit = val; 23 | } 24 | 25 | auto ContourParams::getJeroenMethod() -> bool 26 | { 27 | return jeroenmethod; 28 | } 29 | 30 | auto ContourParams::setJeroenMethod(bool val) -> void 31 | { 32 | jeroenmethod = val; 33 | } 34 | 35 | auto ContourParams::getScLimit() -> float 36 | { 37 | return scLimit; 38 | } 39 | 40 | auto ContourParams::setScLimit(float val) -> void 41 | { 42 | scLimit = val; 43 | } 44 | 45 | auto ContourParams::getDwkrLimit() -> float 46 | { 47 | return dwkrLimit; 48 | } 49 | 50 | auto ContourParams::setDwkrLimit(float val) -> void 51 | { 52 | dwkrLimit = val; 53 | } 54 | -------------------------------------------------------------------------------- /igl/get_seconds_hires.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "get_seconds_hires.h" 9 | 10 | #if _WIN32 11 | # include 12 | # include 13 | IGL_INLINE double igl::get_seconds_hires() 14 | { 15 | LARGE_INTEGER li_freq, li_current; 16 | const bool ret = QueryPerformanceFrequency(&li_freq); 17 | const bool ret2 = QueryPerformanceCounter(&li_current); 18 | assert(ret && ret2); 19 | assert(li_freq.QuadPart > 0); 20 | return double(li_current.QuadPart) / double(li_freq.QuadPart); 21 | } 22 | #else 23 | # include "get_seconds.h" 24 | IGL_INLINE double igl::get_seconds_hires() 25 | { 26 | // Sorry I've no idea how performance counters work on Mac... 27 | return igl::get_seconds(); 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/directed_edge_orientations.cpp: -------------------------------------------------------------------------------- 1 | #include "directed_edge_orientations.h" 2 | 3 | template 4 | IGL_INLINE void igl::directed_edge_orientations( 5 | const Eigen::PlainObjectBase & C, 6 | const Eigen::PlainObjectBase & E, 7 | std::vector< 8 | Eigen::Quaterniond,Eigen::aligned_allocator > & Q) 9 | { 10 | using namespace Eigen; 11 | Q.resize(E.rows()); 12 | for(int e = 0;e, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, std::vector, Eigen::aligned_allocator > >&); 22 | #endif 23 | -------------------------------------------------------------------------------- /igl/mat_to_quat.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_MAT_TO_QUAT_H 9 | #define IGL_MAT_TO_QUAT_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Convert a OpenGL (rotation) matrix to a quaternion 14 | // 15 | // Input: 16 | // m 16-element opengl rotation matrix 17 | // Output: 18 | // q 4-element quaternion (not normalized) 19 | template 20 | IGL_INLINE void mat4_to_quat(const Q_type * m, Q_type * q); 21 | // Input: 22 | // m 9-element opengl rotation matrix 23 | template 24 | IGL_INLINE void mat3_to_quat(const Q_type * m, Q_type * q); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "mat_to_quat.cpp" 29 | #endif 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /igl/quat_mult.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_QUAT_MULT_H 9 | #define IGL_QUAT_MULT_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Computes out = q1 * q2 with quaternion multiplication 15 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 16 | // such that q = x*i + y*j + z*k + w 17 | // Inputs: 18 | // q1 left quaternion 19 | // q2 right quaternion 20 | // Outputs: 21 | // out result of multiplication 22 | template 23 | IGL_INLINE void quat_mult( 24 | const Q_type *q1, 25 | const Q_type *q2, 26 | Q_type *out); 27 | }; 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "quat_mult.cpp" 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /igl/quats_to_column.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "quats_to_column.h" 9 | 10 | IGL_INLINE void igl::quats_to_column( 11 | const std::vector< 12 | Eigen::Quaterniond,Eigen::aligned_allocator > vQ, 13 | Eigen::VectorXd & Q) 14 | { 15 | Q.resize(vQ.size()*4); 16 | for(int q = 0;q<(int)vQ.size();q++) 17 | { 18 | auto & xyzw = vQ[q].coeffs(); 19 | for(int c = 0;c<4;c++) 20 | { 21 | Q(q*4+c) = xyzw(c); 22 | } 23 | } 24 | } 25 | 26 | IGL_INLINE Eigen::VectorXd igl::quats_to_column( 27 | const std::vector< 28 | Eigen::Quaterniond,Eigen::aligned_allocator > vQ) 29 | { 30 | Eigen::VectorXd Q; 31 | quats_to_column(vQ,Q); 32 | return Q; 33 | } 34 | -------------------------------------------------------------------------------- /igl/sample_edges.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "sample_edges.h" 9 | 10 | IGL_INLINE void igl::sample_edges( 11 | const Eigen::MatrixXd & V, 12 | const Eigen::MatrixXi & E, 13 | const int k, 14 | Eigen::MatrixXd & S) 15 | { 16 | using namespace Eigen; 17 | // Resize output 18 | S.resize(V.rows() + k * E.rows(),V.cols()); 19 | // Copy V at front of S 20 | S.block(0,0,V.rows(),V.cols()) = V; 21 | 22 | // loop over edges 23 | for(int i = 0;i 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_NORMALIZE_QUAT_H 9 | #define IGL_NORMALIZE_QUAT_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Normalize a quaternion 15 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 16 | // such that q = x*i + y*j + z*k + w 17 | // Inputs: 18 | // q input quaternion 19 | // Outputs: 20 | // out result of normalization, allowed to be same as q 21 | // Returns true on success, false if len(q) < EPS 22 | template 23 | IGL_INLINE bool normalize_quat( 24 | const Q_type *q, 25 | Q_type *out); 26 | }; 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "normalize_quat.cpp" 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 2 | #define EIGEN_SPQRSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SuiteSparseQR.hpp" 9 | 10 | /** \ingroup Support_modules 11 | * \defgroup SPQRSupport_Module SuiteSparseQR module 12 | * 13 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 14 | * 15 | * \code 16 | * #include 17 | * \endcode 18 | * 19 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 20 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | #include "src/CholmodSupport/CholmodSupport.h" 27 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /igl/bone_parents.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_BONE_PARENTS_H 9 | #define IGL_BONE_PARENTS_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // BONE_PARENTS Recover "parent" bones from directed graph representation. 15 | // 16 | // Inputs: 17 | // BE #BE by 2 list of directed bone edges 18 | // Outputs: 19 | // P #BE by 1 list of parent indices into BE, -1 means root. 20 | // 21 | template 22 | IGL_INLINE void bone_parents( 23 | const Eigen::PlainObjectBase& BE, 24 | Eigen::PlainObjectBase& P); 25 | } 26 | 27 | #ifndef IGL_STATIC_LIBRARY 28 | # include "bone_parents.cpp" 29 | #endif 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /igl/quat_to_mat.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_QUAT_TO_MAT_H 9 | #define IGL_QUAT_TO_MAT_H 10 | #include "igl_inline.h" 11 | // Name history: 12 | // quat2mat until 16 Sept 2011 13 | namespace igl 14 | { 15 | // Convert a quaternion to a 4x4 matrix 16 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 17 | // such that q = x*i + y*j + z*k + w 18 | // Input: 19 | // quat pointer to four elements of quaternion (x,y,z,w) 20 | // Output: 21 | // mat pointer to 16 elements of matrix 22 | template 23 | IGL_INLINE void quat_to_mat(const Q_type * quat, Q_type * mat); 24 | } 25 | 26 | #ifndef IGL_STATIC_LIBRARY 27 | # include "quat_to_mat.cpp" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /igl/is_sparse.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "is_sparse.h" 9 | template 10 | IGL_INLINE bool igl::is_sparse( 11 | const Eigen::SparseMatrix & A) 12 | { 13 | return true; 14 | } 15 | template 16 | IGL_INLINE bool igl::is_sparse( 17 | const Eigen::PlainObjectBase& A) 18 | { 19 | return false; 20 | } 21 | 22 | #ifdef IGL_STATIC_LIBRARY 23 | // Explicit template specialization 24 | // generated by autoexplicit.sh 25 | template bool igl::is_sparse(Eigen::SparseMatrix const&); 26 | // generated by autoexplicit.sh 27 | template bool igl::is_sparse >(Eigen::PlainObjectBase > const&); 28 | #endif 29 | -------------------------------------------------------------------------------- /igl/speye.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "speye.h" 9 | 10 | template 11 | IGL_INLINE void igl::speye(const int m, const int n, Eigen::SparseMatrix & I) 12 | { 13 | // size of diagonal 14 | int d = (m(m,n); 16 | I.reserve(d); 17 | for(int i = 0;i 25 | IGL_INLINE void igl::speye(const int n, Eigen::SparseMatrix & I) 26 | { 27 | return igl::speye(n,n,I); 28 | } 29 | 30 | #ifdef IGL_STATIC_LIBRARY 31 | // Explicit template specialization 32 | // generated by autoexplicit.sh 33 | template void igl::speye(int, Eigen::SparseMatrix&); 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/axis_angle_to_quat.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_AXIS_ANGLE_TO_QUAT_H 9 | #define IGL_AXIS_ANGLE_TO_QUAT_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Convert axis angle representation of a rotation to a quaternion 15 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 16 | // such that q = x*i + y*j + z*k + w 17 | // Inputs: 18 | // axis 3d vector 19 | // angle scalar 20 | // Outputs: 21 | // quaternion 22 | template 23 | IGL_INLINE void axis_angle_to_quat( 24 | const Q_type *axis, 25 | const Q_type angle, 26 | Q_type *out); 27 | } 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "axis_angle_to_quat.cpp" 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /igl/load_shader.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_LOAD_SHADER_H 9 | #define IGL_LOAD_SHADER_H 10 | #ifndef IGL_NO_OPENGL 11 | #include "igl_inline.h" 12 | 13 | #include "OpenGL_convenience.h" 14 | 15 | namespace igl 16 | { 17 | // Creates and compiles a shader from a given string 18 | // Inputs: 19 | // src string containing GLSL shader code 20 | // type GLSL type of shader, one of: 21 | // GL_VERTEX_SHADER 22 | // GL_FRAGMENT_SHADER 23 | // GL_GEOMETRY_SHADER 24 | // Returns index id of the newly created shader, 0 on error 25 | IGL_INLINE GLuint load_shader(const char *src,const GLenum type); 26 | } 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "load_shader.cpp" 30 | #endif 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /unsupported/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "Eigen/Core" 14 | 15 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /igl/file_contents_as_string.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "file_contents_as_string.h" 9 | 10 | #include 11 | #include 12 | 13 | IGL_INLINE bool igl::file_contents_as_string( 14 | const std::string file_name, 15 | std::string & content) 16 | { 17 | std::ifstream ifs(file_name.c_str()); 18 | // Check that opening the stream worked successfully 19 | if(!ifs.good()) 20 | { 21 | fprintf( 22 | stderr, 23 | "IOError: file_contents_as_string() cannot open %s\n", 24 | file_name.c_str()); 25 | return false; 26 | } 27 | // Stream file contents into string 28 | content = std::string( 29 | (std::istreambuf_iterator(ifs)), 30 | (std::istreambuf_iterator())); 31 | return true; 32 | } 33 | -------------------------------------------------------------------------------- /igl/triangles_from_strip.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_TRIANGLES_FROM_STRIP_H 9 | #define IGL_TRIANGLES_FROM_STRIP_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // TRIANGLES_FROM_STRIP Create a list of triangles from a stream of indices 15 | // along a strip. 16 | // 17 | // Inputs: 18 | // S #S list of indices 19 | // Outputs: 20 | // F #S-2 by 3 list of triangle indices 21 | // 22 | template 23 | IGL_INLINE void triangles_from_strip( 24 | const Eigen::MatrixBase& S, 25 | Eigen::PlainObjectBase& F); 26 | } 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "triangles_from_strip.cpp" 30 | #endif 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /igl/print_shader_info_log.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "print_shader_info_log.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include 12 | #include 13 | // Copyright Denis Kovacs 4/10/08 14 | IGL_INLINE void igl::print_shader_info_log(const GLuint obj) 15 | { 16 | GLint infologLength = 0; 17 | GLint charsWritten = 0; 18 | char *infoLog; 19 | 20 | // Get shader info log from opengl 21 | glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength); 22 | // Only print if there is something in the log 23 | if (infologLength > 0) 24 | { 25 | infoLog = (char *)malloc(infologLength); 26 | glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog); 27 | printf("%s\n",infoLog); 28 | free(infoLog); 29 | } 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /igl/compile_and_link_program.cpp: -------------------------------------------------------------------------------- 1 | #include "compile_and_link_program.h" 2 | #include "compile_shader.h" 3 | #include "report_gl_error.h" 4 | #include 5 | #include 6 | 7 | IGL_INLINE GLuint igl::compile_and_link_program( 8 | const char * v_str, const char * f_str) 9 | { 10 | GLuint vid = compile_shader(GL_VERTEX_SHADER,v_str); 11 | GLuint fid = compile_shader(GL_FRAGMENT_SHADER,f_str); 12 | 13 | GLuint prog_id = glCreateProgram(); 14 | assert(prog_id != 0 && "Failed to create shader."); 15 | glAttachShader(prog_id,vid); 16 | igl::report_gl_error("glAttachShader (vid): "); 17 | glAttachShader(prog_id,fid); 18 | igl::report_gl_error("glAttachShader (fid): "); 19 | 20 | glLinkProgram(prog_id); 21 | igl::report_gl_error("glLinkProgram: "); 22 | 23 | GLint status; 24 | glGetProgramiv(prog_id, GL_LINK_STATUS, &status); 25 | if (status != GL_TRUE) 26 | { 27 | char buffer[512]; 28 | glGetProgramInfoLog(prog_id, 512, NULL, buffer); 29 | std::cerr << "Linker error: " << std::endl << buffer << std::endl; 30 | prog_id = 0; 31 | } 32 | return prog_id; 33 | } 34 | -------------------------------------------------------------------------------- /igl/reorder.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_REORDER_H 9 | #define IGL_REORDER_H 10 | #include "igl_inline.h" 11 | #include 12 | // For size_t 13 | #include 14 | #include 15 | 16 | namespace igl 17 | { 18 | // Act like matlab's Y = X(I) for std vectors 19 | // where I contains a vector of indices so that after, 20 | // Y[j] = X[I[j]] for index j 21 | // this implies that Y.size() == I.size() 22 | // X and Y are allowed to be the same reference 23 | template< class T > 24 | IGL_INLINE void reorder( 25 | const std::vector & unordered, 26 | std::vector const & index_map, 27 | std::vector & ordered); 28 | } 29 | 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "reorder.cpp" 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /igl/directed_edge_parents.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_DIRECTED_EDGE_PARENTS_H 9 | #define IGL_DIRECTED_EDGE_PARENTS_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Recover "parents" (preceeding edges) in a tree given just directed edges. 17 | // 18 | // Inputs: 19 | // E #E by 2 list of directed edges 20 | // Outputs: 21 | // P #E list of parent indices into E (-1) means root 22 | // 23 | template 24 | IGL_INLINE void directed_edge_parents( 25 | const Eigen::PlainObjectBase & E, 26 | Eigen::PlainObjectBase & P); 27 | } 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "directed_edge_parents.cpp" 31 | #endif 32 | #endif 33 | -------------------------------------------------------------------------------- /igl/orth.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "orth.h" 9 | 10 | // Broken Implementation 11 | IGL_INLINE void igl::orth(const Eigen::MatrixXd &A, Eigen::MatrixXd &Q) 12 | { 13 | 14 | //perform svd on A = U*S*V' (V is not computed and only the thin U is computed) 15 | Eigen::JacobiSVD svd(A, Eigen::ComputeThinU ); 16 | Eigen::MatrixXd U = svd.matrixU(); 17 | const Eigen::VectorXd S = svd.singularValues(); 18 | 19 | //get rank of A 20 | int m = A.rows(); 21 | int n = A.cols(); 22 | double tol = std::max(m,n) * S.maxCoeff() * 2.2204e-16; 23 | int r = 0; 24 | for (int i = 0; i < S.rows(); ++r,++i) 25 | { 26 | if (S[i] < tol) 27 | break; 28 | } 29 | 30 | //keep r first columns of U 31 | Q = U.block(0,0,U.rows(),r); 32 | } 33 | -------------------------------------------------------------------------------- /igl/rotate_by_quat.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ROTATE_BY_QUAT_H 9 | #define IGL_ROTATE_BY_QUAT_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Compute rotation of a given vector/point by a quaternion 15 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 16 | // such that q = x*i + y*j + z*k + w 17 | // Inputs: 18 | // v input 3d point/vector 19 | // q input quaternion 20 | // Outputs: 21 | // out result of rotation, allowed to be same as v 22 | template 23 | IGL_INLINE void rotate_by_quat( 24 | const Q_type *v, 25 | const Q_type *q, 26 | Q_type *out); 27 | }; 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "rotate_by_quat.cpp" 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | /** \defgroup QR_Module QR module 13 | * 14 | * 15 | * 16 | * This module provides various QR decompositions 17 | * This module also provides some MatrixBase methods, including: 18 | * - MatrixBase::qr(), 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/QR/HouseholderQR.h" 27 | #include "src/QR/FullPivHouseholderQR.h" 28 | #include "src/QR/ColPivHouseholderQR.h" 29 | #ifdef EIGEN_USE_LAPACKE 30 | #include "src/QR/HouseholderQR_MKL.h" 31 | #include "src/QR/ColPivHouseholderQR_MKL.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/QR.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /igl/point_in_circle.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_POINT_IN_CIRCLE_H 9 | #define IGL_POINT_IN_CIRCLE_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Determine if 2d point is in a circle 15 | // Inputs: 16 | // qx x-coordinate of query point 17 | // qy y-coordinate of query point 18 | // cx x-coordinate of circle center 19 | // cy y-coordinate of circle center 20 | // r radius of circle 21 | // Returns true if query point is in circle, false otherwise 22 | IGL_INLINE bool point_in_circle( 23 | const double qx, 24 | const double qy, 25 | const double cx, 26 | const double cy, 27 | const double r); 28 | } 29 | 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "point_in_circle.cpp" 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/print_gl_get.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "print_gl_get.h" 9 | #ifndef IGL_NO_OPENGL 10 | 11 | #include 12 | IGL_INLINE void igl::print_gl_get(GLenum pname) 13 | { 14 | double dM[16]; 15 | 16 | int rows = 4; 17 | int cols = 4; 18 | switch(pname) 19 | { 20 | case GL_MODELVIEW_MATRIX: 21 | case GL_PROJECTION_MATRIX: 22 | { 23 | rows = 4; 24 | cols = 4; 25 | glGetDoublev(pname,dM); 26 | for(int i = 0;i 19 | * \endcode 20 | * 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | 27 | #include "OrderingMethods" 28 | #include "src/SparseCore/SparseColEtree.h" 29 | #include "src/SparseQR/SparseQR.h" 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /igl/draw_rectangular_marquee.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_DRAW_RECTANGULAR_MARQUEE_H 9 | #define IGL_DRAW_RECTANGULAR_MARQUEE_H 10 | #include "igl_inline.h" 11 | namespace igl 12 | { 13 | // Draw a rectangular marquee (selection box) in screen space. This sets up 14 | // screen space using current viewport. 15 | // 16 | // Inputs: 17 | // from_x x coordinate of from point 18 | // from_y y coordinate of from point 19 | // to_x x coordinate of to point 20 | // to_y y coordinate of to point 21 | IGL_INLINE void draw_rectangular_marquee( 22 | const int from_x, 23 | const int from_y, 24 | const int to_x, 25 | const int to_y); 26 | } 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "draw_rectangular_marquee.cpp" 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /igl/face_occurrences.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FACE_OCCURRENCES 9 | #define IGL_FACE_OCCURRENCES 10 | #include "igl_inline.h" 11 | 12 | #include 13 | namespace igl 14 | { 15 | // Count the occruances of each face (row) in a list of face indices 16 | // (irrespecitive of order) 17 | // Inputs: 18 | // F #F by simplex-size 19 | // Outputs 20 | // C #F list of counts 21 | // Known bug: triangles/tets only (where ignoring order still gives simplex) 22 | template 23 | IGL_INLINE void face_occurrences( 24 | const std::vector > & F, 25 | std::vector & C); 26 | } 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "face_occurrences.cpp" 30 | #endif 31 | 32 | #endif 33 | 34 | 35 | -------------------------------------------------------------------------------- /igl/quat_conjugate.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_QUAT_CONJUGATE_H 9 | #define IGL_QUAT_CONJUGATE_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Compute conjugate of given quaternion 15 | // http://en.wikipedia.org/wiki/Quaternion#Conjugation.2C_the_norm.2C_and_reciprocal 16 | // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w), 17 | // such that q = x*i + y*j + z*k + w 18 | // Inputs: 19 | // q1 input quaternion 20 | // Outputs: 21 | // out result of conjugation, allowed to be same as input 22 | template 23 | IGL_INLINE void quat_conjugate( 24 | const Q_type *q1, 25 | Q_type *out); 26 | }; 27 | 28 | #ifndef IGL_STATIC_LIBRARY 29 | # include "quat_conjugate.cpp" 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /igl/directed_edge_parents.cpp: -------------------------------------------------------------------------------- 1 | #include "directed_edge_parents.h" 2 | #include "slice_into.h" 3 | #include "slice.h" 4 | #include "colon.h" 5 | #include "setdiff.h" 6 | #include 7 | 8 | template 9 | IGL_INLINE void igl::directed_edge_parents( 10 | const Eigen::PlainObjectBase & E, 11 | Eigen::PlainObjectBase & P) 12 | { 13 | using namespace Eigen; 14 | using namespace std; 15 | VectorXi I = VectorXi::Constant(E.maxCoeff()+1,1,-1); 16 | //I(E.col(1)) = 0:E.rows()-1 17 | slice_into(colon(0,E.rows()-1),E.col(1).eval(),I); 18 | VectorXi roots,_; 19 | setdiff(E.col(0).eval(),E.col(1).eval(),roots,_); 20 | for_each(roots.data(),roots.data()+roots.size(),[&](int r){I(r)=-1;}); 21 | slice(I,E.col(0).eval(),P); 22 | } 23 | 24 | #ifdef IGL_STATIC_LIBRARY 25 | // Explicit template instanciation 26 | template void igl::directed_edge_parents, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); 27 | #endif 28 | -------------------------------------------------------------------------------- /igl/edges.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_EDGES_H 9 | #define IGL_EDGES_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Constructs a list of unique edges represented in a given mesh (V,F) 17 | // Templates: 18 | // T should be a eigen sparse matrix primitive type like int or double 19 | // Inputs: 20 | // F #F by 3 list of mesh faces (must be triangles) 21 | // or 22 | // T #T x 4 matrix of indices of tet corners 23 | // Outputs: 24 | // E #E by 2 list of edges in no particular order 25 | // 26 | // See also: adjacency_matrix 27 | IGL_INLINE void edges( const Eigen::MatrixXi& F, Eigen::MatrixXi& E); 28 | } 29 | 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "edges.cpp" 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/OpenGL_convenience.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_OPENGL_CONVENIENCE_H 9 | #define IGL_OPENGL_CONVENIENCE_H 10 | #ifndef IGL_NO_OPENGL 11 | 12 | // Always use this: 13 | // #include "OpenGL_convenience.h" 14 | // Convenience includer for opengl. 15 | 16 | // For now this includes glu, glew and glext (perhaps these should be 17 | // separated) 18 | #if __APPLE__ 19 | # include 20 | # include 21 | # include 22 | #elif defined(_WIN32) 23 | # define NOMINMAX 24 | # include 25 | # undef NOMINMAX 26 | # include 27 | # include 28 | #else 29 | # define GL_GLEXT_PROTOTYPES 30 | # include 31 | # include 32 | # include 33 | #endif 34 | 35 | #endif 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /igl/cgal/polyhedron_to_mesh.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_POLYHEDRON_TO_MESH_H 9 | #define IGL_POLYHEDRON_TO_MESH_H 10 | #include 11 | #include 12 | 13 | namespace igl 14 | { 15 | // Convert a CGAL Polyhedron to a mesh (V,F) 16 | // 17 | // Templates: 18 | // Polyhedron CGAL Polyhedron type (e.g. Polyhedron_3) 19 | // Inputs: 20 | // poly cgal polyhedron 21 | // Outputs: 22 | // V #V by 3 list of vertex positions 23 | // F #F by 3 list of triangle indices 24 | template 25 | IGL_INLINE void polyhedron_to_mesh( 26 | const Polyhedron & poly, 27 | Eigen::MatrixXd & V, 28 | Eigen::MatrixXi & F); 29 | } 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "polyhedron_to_mesh.cpp" 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/column_to_quats.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_COLUMN_TO_QUATS_H 9 | #define IGL_COLUMN_TO_QUATS_H 10 | #include "igl_inline.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | namespace igl 16 | { 17 | // "Columnize" a list of quaternions (q1x,q1y,q1z,q1w,q2x,q2y,q2z,q2w,...) 18 | // 19 | // Inputs: 20 | // Q n*4-long list of coefficients 21 | // Outputs: 22 | // vQ n-long list of quaternions 23 | // Returns false if n%4!=0 24 | IGL_INLINE bool column_to_quats( 25 | const Eigen::VectorXd & Q, 26 | std::vector< 27 | Eigen::Quaterniond,Eigen::aligned_allocator > & vQ); 28 | } 29 | 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "column_to_quats.cpp" 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /igl/normalize_row_sums.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_NORMALIZE_ROW_SUMS_H 9 | #define IGL_NORMALIZE_ROW_SUMS_H 10 | #include "igl_inline.h" 11 | #include 12 | 13 | namespace igl 14 | { 15 | // Normalize the rows in A so that their sums are each 1 and place the new 16 | // entries in B 17 | // Inputs: 18 | // A #rows by k input matrix 19 | // Outputs: 20 | // B #rows by k input matrix, can be the same as A 21 | // 22 | // Note: This is just calling an Eigen one-liner. 23 | template 24 | IGL_INLINE void normalize_row_sums( 25 | const Eigen::MatrixBase& A, 26 | Eigen::MatrixBase & B); 27 | } 28 | 29 | #ifndef IGL_STATIC_LIBRARY 30 | # include "normalize_row_sums.cpp" 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /igl/next_filename.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2014 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "next_filename.h" 9 | #include "STR.h" 10 | #include "file_exists.h" 11 | #include 12 | #include 13 | 14 | bool igl::next_filename( 15 | const std::string & prefix, 16 | const int zeros, 17 | const std::string & suffix, 18 | std::string & next) 19 | { 20 | using namespace std; 21 | // O(n), for huge lists could at least find bounds with exponential search 22 | // and then narrow with binary search O(log(n)) 23 | int i = 0; 24 | while(true) 25 | { 26 | next = STR(prefix << setfill('0') << setw(zeros)< 0 && i >= pow(10,zeros)) 33 | { 34 | return false; 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /igl/null.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2015 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_NULL_H 9 | #define IGL_NULL_H 10 | #include "igl_inline.h" 11 | 12 | #include 13 | 14 | namespace igl 15 | { 16 | // Like MATLAB's null 17 | // 18 | // Compute a basis for the null space for the given matrix A: the columns of 19 | // the output N form a basis for the space orthogonal to that spanned by the 20 | // rows of A. 21 | // 22 | // Inputs: 23 | // A m by n matrix 24 | // Outputs: 25 | // N n by r matrix, where r is the row rank of A 26 | template 27 | IGL_INLINE void null( 28 | const Eigen::PlainObjectBase & A, 29 | Eigen::PlainObjectBase & N); 30 | } 31 | 32 | #ifndef IGL_STATIC_LIBRARY 33 | # include "null.cpp" 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /igl/average_onto_faces.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #include "average_onto_faces.h" 9 | 10 | template 11 | IGL_INLINE void igl::average_onto_faces(const Eigen::Matrix &V, 12 | const Eigen::Matrix &F, 13 | const Eigen::Matrix &S, 14 | Eigen::Matrix &SF) 15 | { 16 | 17 | SF = Eigen::Matrix::Zero(F.rows(),S.cols()); 18 | 19 | for (int i = 0; i 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_FIT_PLANE_H 9 | #define IGL_FIT_PLANE_H 10 | 11 | #include "igl_inline.h" 12 | #include 13 | 14 | namespace igl 15 | { 16 | // This function fits a plane to a point cloud. 17 | // 18 | // Input: 19 | // V #Vx3 matrix. The 3D point cloud, one row for each vertex. 20 | // Output: 21 | // N 1x3 Vector. The normal of the fitted plane. 22 | // C 1x3 Vector. A point that lies in the fitted plane. 23 | // From http://missingbytes.blogspot.com/2012/06/fitting-plane-to-point-cloud.html 24 | 25 | IGL_INLINE void fit_plane( 26 | const Eigen::MatrixXd & V, 27 | Eigen::RowVector3d & N, 28 | Eigen::RowVector3d & C); 29 | } 30 | 31 | #ifndef IGL_STATIC_LIBRARY 32 | # include "fit_plane.cpp" 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup LU_Module LU module 9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 10 | * This module defines the following MatrixBase methods: 11 | * - MatrixBase::inverse() 12 | * - MatrixBase::determinant() 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/misc/Solve.h" 20 | #include "src/misc/Kernel.h" 21 | #include "src/misc/Image.h" 22 | #include "src/LU/FullPivLU.h" 23 | #include "src/LU/PartialPivLU.h" 24 | #ifdef EIGEN_USE_LAPACKE 25 | #include "src/LU/PartialPivLU_MKL.h" 26 | #endif 27 | #include "src/LU/Determinant.h" 28 | #include "src/LU/Inverse.h" 29 | 30 | #if defined EIGEN_VECTORIZE_SSE 31 | #include "src/LU/arch/Inverse_SSE.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/LU.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_LU_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /OpenGL/trackball.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACKBALL_H 2 | #define TRACKBALL_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class TrackBall 10 | { 11 | public: 12 | enum TrackMode 13 | { 14 | Plane, 15 | Sphere, 16 | }; 17 | TrackBall(TrackMode mode = Sphere); 18 | TrackBall(float angularVelocity, const QVector3D& axis, TrackMode mode = Sphere); 19 | // coordinates in [-1,1]x[-1,1] 20 | void push(const QPointF& p, const QQuaternion &transformation); 21 | void move(const QPointF& p, const QQuaternion &transformation, QMatrix4x4 model); 22 | void release(const QPointF& p, const QQuaternion &transformation, QMatrix4x4 model); 23 | void setRotation(QMatrix4x4 rotation); 24 | void start(); // starts clock 25 | void stop(); // stops clock 26 | QQuaternion rotation(); 27 | private: 28 | QQuaternion m_rotation; 29 | QVector3D m_axis; 30 | float m_angularVelocity; 31 | QPointF m_lastPos; 32 | QTime m_lastTime; 33 | bool m_paused; 34 | bool m_pressed; 35 | TrackMode m_mode; 36 | 37 | 38 | }; 39 | 40 | #endif //trackball_h 41 | -------------------------------------------------------------------------------- /igl/round.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ROUND_H 9 | #define IGL_ROUND_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Round a scalar value 15 | // 16 | // Inputs: 17 | // x number 18 | // Returns x rounded to integer 19 | template 20 | DerivedX round(const DerivedX r); 21 | // Round a given matrix to nearest integers 22 | // 23 | // Inputs: 24 | // X m by n matrix of scalars 25 | // Outputs: 26 | // Y m by n matrix of rounded integers 27 | template < typename DerivedX, typename DerivedY> 28 | IGL_INLINE void round( 29 | const Eigen::PlainObjectBase& X, 30 | Eigen::PlainObjectBase& Y); 31 | } 32 | 33 | #ifndef IGL_STATIC_LIBRARY 34 | # include "round.cpp" 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /igl/is_sparse.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_IS_SPARSE_H 9 | #define IGL_IS_SPARSE_H 10 | #include "igl_inline.h" 11 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 12 | #include 13 | #include 14 | namespace igl 15 | { 16 | // Determine if a matrix A is sparse 17 | // 18 | // Template: 19 | // T,DerivedA defines scalar type 20 | // Inputs: 21 | // A matrix in question 22 | // Returns true if A is represented with a sparse matrix 23 | template 24 | IGL_INLINE bool is_sparse( 25 | const Eigen::SparseMatrix & A); 26 | template 27 | IGL_INLINE bool is_sparse( 28 | const Eigen::PlainObjectBase& A); 29 | } 30 | 31 | #ifndef IGL_STATIC_LIBRARY 32 | # include "is_sparse.cpp" 33 | #endif 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /igl/embree/Embree_convenience.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_EMBREE_CONVENIENCE_H 9 | #define IGL_EMBREE_CONVENIENCE_H 10 | 11 | #undef interface 12 | #undef near 13 | #undef far 14 | // Why are these in quotes? isn't that a bad idea? 15 | #ifdef __GNUC__ 16 | // This is how it should be done 17 | # if __GNUC__ >= 4 18 | # if __GNUC_MINOR__ >= 6 19 | # pragma GCC diagnostic push 20 | # pragma GCC diagnostic ignored "-Weffc++" 21 | # endif 22 | # endif 23 | // This is a hack 24 | # pragma GCC system_header 25 | #endif 26 | #include 27 | #include 28 | #include 29 | #ifdef __GNUC__ 30 | # if __GNUC__ >= 4 31 | # if __GNUC_MINOR__ >= 6 32 | # pragma GCC diagnostic pop 33 | # endif 34 | # endif 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /unsupported/Eigen/src/SVD/doneInBDCSVD.txt: -------------------------------------------------------------------------------- 1 | This unsupported package is about a divide and conquer algorithm to compute SVD. 2 | 3 | The implementation follows as closely as possible the following reference paper : 4 | http://www.cs.yale.edu/publications/techreports/tr933.pdf 5 | 6 | The code documentation uses the same names for variables as the reference paper. The code, deflation included, is 7 | working but there are a few things that could be optimised as explained in the TODOBdsvd. 8 | 9 | In the code comments were put at the line where would be the third step of the algorithm so one could simply add the call 10 | of a function doing the last part of the algorithm and that would not require any knowledge of the part we implemented. 11 | 12 | In the TODOBdcsvd we explain what is the main difficulty of the last part and suggest a reference paper to help solve it. 13 | 14 | The implemented has trouble with fixed size matrices. 15 | 16 | In the actual implementation, it returns matrices of zero when ask to do a svd on an int matrix. 17 | 18 | 19 | Paper for the third part: 20 | http://www.stat.uchicago.edu/~lekheng/courses/302/classics/greengard-rokhlin.pdf 21 | 22 | -------------------------------------------------------------------------------- /igl/get_seconds.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_GET_SECONDS_H 9 | #define IGL_GET_SECONDS_H 10 | #include "igl_inline.h" 11 | 12 | namespace igl 13 | { 14 | // Return the current time in seconds since program start 15 | // 16 | // Example: 17 | // const auto & tictoc = []() 18 | // { 19 | // static double t_start = igl::get_seconds(); 20 | // double diff = igl::get_seconds()-t_start; 21 | // t_start += diff; 22 | // return diff; 23 | // }; 24 | // tictoc(); 25 | // ... // part 1 26 | // cout<<"part 1: "< 0.0 ) 33 | spec = Light.Intensity * Material.Ks * 34 | pow( max( dot(r,v), 0.0 ), Material.Shininess ); 35 | 36 | return ambient + diffuse + spec; 37 | } 38 | 39 | void main() 40 | { 41 | vec3 c = phongModel(vec3(EyePosition), EyeNormal); 42 | color = vec4(c, 1.0); 43 | } 44 | -------------------------------------------------------------------------------- /igl/rows_to_matrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of libigl, a simple c++ geometry processing library. 2 | // 3 | // Copyright (C) 2013 Alec Jacobson 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public License 6 | // v. 2.0. If a copy of the MPL was not distributed with this file, You can 7 | // obtain one at http://mozilla.org/MPL/2.0/. 8 | #ifndef IGL_ROWS_TO_MATRIX_H 9 | #define IGL_ROWS_TO_MATRIX_H 10 | #include "igl_inline.h" 11 | #include 12 | namespace igl 13 | { 14 | // Convert a list (std::vector) of row vectors of the same length to a matrix 15 | // Template: 16 | // Row row vector type, must implement: 17 | // .size() 18 | // Mat Matrix type, must implement: 19 | // .resize(m,n) 20 | // .row(i) = Row 21 | // Inputs: 22 | // V a m-long list of vectors of size n 23 | // Outputs: 24 | // M an m by n matrix 25 | // Returns true on success, false on errors 26 | template 27 | IGL_INLINE bool rows_to_matrix(const std::vector & V,Mat & M); 28 | } 29 | 30 | #ifndef IGL_STATIC_LIBRARY 31 | # include "rows_to_matrix.cpp" 32 | #endif 33 | 34 | #endif 35 | --------------------------------------------------------------------------------