123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>libigl</title>
- <meta name="author" content="Alec Jacobson and Daniele Panozzo and others"/>
- <link type="text/css" rel="stylesheet" href="tutorial/style.css"/>
- <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
- <link rel='stylesheet' href='http://yandex.st/highlightjs/7.3/styles/default.min.css'>
- <script src='http://yandex.st/highlightjs/7.3/highlight.min.js'></script>
- <script>hljs.initHighlightingOnLoad();</script>
- </head>
- <body>
- <h1 id="libigl-asimplecgeometryprocessinglibrary">libigl - A simple c++ geometry processing library</h1>
- <figure>
- <img src="tutorial/images/libigl-logo.jpg" alt="" />
- <figcaption></figcaption></figure>
- <p><a href="http://libigl.github.io/libigl/">http://libigl.github.io/libigl/</a>
- <a href="https://github.com/libigl/libigl/">https://github.com/libigl/libigl/</a></p>
- <p>Copyright 2014 - Alec Jacobson, Daniele Panozzo, Olga Diamanti, Kenshi
- Takayama, Leo Sacht, Wenzel Jacob, etc.</p>
- <p>Libigl is first and foremost a <em>header</em> library. Each header file should
- contain a single function. This function may have multiple overloads and
- prototypes. All functions should use the <code>igl::</code> namespace and should adhere to
- the conventions and styles listed in the <a href="style_guidelines.html">style
- guidelines</a>.</p>
- <blockquote>
- <p><strong>New:</strong> As of 1 July 2014, we have released libigl as beta version 1.0.
- There are a number of changes we collected for this release to minimize
- confusion and changes to how you use libigl. See <a href="#version1.0changes">Version 1.0
- Changes</a>.</p>
- </blockquote>
- <h2 id="installation">Installation</h2>
- <p>Libigl is a <em>header</em> library. You do <strong>not</strong> need to build anything to install.
- Simple add <code>igl/</code> to your include path and include relevant headers. Here’s a
- small “Hello, World” program:</p>
- <pre><code class="cpp">#include <igl/cotmatrix.h>
- #include <Eigen/Dense>
- #include <Eigen/Sparse>
- #include <iostream>
- int main()
- {
- Eigen::MatrixXd V(4,2);
- V<<0,0,
- 1,0,
- 1,1,
- 0,1;
- Eigen::MatrixXi F(2,3);
- F<<0,1,2,
- 0,2,3;
- Eigen::SparseMatrix<double> L;
- igl::cotmatrix(V,F,L);
- std::cout<<"Hello, mesh: "<<std::endl<<L*V<<std::endl;
- return 0;
- }
- </code></pre>
- <p>If you save this in <code>hello.cpp</code>, then on <code>gcc</code> with Eigen installed via
- macports for example you could compile this with:</p>
- <pre><code class="bash">gcc -I/opt/local/include/eigen3 -I./igl/ hello.cpp -o hello
- </code></pre>
- <p>Running <code>./hello</code> would then produce</p>
- <pre><code>Hello, mesh:
- 0.5 0.5
- -0.5 0.5
- -0.5 -0.5
- 0.5 -0.5
- </code></pre>
- <h2 id="tutorial">Tutorial</h2>
- <p>As of version 1.0, libigl includes an introductory
- <a href="http://libigl.github.io/libigl/tutorial/tutorial.html">tutorial</a> that covers
- its basic functionalities.</p>
- <h2 id="dependencies">Dependencies</h2>
- <ul>
- <li>Eigen3 Last tested with Eigen Version 3.2</li>
- </ul>
- <h3 id="optional">Optional</h3>
- <ul>
- <li>OpenGL (disable with <code>IGL_NO_OPENGL</code>)
- <ul>
- <li>OpenGL >= 4 (enable with <code>IGL_OPENGL_4</code>)</li>
- </ul></li>
- <li>AntTweakBar (disable with <code>IGL_NO_ANTTWEAKBAR</code>) Last tested 1.16 (see
- <code>libigl/external/AntTweakBar</code>)</li>
- <li>GLEW Windows and Linux</li>
- <li>OpenMP</li>
- <li>libpng libiglpng extra only</li>
- <li>Mosek libiglmosek extra only</li>
- <li>Matlab libiglmatlab extra only</li>
- <li>boost libiglboost, libiglcgal extra only</li>
- <li>SSE/AVX libiglsvd3x3 extra only</li>
- <li>CGAL libiglcgal extra only
- <ul>
- <li>boost</li>
- <li>gmp</li>
- <li>mpfr</li>
- </ul></li>
- <li>CoMiSo libcomiso extra only</li>
- </ul>
- <h3 id="optionalincludedinexternal">Optional (included in external/)</h3>
- <ul>
- <li>TetGen libigltetgen extra only</li>
- <li>Embree libiglembree extra only</li>
- <li>tinyxml2 libiglxml extra only</li>
- <li>glfw libviewer extra only</li>
- <li>LIM liblim extra only</li>
- </ul>
- <h2 id="headeronly">Header only</h2>
- <p>Libigl is designed to work “out-of-the-box” as a headers only library. To
- include libigl in your project. You need only include the libigl/include/
- directory in your include path. To
- compile a hello-word example.cpp:</p>
- <pre><code>#include <Eigen/Dense>
- #include <igl/readOBJ.h>
- #include <iostream>
- int main(int argc, char * argv[])
- {
- if(argc>1)
- {
- Eigen::MatrixXd V;
- Eigen::MatrixXi F;
- igl::readOBJ(argv[1],V,F);
- std::cout<<"Hello, mesh with "<<V.rows()<<" vertices!"<<std::endl;
- }else{
- std::cout<<"Hello, world!"<<std::endl;
- }
- return 0;
- }
- </code></pre>
- <p>using gcc (replacing appropriate paths):</p>
- <pre><code>g++ -I/usr/local/igl/libigl/include \
- -I/opt/local/include/eigen3 example.cpp -o example
- </code></pre>
- <p>Then run this example with:</p>
- <pre><code>./example examples/shared/TinyTorus.obj
- </code></pre>
- <h2 id="compilationasastaticlibrary">Compilation as a static library</h2>
- <p>Libigl is developed most often on Mac OS X, though has current users in Linux
- and Windows.</p>
- <h3 id="linuxmacosxcygwin">Linux/Mac OS X/Cygwin</h3>
- <p>Libigl may also be compiled to a static library. This is advantageous when
- building a project with libigl, since when used as an header-only library can
- slow down compile times.</p>
- <p>To build the entire libigl library producing lib/libigl.a, issue:</p>
- <pre><code>cd build
- make lib
- </code></pre>
- <p>You may need to edit Makefile.conf accordingly. Best to give yourself an
- <code>IGL_USERNAME</code> and add a custom install suite for yourself. Then you can enable
- appropriate extras.</p>
- <h4 id="extras">Extras</h4>
- <p>Once you’ve set up an <code>IGL_USERNAME</code> and enabled extras within Makefile.conf.
- You can build the extra libraries (into lib/ligiglpng.a, lib/libiglmatlab.a,
- lib/libigltetgen.a, lib/libiglmosek.a, etc.) by issuing:</p>
- <pre><code>cd build
- make extras
- </code></pre>
- <h4 id="examples">Examples</h4>
- <p>You can make a slew of examples by issuing:</p>
- <pre><code>cd build
- make examples
- </code></pre>
- <h4 id="external">External</h4>
- <p>Finally there are a number of external libraries that we include in
- ./external/ because they are either difficult to obtain or they have been
- patched for easier use with libigl. Please see the respective readmes in
- those directories.</p>
- <h5 id="installinganttweakbar">Installing AntTweakBar</h5>
- <p>To build the a static AntTweakBar library on Mac OS X issue:</p>
- <pre><code>cd external/AntTweakBar/src
- make -f Makefile.osx.igl
- </code></pre>
- <h5 id="installingtetgen">Installing Tetgen</h5>
- <p>To build the tetgen library and executable on Mac OS X issue:</p>
- <pre><code>cd external/tetgen
- make clean
- rm -f obj/*.o
- make -f Makefile.igl tetgen
- rm -f obj/*.o
- make -f Makefile.igl tetlib
- </code></pre>
- <h5 id="installingmedit">Installing medit</h5>
- <p>To build the igl version of the medit executable on Mac OS X issue:</p>
- <pre><code>cd external/medit
- make -C libmesh
- make -f Makefile.igl medit
- </code></pre>
- <h5 id="installingembree2.0">Installing Embree 2.0</h5>
- <p>To build the embree library and executables on Mac OS X issue:</p>
- <pre><code>cd external/embree
- mkdir build
- cd build
- cmake ..
- # Or using a different compiler
- #cmake .. -DCMAKE_C_COMPILER=/opt/local/bin/gcc -DCMAKE_CXX_COMPILER=/opt/local/bin/g++
- make
- # Could also install embree to your root, but libigl examples don't expect
- # this
- #sudo make install
- </code></pre>
- <h5 id="installingtinyxml2">Installing tinyxml2</h5>
- <p>To build the a static tinyxml2 library on Mac OS X issue:</p>
- <pre><code>cd external/tinyxml2
- cmake .
- make
- </code></pre>
- <h5 id="installingyimg">Installing YImg</h5>
- <p>To build the a static YImg library on Mac OS X issue:</p>
- <pre><code>cd external/yimg
- make
- </code></pre>
- <p>You may need to install libpng. Systems with X11 might find this already
- installed at <code>/usr/X11/lib</code>.</p>
- <h3 id="windowsexperimental">Windows (Experimental)</h3>
- <p>To build a static library (.lib) on windows, open Visual Studio 2010.</p>
- <ul>
- <li>New > Project …</li>
- <li>Visual C++ > Win32</li>
- <li>Win32 Console Application</li>
- <li>Name: libiglVisualStudio</li>
- <li>Uncheck “Create directory for solution”</li>
- <li>Then hit OK, and then Next</li>
- <li>Check “Static Library”</li>
- <li>Uncheck “Precompiled headers”</li>
- <li>Add all include/igl/*.cpp to the sources directory</li>
- <li>Add all include/igl/*.h to the headers directory</li>
- <li>Open Project > libigl Properties…</li>
- <li>Add the path to eigen3 to the include paths</li>
- <li>Change the target name to libigl</li>
- <li>Build and pray (this should create libigl.lib</li>
- </ul>
- <p><a href="http://msdn.microsoft.com/en-us/library/ms235627(v=vs.80).aspx">Source</a></p>
- <h2 id="examples">Examples</h2>
- <p>To get started, we advise that you take a look at a few examples:</p>
- <pre><code>./examples/hello-world/
- ./examples/meshio/
- ./examples/basic-topology/
- ./examples/ReAntTweakBar/
- </code></pre>
- <h2 id="extras">Extras</h2>
- <p>Libigl compartmentalizes dependences via its organization into a <em>main</em> libigl
- library and “extras.”</p>
- <h3 id="bbw">bbw</h3>
- <p>This library extra contains functions for computing Bounded Biharmonic Weights, can
- be used with and without the <a href="#mosek">mosek</a> extra via the <code>IGL_NO_MOSEK</code>
- macro.</p>
- <h3 id="boost">boost</h3>
- <p>This library extra utilizes the graph functions in the boost library for find
- connected components and performing breadth-first traversals.</p>
- <h3 id="cgal">cgal</h3>
- <p>This library extra utilizes CGAL’s efficient and exact intersection and
- proximity queries.</p>
- <h3 id="embree">embree</h3>
- <p>This library extra utilizes embree’s efficient ray tracing queries.</p>
- <h3 id="matlab">matlab</h3>
- <p>This library extra provides support for reading and writing <code>.mat</code> workspace
- files, interfacing with Matlab at run time and compiling mex functions.</p>
- <h3 id="mosek">mosek</h3>
- <p>This library extra utilizes mosek’s efficient interior-point solver for
- quadratic programs.</p>
- <h3 id="png">png</h3>
- <p>This library extra uses <code>libpng</code> and <code>YImage</code> to read and write <code>.png</code> files.</p>
- <h3 id="svd3x3">svd3x3</h3>
- <p>This library extra implements “as-rigid-as-possible” (ARAP) deformation
- techniques using the fast singular value decomposition routines
- written specifically for 3x3 matrices to use <code>SSE</code> intrinsics. This extra can
- still be compiled without sse support and support should be determined
- automatically at compile time via the <code>__SSE__</code> macro.</p>
- <h3 id="tetgen">tetgen</h3>
- <p>This library extra provides a simplified wrapper to the tetgen 3d tetrahedral meshing
- library.</p>
- <h3 id="viewer">viewer</h3>
- <p>This library extra utilizes glfw and glew to open an opengl context and launch
- a simple mesh viewer.</p>
- <h3 id="xml">xml</h3>
- <p>This library extra utilizes tinyxml2 to read and write serialized classes
- containing Eigen matrices and other standard simple data-structures.</p>
- <h2 id="development">Development</h2>
- <p>Further documentation for developers is listed in tutorial.html,
- style_guidelines.html</p>
- <h2 id="license">License</h2>
- <p>See <code>LICENSE.txt</code></p>
- <h2 id="zipping">Zipping</h2>
- <p>Zip this directory without .git litter and binaries using:</p>
- <pre><code>git archive -prefix=libigl/ -o libigl.zip master
- </code></pre>
- <h2 id="version1.0changes">Version 1.0 Changes</h2>
- <p>Our beta release marks our confidence that this library can be used outside of
- casual experimenting. To maintain order, we have made a few changes which
- current users should read and adapt their code accordingly.</p>
- <h3 id="renamedfunctions">Renamed functions</h3>
- <p>The following table lists functions which have changed name as of version
- 1.0.0:</p>
- <table>
- <colgroup>
- <col style="text-align:left;"/>
- <col style="text-align:left;"/>
- </colgroup>
- <thead>
- <tr>
- <th style="text-align:left;">Old</th>
- <th style="text-align:left;">New</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td style="text-align:left;"><code>igl::add_barycenter</code></td>
- <td style="text-align:left;"><code>igl::false_barycentric_subdivision</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::areamatrix</code></td>
- <td style="text-align:left;"><code>igl::vector_area_matrix</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::barycentric2global</code></td>
- <td style="text-align:left;"><code>igl::barycentric_to_global</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::boundary_faces</code></td>
- <td style="text-align:left;"><code>igl::boundary_facets</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::boundary_vertices_sorted</code></td>
- <td style="text-align:left;"><code>igl::boundary_loop</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::cotangent</code></td>
- <td style="text-align:left;"><code>igl::cotmatrix_entries</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::edgetopology</code></td>
- <td style="text-align:left;"><code>igl::edge_topology</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::gradMat</code></td>
- <td style="text-align:left;"><code>igl::grad</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::is_manifold</code></td>
- <td style="text-align:left;"><code>igl::is_edge_manifold</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::mexStream</code></td>
- <td style="text-align:left;"><code>igl::MexStream</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::moveFV</code></td>
- <td style="text-align:left;"><code>igl::average_onto_vertices</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::moveVF</code></td>
- <td style="text-align:left;"><code>igl::average_onto_faces</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::plot_vector</code></td>
- <td style="text-align:left;"><code>igl::print_vector</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::pos</code></td>
- <td style="text-align:left;"><code>igl::HalfEdgeIterator</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::plane_project</code></td>
- <td style="text-align:left;"><code>igl::project_isometrically_to_plane</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::project_points_mesh</code></td>
- <td style="text-align:left;"><code>igl::line_mesh_intersection</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::read</code></td>
- <td style="text-align:left;"><code>igl::read_triangle_mesh</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::removeDuplicates.cpp</code></td>
- <td style="text-align:left;"><code>igl::remove_duplicates</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::removeUnreferenced</code></td>
- <td style="text-align:left;"><code>igl::remove_unreferenced</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::tt</code></td>
- <td style="text-align:left;"><code>igl::triangle_triangle_adjacency</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::vf</code></td>
- <td style="text-align:left;"><code>igl::vertex_triangle_adjacency</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::write</code></td>
- <td style="text-align:left;"><code>igl::write_triangle_mesh</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::manifold_patches</code></td>
- <td style="text-align:left;"><code>igl::orientable_patches</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::selfintersect</code></td>
- <td style="text-align:left;"><code>igl::remesh_self_intersections</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::project_mesh</code></td>
- <td style="text-align:left;"><code>igl::line_mesh_intersection</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::triangulate</code></td>
- <td style="text-align:left;"><code>igl::polygon_mesh_to_triangle_mesh</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::is_manifold</code></td>
- <td style="text-align:left;"><code>igl::is_edge_manifold</code></td>
- </tr>
- <tr>
- <td style="text-align:left;"><code>igl::triangle_wrapper</code></td>
- <td style="text-align:left;"><code>igl::triangulate</code></td>
- </tr>
- </tbody>
- </table>
- <h3 id="miscellaneous">Miscellaneous</h3>
- <ul>
- <li>To match interfaces provided by (all) other quadratic optimization
- libraries, <code>igl::min_quad_with_fixed</code> and <code>igl::active_set</code> now expect as
- input twice the quadratic coefficients matrix, i.e. the Hessian. For
- example, <code>igl::min_quad_with_fixed(H,B,...)</code> minimizes <span class="math">\(\frac{1}{2}x^T H
- x+x^T B\)</span>.</li>
- <li>We have inverted the <code>IGL_HEADER_ONLY</code> macro to <code>IGL_STATIC_LIBRARY</code>. To
- compile using libigl as a header-only library, simply include headers and
- libigl in the header search path. To link to libigl, you must define the
- <code>IGL_STATIC_LIBRARY</code> macro at compile time and link to the <code>libigl*.a</code>
- libraries.</li>
- <li>Building libigl as a static library is now more organized. There is a
- <code>build/</code> directory with Makefiles for the main library (<code>Makefile</code>) and each
- dependency (e.g. <code>Makefile_mosek</code> for <code>libiglmosek.a</code>)</li>
- <li><code>igl::polar_svd</code> now always returns a rotation in <code>R</code>, never a reflection.
- This mirrors the behavior of <code>igl::polar_svd3x3</code>. Consequently the <code>T</code>
- part may have negative skews.</li>
- <li>We have organized the static</li>
- <li>The previous <code>igl::grad</code> function, which computed the per-triangle gradient
- of a per-vertex scalar function has been replaced. Now <code>igl::grad</code> computes
- the linear operator (previous computed using <code>igl::gradMat</code>). The gradient
- values can still be recovered by multiplying the operator against the scalar
- field as a vector and reshaping to have gradients per row.</li>
- <li><code>MASSMATRIX_*</code> has become <code>MASSMATRIX_TYPE_*</code></li>
- <li>The function <code>igl::project_normals</code>, which cast a line for each vertex of
- mesh <em>A</em> in the normal direction and found the closest intersection along
- these lines with mesh <em>B</em>, has been removed.</li>
- </ul>
- <h2 id="contact">Contact</h2>
- <p>Libigl is a group endeavor led by Alec Jacobson and Daniele Panozzo. Please
- contact <a href="mailto:alecjacobson@gmail.com">alecjacobson@gmail.com</a> if you have
- questions or comments. We are happy to get feedback! Enjoy!</p>
- <p>If you’re using libigl in your projects, quickly <a href="mailto:alecjacobson@gmail.com">drop us a
- note</a>. Tell us who you are and what you’re using
- it for. This helps us apply for funding and justify spending time maintaining
- this.</p>
- <p>If you find bugs or have problems please use our <a href="https://github.com/libigl/libigl/issues">github issue tracking
- page</a>.</p>
- <h2 id="academiccitation">Academic citation</h2>
- <p>If you use libigl in your research projects, please cite the papers we
- implement as appropriate. To cite the library in general, you could use this
- BibTeX entry:</p>
- <pre><code class="bibtex">@misc{libigl,
- title = {{libigl}: A simple {C++} geometry processing library},
- author = {Alec Jacobson and Daniele Panozzo and others},
- note = {http://libigl.github.io/libigl/},
- year = {2014},
- }
- </code></pre>
- </body>
- </html>
|