index.html 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <link rel='stylesheet' type='text/css' href='../style.css' >
  5. <title>libigl file formats</title>
  6. </head>
  7. <body class=article_outer>
  8. <div class=article_inner>
  9. <a href=..><img src=../libigl-logo.jpg alt="igl logo" class=center></a>
  10. <h1>libigl file formats</h1>
  11. <ul>
  12. <li><a href="./bf.html">.bf</a> ASCII files for representing skeletal bone "forests"</li>
  13. <li><a href="./dmat.html">.dmat</a> uncompressed ASCII/binary files for dense matrices</li>
  14. <li><i>.ele</i> Element (triangle or tet) list. This format comes in similar flavors: <a
  15. href=http://tetgen.berlios.de/fformats.ele.html>tetgen's</a>, <a
  16. href=http://www.cs.berkeley.edu/~jrs/stellar/#fileformats>stellar's</a>,
  17. and <a href=https://www.cs.cmu.edu/~quake/triangle.ele.html>triangle's</a>.
  18. The formats of TetGen and stellar are identical upto conventions on index
  19. ordering and number of allowed attributes (unverified).</li>
  20. <li><a href=http://tetgen.berlios.de/fformats.face.html
  21. class=missing>.face</a> TetGen's file format for simplicial facets.</li>
  22. <li><a href="http://www.ann.jussieu.fr/frey/publications/RT-0253.pdf#page=33">.mesh</a> Medit's triangle surface mesh + tetrahedral volume mesh file format, see page 33, section 7.2.1</li>
  23. <li><i>.node</i> List of points (vertices). Described indentically (upto
  24. accepted dimensions, use of attributes and boundary markers) by <a
  25. href="https://www.cs.cmu.edu/~quake/triangle.node.html">Triangle</a>, <a
  26. href=http://tetgen.berlios.de/fformats.node.html>TetGen</a>, and <a
  27. href=http://www.cs.berkeley.edu/~jrs/stellar/#fileformats>Stellar</a>.
  28. </li>
  29. <li><a href="http://wias-berlin.de/software/tetgen/fformats.off.html">.off</a> Geomview's polyhedral file format</li>
  30. <li><a
  31. href="http://en.wikipedia.org/wiki/Wavefront_.obj_file#File_format">.obj</a>
  32. Wavefront object file format. Usually unsafe to assume anything more than
  33. vertex positions and triangle indices are supported</li>
  34. <li><a href=http://en.wikipedia.org/wiki/PLY_%28file_format%29>.ply</a>
  35. Polygon File Format, supporting ASCII and binary encoding</li>
  36. <li><a
  37. href=https://en.wikipedia.org/wiki/Portable_Network_Graphics>.png</a>
  38. Portable Network Graphics image file. IGLLIB (in the libiglpng extra)
  39. supports png image files via the <a href=https://github.com/yig/yimg>yimg</a>
  40. library. Alpha channels and compression are suppported.</li>
  41. <li><i>.poly</i> Piecewise-linear complex. This format comes in many similar but importantly different flavors:
  42. <a href="https://www.cs.cmu.edu/~quake/triangle.poly.html">triangle's</a>, <a href="http://tetgen.berlios.de/fformats.poly.html">tetgen's</a>, <a href="http://sparse-meshing.com/svr/0.2.1/format-poly.html">pyramid/SVR's</a></li>
  43. <li><a href=./rbr.html>.rbr</a> ASCII files for saving state of ReAntTweakBar</li>
  44. <li><a href=http://en.wikipedia.org/wiki/STL_(file_format)>.stl</a> 3D Systems' CAD and 3D printing mesh file format. ASCII and binary versions.</li>
  45. <li><a href=http://en.wikipedia.org/wiki/Truevision_TGA>.tga</a> Truevision TGA or TARGA image file format. IGLLIB supports only very basic reading and writing RGB/RGBA files without colormaps and (unverified) run-length compression.</li>
  46. <li><a href="./tgf.html">.tgf</a> ASCII files for representing control handle graphs</li>
  47. <li><a href="http://en.wikipedia.org/wiki/VRML#WRL_File_Format">.wrl</a>
  48. VRML (Virtual Reality Modeling Language) file format for 3D scenes.</li>
  49. <li><a href="./xml.html">.xml</a> XMLSerializer's file format containing the serialization of object data structures.</li>
  50. </ul>
  51. <h3>Triangle mesh file format performance</h3>
  52. <p>
  53. <a
  54. href="http://en.wikipedia.org/wiki/Wavefront_.obj_file#File_format">.obj</a>
  55. and <a href="http://tetgen.berlios.de/fformats.off.html">.off</a> file
  56. formats support meshes with arbitrary polygon degrees. However, often we are
  57. only working with triangle meshes. Further, .obj files do not have useful
  58. headers revealing the number of elements. For triangle meshes, .off and .obj
  59. are inferior file formats to the <a
  60. href="http://www.ann.jussieu.fr/frey/publications/RT-0253.pdf#page=33">.mesh</a>
  61. file format. The current (version 0.1.6) IO functions for these file formats perform as follows for reading and writing a 300,000 triangle mesh:
  62. </p>
  63. <pre><code>
  64. writeOBJ: 1.33742 secs
  65. writeOFF: 0.510111 secs
  66. writeMESH: 0.218139 secs
  67. readOBJ: 1.3782 secs
  68. readOFF: 0.691496 secs
  69. readMESH: 0.242315 secs
  70. </code></pre>
  71. <p>
  72. This reveals that .mesh is 6.5x faster than .obj and about 2.5x faster than .off.
  73. </p>
  74. <p>
  75. While .obj files support normals, it is typically much faster to (re)compute
  76. normals from the geometry using <code>per_face_normals</code>,
  77. <code>per_vertex_normals</code>, <code>per_corner_normals</code> than to read
  78. and write them to files.</p>
  79. <p>It gets even better if you're willing to use a nonstandard format. If your
  80. triangle mesh is in (<code>V</code>,<code>F</code>) then you can read and
  81. write those variables as dense matrices of doubles to
  82. <a href="./dmat.html">.dmat</a> uncompressed <strong>binary</strong> files.
  83. This not only ensures perfect precision but also big speed ups. On that same
  84. 300,000 triangle mesh, .dmat achieves:</p>
  85. <pre><code>
  86. writeDMAT: 0.0384338 secs
  87. readDMAT: 0.0117921 secs
  88. </code></pre>
  89. <p>This reveals that binary .dmat files are 34x/116x faster at writing and
  90. reading than .obj and a hefty 5x/20x over .mesh. In this case it may pay to
  91. compute normals once into <code>N</code> and also read and write it to a
  92. .dmat file.</p>
  93. </div>
  94. </body>
  95. </html>