Compare commits

...
992 Commits
Author SHA1 Message Date
Qingnan Zhou dc17178bed Minor UI tweak. 2021-01-22 10:48:29 -05:00
Qingnan Zhou f4585a8ca9 Update cgal. 2021-01-19 14:16:51 -05:00
Qingnan Zhou c5e6f66748 Add border to point. 2021-01-06 13:41:32 -05:00
Thibault LESCOAT 780a5fbea5 ImGuiTextEditCallback was renamed/deprecated in Imgui 1.63 (08/2018) 2021-01-06 06:33:07 -08:00
Alec Jacobson 61588efa78 rm min_quad_dense 2020-12-30 18:37:26 -05:00
Alec Jacobson cef9c6594f Merge branch 'master' of https://github.com/libigl/libigl 2020-12-30 18:00:18 -05:00
Alec Jacobson 9de4b6640f mv min_quad_dense --> kkt_inverse 2020-12-30 18:00:11 -05:00
Jeremie Dumas 7ebb86734a Update bin output dir on Windows. 2020-12-30 12:22:52 -08:00
alecjacobson 5b7b50c026 cmake bugs 2020-12-28 13:30:58 -05:00
Alec Jacobson aafb6870c7 fix strange logical warning 2020-12-27 18:13:05 -05:00
Alec Jacobson 4d026eeef1 Merge pull request #1653 from libigl/polygon-laplacian
polygon laplacian and other polygon functionality
2020-12-22 09:57:36 -05:00
Alec Jacobson ea57dfa2ad guess at fix of windows failure 2020-12-21 21:57:54 -05:00
Alec Jacobson 85120e557e up tut data 2020-12-21 21:31:57 -05:00
Alec Jacobson ad54f2dfe2 int->Index; depreacted pinv; trivial unit test 2020-12-21 19:53:56 -05:00
Alec Jacobson 0ac1d696f8 Merge branch 'master' of https://github.com/libigl/libigl into polygon-laplacian 2020-12-21 19:27:21 -05:00
Alec JacobsonandJérémie Dumas fbfb2d56ad Selection Plugin and Tutorial Entry (#1654)
* Selection Plugin and Tutorial Entry

* rm __1::

* templates; and dont take F as input

* missing template, fix bug

* better commenting

* windows doesn't understand M_PI

* Use ImGui::SetNextWindowSize

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-12-19 15:51:59 -08:00
Jérémie Dumas 858c843971 Fix nightly build + move EmbreeIntersector impl to .cpp (#1674) 2020-12-19 15:51:32 -08:00
Alec Jacobson 723eb8d74d fix readMESH issues; add test (#1679) 2020-12-19 11:09:02 -08:00
Alec Jacobson c60a948e7d remove unused mosek linking in bbw tut 2020-12-15 11:15:25 -05:00
Alec Jacobson ce32c4aa03 Merge pull request #1675 from libigl/mosek-9.2
fix mosek to work with 9.2; fix mosek dynamic link via cmake
2020-12-14 14:21:48 -05:00
Alec Jacobson e7b3e45577 missed __1:: (not in default build) 2020-12-14 14:16:43 -05:00
Alec Jacobson 7be097d585 missed __1:: (not in default build) 2020-12-13 21:09:11 -05:00
alecjacobson c47bb0507b fix compilation 2020-12-13 19:27:58 -05:00
Alec Jacobson b35d97472d fix mosek to work with 9.2; fix mosek dynamic link via cmake 2020-12-13 13:29:22 -05:00
Alec Jacobson 2ea8312e5e use angle brackets for system includes 2020-12-13 13:27:10 -05:00
Alec Jacobson f9b716fdf8 fix warning 2020-12-13 13:22:05 -05:00
Alec Jacobson c608c60a6d merge 2020-12-13 13:21:16 -05:00
Alec Jacobson 7250ea7d91 templates 2020-12-13 13:20:20 -05:00
Vladimir S. FONOV e6482a8a42 Fixed a bug in writePLY, when face properties were doubled and edge properties were dropped (#1673) 2020-12-13 10:02:31 -08:00
Alec Jacobson dbba9ca921 copyleft::marching_cubes -> marching_cubes (#1666)
* copyleft::marching_cubes -> marching_cubes

* restor imguizmo

* fix doc; lambda return type
2020-12-13 10:02:03 -08:00
Jérémie Dumas 225edb47b6 Fix typo + remove cmake warning. 2020-12-08 21:32:37 -08:00
Jérémie Dumas d14ab658df Limit to one linking job at the same time. 2020-12-08 18:45:17 -08:00
Vladimir S. FONOV c7b5d0b6e3 Offscreen meshes rendering using embree (#1652)
* Added simple raytracing renderer which allows off-screen rendering of meshes.
Using embree (already included in libigl). Addresses #1458, #601
Does not depend on OpenGL.
Tutorial example renders `fertility` example with average gaussian curvature field, in 0.1 sec.

* Separated EmbreeDevice

* Changed singleton pattern, updated variable name, removed EmbreeDevice.cpp
2020-12-08 13:26:43 -08:00
Alec Jacobson 21b62c5777 Missing normalization 2020-12-07 09:10:35 -05:00
Zhongshi f06fb13014 missing break in slim (#1641) (#1658) 2020-11-29 09:40:51 -08:00
Alec JacobsonandJérémie Dumas 59b517a4a4 bump embree version; bump sse2 to avx2 (#1648)
* bump embree version; bump sse2 to avx2

* Use default ISA instead.

* better comments

* non degenerate tests

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-11-29 09:40:10 -08:00
Nico efee81b7db Bump GLFW due to an error on macOS with CMake 3.19.0 (#1657) 2020-11-22 16:57:31 -08:00
Alec Jacobson bd30aa03b9 Merge branch 'master' of https://github.com/libigl/libigl 2020-11-22 13:37:11 -05:00
Alec Jacobson 49a0ab8640 templates 2020-11-22 13:37:03 -05:00
Alec Jacobson 6e1ed534ce convenience function for path extensions based on igl::pathinfo 2020-11-22 13:36:49 -05:00
Alec Jacobson 2ea66c3350 comment 2020-11-22 13:35:47 -05:00
Jérémie Dumas a3ba1f24f8 Update nightly.yml 2020-11-22 09:30:11 -08:00
Alec Jacobson 2e05e0f178 pointer bug 2020-11-20 21:13:48 -05:00
Alec Jacobson fbd4ce2399 polygon laplacian and other polygon functionality 2020-11-19 22:00:55 -05:00
Alec Jacobson 6cde8347be visible toggle for plugin 2020-11-19 10:01:24 -05:00
Jérémie Dumas 645718cf77 Update continuous.yml 2020-11-18 11:25:09 -08:00
Jérémie Dumas a956dfd37d Set env for nightly job. (#1651) 2020-11-18 10:15:42 -08:00
Jérémie Dumas 682e4b9685 Update github actions. (#1649) 2020-11-14 18:19:03 -08:00
Alec Jacobson 69b0eccb15 template 2020-11-14 15:56:27 -05:00
Alec Jacobson 03e14c609f note in .h 2020-11-14 13:25:27 -05:00
Alec Jacobson 782b7fc95d Merge branch 'master' of https://github.com/libigl/libigl 2020-11-14 13:24:52 -05:00
Alec Jacobson 55817544c2 reformat and fix crashing bugs 2020-11-14 13:24:48 -05:00
Alec Jacobson 0bb27beb88 Merge pull request #1645 from libigl/msh-in-read_triangle_mesh
support msh in read_triangle_mesh
2020-11-07 13:28:22 -05:00
Alec Jacobson dbec07d9f5 Merge pull request #1646 from libigl/matcap-tutorial
tutorial entry for matcap
2020-11-07 13:27:57 -05:00
Alec Jacobson 80711ea630 fix comment formatting causing warnings 2020-11-07 10:57:37 -05:00
Alec Jacobson c744410fe1 Merge branch 'master' of https://github.com/libigl/libigl 2020-11-07 10:56:53 -05:00
Alec Jacobson e706cc5b8b bug fix: xml::write_triangle_mesh now uses fe, too 2020-11-07 10:56:48 -05:00
Alec Jacobson 7ed7b06696 tutorial entry for matcap 2020-11-07 10:55:04 -05:00
Alec Jacobson be9b795a16 support msh in read_triangle_mesh 2020-11-07 10:49:09 -05:00
Alec Jacobson 0264736ed3 Merge pull request #1644 from HTDerekLiu/master
Update per_vertex_point_to_plane_quadrics.cpp
2020-11-05 15:17:08 -05:00
Hsueh-Ti Derek Liu a8a1216363 Update per_vertex_point_to_plane_quadrics.cpp
change boundary weight from length to length squared so that it has the same unit as face_quadric
2020-11-05 14:35:10 -05:00
Fabien Péan fb3bd3571e Update writeDAE.cpp (#1642)
Remove ambiguity (on windows) by using qualified calls everywhere.
Remove error with newer version of tinyxml2 which does not have XML_NO_ERROR
2020-11-03 15:45:05 -08:00
Fabien Péan d2bc41e99b Update orientable_patches.cpp (#1640)
Add a pair of explicit template instantiation for case where F is of type Eigen::MatrixX3i (i.e. Eigen::Matrix<int,Eigen::Dynamic,3>)
2020-11-03 15:32:25 -08:00
Kazutaka Nakashima 0a92f2cdb2 Fix bug in readSTL (#1638)
* Fix bug in readSTL

reset the position of the current character in the input

* Move seekg into the inside of if ... else ... block
2020-11-02 15:30:11 -08:00
Alec Jacobson 870eb14ec2 Update repdiag.cpp 2020-11-02 16:56:46 -05:00
Jérémie Dumas 1e905cba3d Update STL reader. (#1628)
* Update STL reader.

* Constexpr stuff.
2020-10-26 21:27:17 -07:00
Alec Jacobson 0e4e79f464 Merge pull request #1630 from daviesthomas/master
Signing distances with Fast Winding Number
2020-10-21 12:36:59 -04:00
Nico Brügel a2a1479a88 Use new gitlab remote to clone eigen. 2020-10-18 12:43:09 -07:00
Thomas Davies 51b3f7093a remove old comment 2020-10-18 12:56:03 -04:00
Thomas Davies 249f37af52 Merge remote-tracking branch 'upstream/master' into master 2020-10-18 11:19:12 -04:00
Thomas Davies 63b3669a87 test update... 2020-10-18 10:56:56 -04:00
Thomas Davies 9814e81b4b update tutorial with FWN signing option 2020-10-18 10:32:59 -04:00
Thomas Davies c21ad49c38 missing template 2020-10-18 10:04:36 -04:00
Camilo Talero d69073c329 Deletes print statement in the exact_geodesics method (#1625)
The print statement is always called, which affects debugging output of
calling libraries.
2020-10-18 00:20:47 -07:00
Alec Jacobson 8b5b424e8c fix warning (#1627) 2020-10-18 00:20:05 -07:00
Jérémie Dumas 1b745f81ed Update compiler version in github actions. (#1629) 2020-10-17 14:00:21 -07:00
Alec Jacobson fa7eb0befb Merge branch 'master' of https://github.com/libigl/libigl 2020-10-16 10:07:51 -04:00
Alec Jacobson 10c90309a8 note 2020-10-16 10:07:48 -04:00
Jérémie Dumas 062e3823c3 Make file encoding option an enum. (#1619) 2020-10-04 00:18:25 -07:00
Jérémie Dumas 7b4a19da9d Update blue_noise.cpp 2020-09-27 10:55:24 -07:00
8c95d1044e Added improved .msh reader/writer + tests + example (#1578)
* Added improved .msh reader/writer + tests + example,
with fixes proposed by @qnzhou
put append_mat_to_vec into igl::internal

* Update tutorial number.

* Changed tutorial code to use example from https://github.com/libigl/libigl-tutorial-data/pull/1 and flat shading

* Remove commented code.

* Rename tutorial number + update tutorial data.

Co-authored-by: Jérémie Dumas <jdumas@users.noreply.github.com>
Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-09-27 10:40:29 -07:00
Jérémie Dumas 9a1ab67df9 Fix bug in random_point_on_mesh + crash with blue_noise on Windows. 2020-09-27 10:35:58 -07:00
Alec Jacobson 9921615af2 Merge pull request #1618 from libigl/ImGuizmo-simplify
move ImGuizmo tutorial into plugin; simplify and isolate
2020-09-27 11:53:07 -04:00
Oded Stein 8ea0b8c6dc Added vector Dirichlet and curved Hessian functionality (#1560)
* Added vector Dirichlet and curved Hessian functionality, as well as tutorials.

* Applied jdumas changes

* added github actions for this branch

* more jdumas changes

* Changed int to appropriate scalar

* moved around Int definition

* forgot braces somewhere

* forgot braces

* Applied changes suggested by jdumas

* forgot braces

* remove custom github workflow
2020-09-26 20:06:26 -07:00
Alec Jacobson d9864be29e move ImGuizmo tutorial into plugin; simplify and isolate 2020-09-26 15:59:28 -04:00
Alec Jacobson 28008528b4 Merge branch 'master' of https://github.com/libigl/libigl 2020-09-25 23:45:12 -04:00
Alec Jacobson 1ad4556268 fix minor issues with 109 2020-09-25 23:45:06 -04:00
Thomas Davies 35ba62b1a0 remove redundant templates 2020-09-25 23:36:46 -04:00
Thomas Davies ec24dccc29 add test case 2020-09-25 23:34:24 -04:00
Thomas Davies 1fda040670 3D only for signing with fwn 2020-09-25 23:34:06 -04:00
Thomas Davies 9bc3ffd98f Merge remote-tracking branch 'upstream/master' 2020-09-25 21:45:24 -04:00
Nico af8944c7b6 Remove deprecated functions (#1610)
* removed deprecated igl::internal_angles_using_edge_lengths()

* removed deprecated igl::is_border_vertex(V,F) and correct its templates

* removed deprecated igl::all_edges()
2020-09-20 23:21:28 -07:00
J.M. Soorya Narayan 3856ea92ce Add Kelvinlet deformations (#1614)
* Make igl::PI constexpr

* Fix typo in unproject_onto_mesh

* Add kelvinlets implementation

* Add a tutorial entry for kelvinlets
2020-09-20 23:19:24 -07:00
Alec Jacobson 91faf24015 rm buggy reserve 2020-09-18 19:25:43 -04:00
Alec Jacobson 28ab0d11de Merge pull request #1617 from libigl/blkdiag
blkdiag function
2020-09-18 16:21:53 -04:00
Alec Jacobson 5358cc5a36 __1:: 2020-09-18 14:59:15 -04:00
Alec Jacobson 775f2354fa blkdiag function 2020-09-18 14:21:20 -04:00
Alec Jacobson 9c49b73ade Merge pull request #1597 from libigl/blue-noise
Blue noise sampling on triangle meshes
2020-09-17 10:06:43 -04:00
Alec Jacobson d2a4b51e1e better doc 2020-09-16 22:27:36 -04:00
Alec Jacobson e608aad744 fix names 2020-09-16 22:26:02 -04:00
Alec Jacobson 10d2f75572 merge 2020-09-16 22:16:51 -04:00
Alec Jacobson a22ed58dc4 fix indentation 2020-09-16 22:09:07 -04:00
Alec Jacobson 4cb640737e Merge branch 'master' of https://github.com/libigl/libigl 2020-09-16 22:08:03 -04:00
Alec Jacobson 86c7c7db2e templates 2020-09-16 22:07:58 -04:00
Michael TaoandJérémie Dumas 21acee15fe making knn and octree work on more types than double, allowing knn to do nearest neighbor searches between two different point clouds (#1313)
removing a capture issue with gcc 4.8.4 in knn

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-09-08 07:29:12 -07:00
Jérémie Dumas eef47fe34c Merge pull request #1608 from ShuangLiu1992/patch-3
Update LibiglDownloadExternal.cmake
2020-09-07 18:49:17 -07:00
ShuangLiu1992 92dd81bb5d Update LibiglDownloadExternal.cmake
https://github.com/libigl/CoMISo/commit/d60aa4759fba76b0b793b1efb090b7a771dd7c56
2020-09-07 17:27:20 -07:00
Jérémie Dumas b42cfeba49 Merge pull request #1558 from libigl/rm-remove_duplicates
rm obsolete, poor performance, and ironically duplicate function
2020-09-07 17:11:51 -07:00
Jérémie Dumas 317f0522a8 Apt update. 2020-09-07 17:00:05 -07:00
Alec Jacobson b582ecada9 Merge pull request #1596 from libigl/rm-barycentric_to_global
rm strange function, not in use
2020-09-04 10:31:15 -04:00
Alec Jacobson bae087d7eb Merge pull request #1603 from libigl/fix-epsilon
Clarify, fix bug in epsilon parameter in remove_duplicate_vertices
2020-09-04 10:30:51 -04:00
Alec Jacobson f7067c69e9 Clarify, fix bug in epsilon parameter in remove_duplicate_vertices 2020-09-03 11:22:18 -04:00
Alec Jacobson 7db28d5700 M_PI -> igl::PI 2020-08-23 18:04:09 -04:00
Alec Jacobson 43da16bbd0 tighter test 2020-08-23 17:35:17 -04:00
Alec Jacobson 1de2627280 tests 2020-08-23 17:32:21 -04:00
Alec Jacobson c183f419e7 Merge pull request #1594 from libigl/rm-bin
rm _bin from names and use bin dir instead
2020-08-23 17:23:21 -04:00
Alec Jacobson 20924d62f1 blue noise tutorial entry 2020-08-23 16:49:34 -04:00
Alec Jacobson 48051bc889 rm strange function, not in use 2020-08-23 16:11:21 -04:00
Jérémie Dumas cb59839742 Update CMakeLists.txt 2020-08-22 13:39:40 -07:00
Alec Jacobson 4a22178717 rm _bin from names and use bin dir instead 2020-08-22 16:15:12 -04:00
Jérémie Dumas 97bd52fb52 Merge pull request #1590 from jiangzhongshi/master
move scaf to triangle folder
2020-08-22 11:12:14 -07:00
Alec Jacobson c61e28fe5a Update ViewerData.h 2020-08-21 19:47:24 -04:00
Zhongshi 07e2b01a3c move scaf to triangle folder 2020-08-17 21:16:16 -04:00
Alec Jacobson 41454f823d fix decimate bug 2020-08-15 19:49:24 -04:00
Alec Jacobson 1a4ccf65b7 Merge pull request #1554 from libigl/decimate-performance-optimization
Decimate performance optimization
2020-08-11 11:15:32 -05:00
michelleandJérémie Dumas 98a1a31641 ImGuizmo Integration (#1568)
* First working version to automatically clone ImGuizmo into libigl

* Corresponding changes to cmake files

* Moved contents of slicing plugin and menu extra to new file ImGuizmoMenu in imgui directory of igl

* Moved slicing plug into main, and ImGuizmo::EditTransform into ImGuizmoMenu which resides in igl

* Temporary hid Local and World options because they don't do anything and refactored main for tutorial 109 for clarity with some documentation

* Got orthogonal projection to render ImGuizmo normally

* Removed unecessary changes

* Removed snap parameter from ImGuizmo menu

* Added a cmake configuration for ImGuizmo

* Include imgui library in building ImGuizmo target

* Added a workflow

* Added this branch to workflow

* Update linux packages

* Explicitly include imgui header for imguizmo

* Just copy in relevant imguizmo files for now as opposed to through cmake since ImGuizmo repo does not have its own CMake file

* Conditional include to prevent mac build from failing

* Revert files for debugging cmake build

* Added build target for ImGuizmo

* Expose Imgui lib to ImGuizmo with PUBLIC interface

* Refactor build

* Get older SHA1 commit to avoid break on macOS

* Change imguizmo menu namespace

* Cleaning up + fix window border size issue.

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-08-10 12:00:07 -07:00
Alec Jacobson dde868d297 Merge branch 'master' of https://github.com/libigl/libigl 2020-08-09 18:00:39 -05:00
Alec Jacobson 3b80edbd7c search for mosek more 2020-08-09 18:00:29 -05:00
Alec Jacobson 7be8dc32af bump matlab versions 2020-08-09 18:00:06 -05:00
Vladimir S. FONOVandJérémie Dumas abd9f0f365 Fixed writing PLY file, when coordinates are stored as floats (#1581)
* Fixed writing PLY file, when coordinates are stored as floats

* Fix compilation.

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-08-09 15:55:28 -07:00
michelleandJérémie Dumas b8ee8b99cf Text Rendering Using GLSL in ImGui Menu (#1549)
* This is the code that renders the letter a for each vertex on the mesh paired with  a libigl-example-project

* Code for rendering just the number 12 on the 12th vertex

* Rendering vertices via glsl works, with geometry shader

* Added dynamic font scaling so accomodate ortho and perspective projections.

* Got faceids rendering

* Code cleanup

* This allows user to add custom text at some location rendered with the text shaders

* Dedicated separate VBOs for face and vertid labels

* Added in extra label rendering

* Moved texture binding to its own function and other code cleanup

* More conflict resolution when fetching upstream changes

* Resolved the relative path to font atlas

* Change scope variable for font atlas macro

* Removed PNG texture loaded from disk, and encoded font atlas into byte array. Other minor changes for VBO iterators and removed uneeded dependencies from previous commits

* Encapsulated text VBOs into struct to remove code duplication, and fixed bug for both overlay and text shaders being used at same time.

* Remove whitespace

* Tentative for Windows build fix not initializing TextGL structs in header

* Removed uniform that only belongs for text labels

* Added init and free methods for label buffers initialization and passing some args by reference on label methods

* Compressed font atlas that is under 50kB reduced from 330kB with decompression function

* Converting type from string literal to char array

* Broke up string literal

* Cleanup font atlas.

* Linux compile fix.

* Remove deprecated text pipeline.

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-08-09 15:49:22 -07:00
teseoch 45cfc79fed Viewer crash after calling clear (#1582)
missing check for empty uv similar to line 747
2020-08-07 10:04:45 -04:00
Patrick SchmidtandPatrick Schmidt 015ac35cd1 SCAF: Expose linear system to be solved by user code (#1553)
* Add const qualifiers

* Add scaf_system() and expose scaf::compute_energy()

* Add test "scaf_system"

Co-authored-by: Patrick Schmidt <patrick.schmidt@cs.rwth-aachen.de>
2020-07-06 07:36:59 -07:00
Alec Jacobson d95f3a410f stupid __1 junk 2020-06-30 14:26:07 -04:00
Alec Jacobson 3a110bbf4d rm obsolete, poor performance, and ironically duplicate function 2020-06-30 12:46:28 -04:00
Alec Jacobson ac56a694f2 return # comps 2020-06-30 10:43:29 -04:00
Alec Jacobson a3c3ef1572 update test too 2020-06-30 10:42:50 -04:00
Alec Jacobson b03769f26e template issue 2020-06-30 10:27:35 -04:00
Alec Jacobson 1b53e54815 rm F, dense W 2020-06-30 10:19:10 -04:00
Alec Jacobson d22414e388 func -> callback, always_... -> trivial 2020-06-29 12:10:10 -04:00
Alec Jacobson 005ae90b67 better name for always try never care defaults 2020-06-28 11:25:29 -04:00
Alec Jacobson 39c7d33b4c missing includes/templates 2020-06-27 21:17:35 -04:00
Alec Jacobson 61834f4fa1 separate header for header-only mode circular deps 2020-06-27 21:02:19 -04:00
Alec Jacobson d3248f0a0f performance improvements for decimate 2020-06-27 20:43:55 -04:00
Alec Jacobson 7ee863c92f 'using' to define function handle types 2020-06-27 17:09:36 -04:00
Alec Jacobson 58a600aebf Merge branch 'master' of https://github.com/libigl/libigl 2020-06-25 15:21:25 -04:00
Alec Jacobson 95a7b15efc Merge branch 'Dxyk-direct-delta-mush' 2020-06-25 15:21:15 -04:00
Alec Jacobson ae5d163f7d elephant data 2020-06-25 15:19:46 -04:00
Dxyk 8268a3f33b direct delta mush build fix 2020-06-22 17:57:52 -04:00
Dxyk e4ab356031 direct delta mush review fix and unit test 2020-06-22 17:26:11 -04:00
michelle 762a4ec1f4 ImGui Update to v1.76 (#1545) 2020-06-14 20:17:59 -07:00
DarioSamo 238d52c90f Address memory heap corruption on Windows open dialog on long filenames (#1544)
fixes #1513
2020-06-14 17:14:16 -07:00
Jérémie Dumas 1e78a3473a Merge pull request #1546 from DarioSamo/tutorial-patch
Add 719_ExplodedView to tutorials folder.
2020-06-12 18:25:55 -07:00
Dario 3b0ec3ce63 Add 719_ExplodedView to tutorials folder. 2020-06-12 20:13:01 -03:00
Alec Jacobson d22f873ef2 missing template 2020-06-11 12:04:14 -04:00
Dxyk ce201a7433 direct delta mush implicit method 2020-06-09 18:12:52 -04:00
Jérémie Dumas 48a7e8cd02 Merge pull request #1538 from bbrrck/master
Fix compilation error with Eigen 3.3+
2020-06-05 07:20:41 -07:00
Dxyk feb71ef502 direct delta mush fix build 2020-06-04 18:56:36 -04:00
Dxyk dc01d7e277 Merge branch 'master' of https://github.com/libigl/libigl into direct-delta-mush 2020-06-04 18:11:43 -04:00
Dxyk 75a0c4fa2c direct delta mush bug fixes 2020-06-04 18:10:58 -04:00
teseoch 60ffe1b0dc Python (#1453)
fixing templates for python bindings.
2020-06-04 12:49:06 -04:00
Tibor Stanko 0b52794637 Fix compilation error with Eigen 3.3+
Fixes the error "incompatible operand types" when libigl is compiled with Eigen 3.3+.
2020-06-04 11:50:49 +02:00
Dxyk 71e65516ae use 10 floats 2020-05-30 20:27:40 -04:00
Dxyk 3f67752504 update diagonal inverse 2020-05-28 21:37:30 -04:00
Dxyk 95a80d3fa9 computation done 2020-05-27 16:04:58 -04:00
Dxyk 5f72004d0d precomputation assert 2020-05-26 14:23:34 -04:00
Dxyk b0a8fa84e1 Merge branch 'master' of https://github.com/libigl/libigl into direct-delta-mush 2020-05-25 15:13:58 -04:00
Dxyk 162f9b8f68 precomputation done 2020-05-25 15:13:43 -04:00
Jérémie Dumas 32e3edf229 Merge pull request #1525 from bvoq/patch-1
Fixed load_mesh for obj
2020-05-24 09:32:56 -07:00
Zhongshi f3a201f1e1 Update heat_geodesics.cpp (#1512)
* Update heat_geodesics.cpp

* heat geodesic upsampled cube unit test
2020-05-24 09:31:16 -07:00
Dxyk 916a5c217d precomputation without vector form 2020-05-21 22:53:14 -04:00
Dxyk 3141dfc26d precomputation - W 2020-05-21 15:34:35 -04:00
Kevin De Keyser 14d6bcec3d Fixed load_mesh for obj 2020-05-21 17:06:13 +02:00
Dxyk 6eb02be7db direct delta mush tutorial 2020-05-19 16:21:42 -04:00
Thomas 3da9d323fb Merge pull request #1 from daviesthomas/fast_winding_signed_distance
Fast winding signed distance
2020-05-18 11:32:48 -04:00
Zhongshi c7324d3fa6 Update remove_duplicate_vertices.h (#1514) 2020-05-17 19:29:33 -07:00
Dxyk ae903ae468 direct delta mush init 2020-05-17 14:05:58 -04:00
Jérémie Dumas 3069260f07 Update README.md 2020-05-15 17:46:01 -07:00
Kenneth BlomqvistandJérémie Dumas 1df0987271 Fix issue with dijkstra algorithm (#1497)
* Use ::max vs ::infinity in dijkstra

* Add test case for discrete dijkstra distances

* Update dijkstra.cpp

* Explicit template instantiation for dijkstra test

Co-authored-by: Jérémie Dumas <jdumas@users.noreply.github.com>
2020-05-14 07:39:36 -07:00
Alec Jacobson ce9b23e8b9 Merge pull request #1510 from libigl/exploded-view
exploded view of tetrahedral meshes
2020-05-08 12:13:39 -04:00
Alec Jacobson 5c5eddcd55 exploded view of tetrahedral meshes 2020-05-08 09:08:54 -04:00
Alec Jacobson e14a3bd0a1 Merge pull request #1509 from libigl/is-edge-manifold-refactor
Remove duplicate implementation of is_edge_manifold
2020-05-08 08:52:08 -04:00
Alec Jacobson 72f0b5844b templates 2020-05-08 00:48:46 -04:00
Alec Jacobson 7e70dfbbff add changes back 2020-05-07 22:18:53 -04:00
Alec Jacobson 5b11835be1 Revert "refactor to remove duplicate (slower) implementation"
This reverts commit 829eaa54b6.
2020-05-07 22:07:29 -04:00
Alec Jacobson 829eaa54b6 refactor to remove duplicate (slower) implementation 2020-05-07 21:57:35 -04:00
Alec Jacobson d402d94959 missing namespace 2020-05-05 17:36:51 -04:00
Jérémie Dumas 60ea43092c Add issue template for code compilation. 2020-05-03 09:32:42 -07:00
Jérémie Dumas 03e65b95ca Fix Nightly CI. 2020-05-03 00:03:20 -07:00
Kobi1997 04457f1eae Add missing IGL_INLINE in scaf.cpp (#1494) 2020-05-02 15:51:20 -07:00
Alec JacobsonandJérémie Dumas 29b75796b2 Matcaps (material captures aka environment maps) in Viewer (#1482)
* matcap from texture, default normal image matcap

* update grid_texture() to generate checkerboard texture, but without UVs

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-05-02 13:04:38 -07:00
Jérémie Dumas 6664ffef18 Fix CI build on Windows. (#1495) 2020-05-02 12:56:39 -07:00
Alec Jacobson 7ae4fb1fc1 Merge pull request #1487 from libigl/connected_components
Connected components
2020-04-19 15:36:07 -04:00
Jérémie Dumas 2cd50a8bc8 More Eigen::Index goodness. 2020-04-19 11:10:14 -07:00
Alec Jacobson 78a212d4ca int type 2020-04-19 13:46:31 -04:00
Alec Jacobson 215994dc07 missing implementation 2020-04-19 13:31:03 -04:00
Alec Jacobson e88249f68d rm debug assert 2020-04-19 13:30:41 -04:00
Alec Jacobson 1f4a27e73c Merge pull request #1488 from libigl/wire_mesh
per-edge thicknesses, coplanar test and templates
2020-04-19 13:26:52 -04:00
Alec Jacobson f2cc26f284 Merge pull request #1476 from libigl/bezier
Bézier curve evaluation and fit cubic Bézier spline to stream of points
2020-04-19 12:39:02 -04:00
Alec Jacobson 8e35d87991 per-edge thicknesses, coplanar test and templates 2020-04-18 22:15:58 -04:00
Alec Jacobson 4516d19268 template 2020-04-18 21:16:54 -04:00
Alec Jacobson 80e763d372 Merge pull request #1484 from libigl/templates
templates
2020-04-18 20:28:58 -04:00
Alec Jacobson 7798748774 connected components and better facet_components 2020-04-18 20:25:24 -04:00
Alec Jacobson 1aa35de249 passing facet_components unit test 2020-04-18 20:25:24 -04:00
Alec Jacobson 5a6e3125f3 templates 2020-04-17 11:51:44 -04:00
Alec Jacobson 18c5a9ddf0 Merge branch 'master' of https://github.com/libigl/libigl into bezier 2020-04-17 11:45:07 -04:00
Alec Jacobson 8f33348c29 bug fix (set true for all cores) 2020-04-17 11:44:51 -04:00
Jérémie Dumas c47f1dab9b Comment FPE for now. (#1477) 2020-04-15 14:41:07 -07:00
Alec Jacobson 6f5fadd154 static + capture by reference = bad idea 2020-04-13 22:41:35 -04:00
Alec Jacobson a6ca070009 Merge pull request #1479 from libigl/jdumas/issues
Update issue templates
2020-04-13 10:12:03 -04:00
Alec Jacobson e8b2170dd3 Merge pull request #1480 from libigl/double-sided-lighting
Toggle double sided lighting
2020-04-12 20:23:10 -04:00
Jérémie Dumas b632972487 Make double_sided a bool option. 2020-04-12 14:16:09 -07:00
Alec Jacobson 9fa54a0398 double sided lighting 2020-04-12 16:01:29 -04:00
Jérémie Dumas 0c5bb13883 Update issue templates
Update templates.

Update templates.

Update templates.

Update templates.

Rename.

Copy.

Update.
2020-04-12 09:45:01 -07:00
tamasmeszaros 651fc234cd Fixes build with mingw-w64 (#1335) 2020-04-11 20:29:44 -07:00
Alec Jacobson 4ca4f8b341 support closed loops 2020-04-11 20:21:19 -04:00
Alec Jacobson 4ab389d462 bezier eval and fit cubic bezier splin 2020-04-11 19:54:29 -04:00
Alec Jacobson c16bc37fcb missing include 2020-04-11 19:50:51 -04:00
Alec Jacobson 1ad57f019c Templates (#1475)
* templates, comments and templatefixes

* linux doesn't like __sFile

* more templates
2020-04-11 16:00:41 -07:00
Jérémie Dumas 698c316159 Merge pull request #1474 from libigl/jdumas/clone-depth
Update clone depth.
2020-04-11 12:49:49 -07:00
Alec JacobsonandJérémie Dumas faaae91419 Fix bug in signed_distance for 2D (#1400)
* Fix bug in signed_distance for 2D

* another bug fix

* missing templates

* overzealous no-op templating

* another bug... and a test.

* uncomment lines in test; templates

* Update per_edge_normals.cpp

* Update signed_distance.cpp

Co-authored-by: Jérémie Dumas <jdumas@users.noreply.github.com>
2020-04-11 12:14:12 -07:00
Janos95andJérémie Dumas 0f557400f9 dont use floating point values to index eigen types (#1361)
* dont use floating point values to index eigen types

* only cast doubles not the whole expression

* add remaining casts

* Update cast.

Co-authored-by: Jérémie Dumas <jeremie.dumas@ens-lyon.org>
2020-04-11 12:13:03 -07:00
Mathieu Lamarre df5b320f57 Fix compilation error in face_occurrences.cpp (#1402)
* Fix compilation error

When IntegerC is long long int with gcc 7.4
2020-04-11 11:48:07 -07:00
Jérémie Dumas a90a67bdf2 Update clone depth. 2020-04-11 11:44:23 -07:00
Jérémie Dumas a203de97aa Update pull_request_template.md (#1348)
* Update pull_request_template.md
2020-04-11 11:33:34 -07:00
Thomas Auzinger 4827b40640 Extended serialization functionality to Eigen::Array. (#1113)
* Extended serialization functionality to Eigen::Array.
2020-04-11 11:29:14 -07:00
Kacper Pluta f029832904 Add extra exceptions for arithmetic and types operations (#1001)
* This PR allows for extra exceptions in the debug mode (GCC/LLVM) on Linux based OSes - it does not work on the other operating systems.
Relevant documentation: https://linux.die.net/man/3/feenableexcept
2020-04-11 11:16:51 -07:00
Nico 7576c3b8ad fix align_camera_center in Viewer::init() for multiple cores (#1349)
* Iterate over viewer.core_list and viewer.data_list and align_camera_center per core with visible data.
2020-04-11 11:04:26 -07:00
Alec Jacobson 10dc1fd9f8 Merge pull request #1422 from vfonov/tinyply_reader_writer
Replace .ply reader/writer with tinyply library
2020-04-11 13:43:54 -04:00
AdithyaPediredla 546452da5a Bug fix in csvreads. (Bug #1423) (#1430)
* Bug fix in csvreads.
2020-04-11 10:24:12 -07:00
Raymond Yun Fei c1c88fd78b numeric_limits<double>::min() is the minimal positive number (#1438)
Fixes #1411
2020-04-11 10:22:27 -07:00
Vladimir S. FONOV c907add524 Fixes stack overwriting bug in gl::is_stl, when file have binary data (#1431)
* Fixes stack overwriting bug in gl::is_stl, when file have binary data
detected by running with ASAN in all_meshes test
2020-04-11 10:21:32 -07:00
Jérémie Dumas 726cd540c3 Delete .travis.yml 2020-04-11 10:08:56 -07:00
Christoffer Green b9093020ab Apply patch for 32-bit support (#1471)
Fixes #1095 and #1047
2020-04-11 10:00:44 -07:00
Jérémie Dumas 021ec6f946 Dot not build tutorials in Debug mode. (#1473)
* Dot not build tutorials in Debug mode.

Fix script.

Limit num of parallel jobs on Windows Nighlty.

Update job matrix.

Update job matrix.

Update job matrix.

Rename jobs.

* Limit branches that triggers a CI build.

* Restore original name.
2020-04-11 09:57:38 -07:00
Jérémie Dumas b550323ef0 Merge pull request #1441 from BruegelN/fix-average_onto_faces-namespace
Added igl namespace average_onto_faces.cpp
2020-04-11 09:27:41 -07:00
Nico Brügel 5c7298c2fc Added igl:: to average_onto_faces.
Might resolve https://github.com/libigl/libigl-python-bindings/issues/35
2020-04-09 00:29:56 +02:00
Jérémie Dumas 5239d12eb3 Update README.md (#1470) 2020-04-08 15:27:45 -07:00
Jérémie Dumas 01466e5bd6 Update README.md (#1469) 2020-04-08 15:23:05 -07:00
Alec Jacobson 3cb4894eaf Merge pull request #1468 from libigl/dev
Build / Linux (Release, OFF) (push) Waiting to run
Build / Linux (Release, ON) (push) Waiting to run
Build / macOS (Release, OFF) (push) Waiting to run
Build / macOS (Release, ON) (push) Waiting to run
Build / Windows (Release, OFF) (push) Waiting to run
Build / Windows (Release, ON) (push) Waiting to run
Release 2.2
2020-04-08 17:57:08 -04:00
Alec Jacobson 62b3350271 Merge pull request #1389 from jdumas/jdumas/github-actions
Enable GitHub Actions for continuous integration
2020-04-08 17:48:13 -04:00
Vladimir S. FONOV 52c6f14ca6 Replace .ply reader/writer with tinyply library, supersedes libigl/libigl#1235
Updated SHA for libigl-tests-data
removed obsolete ply.h
updated tinyply to compile with and without LIBIGL_USE_STATIC_LIBRARY
fixed template instantiation signatures to work with gcc
fixed integer classes for visual studio
fixed igl::tynyply_type redefinition
added command to install ccache in .travis.yml
added test for writePLY
changed asserts inside writePLY code
fixed some bugs in writePLY code
made PLY reader/writer work with quad meshes
made PLY reader/writer work with tristrips
2020-03-24 18:15:36 -04:00
allo- 4ce917d424 Issue 521 (#1327)
* Added unit test for issue #521

Unit test adapted from https://github.com/qnzhou/libigl-unit-tests/blob/master/include/igl/delaunay_triangulation.cpp

* Fix iterator out of range error in lexicographic_triangulation (closes #521)

The iterator is now always decreased, so it points to the current left
side of the triangulation again after erasing the current item.
When the iterator is at the beginning of the boundary, it needs to point
to the last element (boundary.end()-1) after decreasing, so we have to
decrease the iterator in all cases.

In addition, the line
    if (itr == left_itr || itr == right_itr) continue;
is simplified to
    if (itr == left_itr) continue;

because the condition itr == right_itr will never be hit, because the
line before breaks the loop, when itr == right_itr:
    if (itr == right_itr) break;
2020-02-29 18:19:52 -05:00
Qingnan ZhouandJérémie Dumas 26053f696c Avoid involving Eigen/SparseExtra in slice. (#1370)
* Avoid involving Eigen/SparseExtra in slice.

* Undo merging error...

* Remove more deprecated DynamicSparseMatrix in slice.

* Typo.

* Avoid narrowing error in initializer list.

* Cleanup igl::slice, add igl::slice_sorted, add unit test and benchmarks + update Catch2.

* Missing template.

* Template for Windows.

Co-authored-by: Jérémie Dumas <jdumas@users.noreply.github.com>
2020-02-16 22:31:06 -05:00
Alec Jacobson 92b25d30a8 Templates (mostly single-precision float types) (#1396)
* templates

* fix file template

* windows template

* more windows templates
2020-02-16 16:33:13 -05:00
teseoch 87bfaeeba8 Templates and other fixes for python bindings (#1379)
* face occurences fixed

* flipped_triangles templates

* templates

* extract_manifold_patches templates

* normal_derivative templates

* orient_outward snap_points
2020-02-16 16:27:52 -05:00
Alec Jacobson 79e7a05b16 Fix bug in https://github.com/libigl/libigl/issues/1204 2020-02-14 11:59:07 -05:00
Jérémie Dumas 56f129e440 Merge pull request #1399 from evouga/hsv
Allows hsv_to_rgb to work on negative hues
2020-01-03 19:53:30 -05:00
Etienne Vouga 5987ee483e Make hsv_to_rgb map the hue periodically to [0, 360] if the input hue is negative, rather than returning undefined rgb. 2020-01-03 14:34:47 -06:00
Alec Jacobson 87b54fc4dc Update voxel_grid.h 2020-01-01 19:53:08 -05:00
Jérémie Dumas d3052ef4c7 Replace IGL_DEBUG_OFF with a [slow] tag for now. 2019-12-19 15:45:56 -05:00
Jérémie Dumas 252017af44 Add workflows for GitHub Actions + misc fixes.
- Fixes #1229 by defaulting to static MSVC runtime on Windows.
- CMake will now fail if LIBIGL_WITH_CGAL is ON but CGAL is not found
  (e.g. missing Boost or gmp/mpfr).
- Removed some duplicated template instantiations on Windows.
- Added IGL_DEBUG_OFF to disable slow unit test in Debug configuration
  by default.
- Do not FORCE options given to third-party libraries.
2019-12-19 15:19:32 -05:00
Jérémie Dumas ea0515088e Add CMake file to sort targets into folders (#1383)
* Add CMake file to sort targets into folders.

* Do not set FOLDER property on INTERFACE targets.
2019-12-14 14:59:10 -05:00
Jérémie Dumas 03528b295e Merge pull request #1376 from jiangzhongshi/patch-1
Update reference link in active_set
2019-12-14 11:11:14 -05:00
Jason Juang abdc6792d7 install hpp files (#1363) 2019-12-12 18:13:27 -05:00
Zhongshi 579385f107 Update reference link in active_set 2019-12-11 08:52:26 -05:00
Nico 5d9d9c8eff Make use of IGL_DEPRECATED (#1380)
* Make use of IGL_DEPRECATED() macro in igl::all_edges, igl::internal_angles and igl::is_border_vertex.
CTRL+F for "deprecated" find functions where the comment says that the functioin is deprecated.

* Removed #include deprecated.h for igl::nchoosek and igl::readOBJ because it looks like the functions which have been marked as deprecated are already gone.

* update IGL_DEPRECATED to make use of C++14 feature [[deprecated]].

* replace deprecated igl:is_border_vertex(V,F) with igl::is_border_vertex(F).

* fixed IGL_DEPRECATED: added prama message if the compiler is unknonw and fixed macro for MSVC.

* Add IGL_DEPRECATED to igl::remove_duplicates() to mark it as deprecated.
2019-12-10 23:14:57 +00:00
Jérémie Dumas d9b218f1f8 Thread-safe predicate initialization using singleton pattern. (#1377)
* Thread-safe predicate initialization using singleton pattern.

* Update predicates.

* Update predicates.
2019-12-08 03:10:00 +00:00
Jérémie Dumas 77ed6247cb Add colormap option to set_data + update jet implementation. (#1372)
* Add cmap option to set_data + fix jet colormap.

* Switch from jet to turbo.

* Add explicit turbo colormap.

* Add option for number of intervals in colormap.

* Switch to Viridis as default.
2019-12-02 10:54:02 +00:00
Alec Jacobson 05812f73a6 Merge pull request #1371 from libigl/alecjacobson-dev
Phong color mapping for scalar field data, refactor tutorials
2019-12-01 12:14:13 -05:00
Alec Jacobson 1f796d4d27 typo 2019-12-01 01:55:14 -05:00
Alec Jacobson b95646d268 missing isolines_map 2019-12-01 01:52:07 -05:00
Alec Jacobson d46d9c8ef5 use set_data instead of set_color 2019-12-01 01:51:23 -05:00
Alec Jacobson 37b087a275 set data rather than custom shader 2019-11-30 20:27:31 -05:00
Alec Jacobson 0f73830f92 Merge pull request #1364 from libigl/sharp-edges
Sharp edge extraction
2019-11-30 20:15:38 -05:00
Alec Jacobson 10ad76e11e merge 2019-11-30 20:14:19 -05:00
Alec Jacobson 3d05330b68 Merge pull request #1369 from libigl/quad-grid
Quad grid
2019-11-30 20:11:21 -05:00
Alec Jacobson 3a1eb5446a tempaltes 2019-11-30 15:18:23 -05:00
Alec Jacobson 9e25fbbb0f templates 2019-11-30 15:17:55 -05:00
Alec Jacobson 8f17104fdc Merge branch 'quad-grid' of https://github.com/libigl/libigl into alecjacobson-dev 2019-11-30 13:05:32 -05:00
Alec Jacobson b38c6d7341 template wrong 2019-11-30 13:05:09 -05:00
Alec Jacobson e84d628a1e template 2019-11-30 13:04:13 -05:00
Alec Jacobson 1698dfb51a merge 2019-11-30 12:44:22 -05:00
Alec Jacobson d47eeaa5ba delete sharp edges; they're on another pr 2019-11-30 12:03:17 -05:00
Alec Jacobson 105b57dd48 missing include 2019-11-30 11:59:33 -05:00
Alec Jacobson 9207ee1502 Merge branch 'dev' of https://github.com/libigl/libigl into quad-grid 2019-11-30 11:58:23 -05:00
Alec Jacobson 5847741f3e Merge pull request #1366 from libigl/templates
Templates and other minor changes
2019-11-30 11:53:26 -05:00
Alec Jacobson 6c50f857a9 Merge pull request #1365 from libigl/alecjacobson-patch-test_common
Update test_common.h
2019-11-30 11:53:02 -05:00
Alec Jacobson 880cfa9885 Merge branch 'dev' of https://github.com/libigl/libigl into sharp-edges 2019-11-29 19:26:52 -05:00
Alec Jacobson 3637cf3ca9 missed a colon 2019-11-29 19:24:28 -05:00
Alec Jacobson 8b96d8ca96 rm performance pitfall templates 2019-11-29 19:22:01 -05:00
Alec Jacobson 317379941f cr 2019-11-29 19:11:30 -05:00
Alec Jacobson 12f6b60147 Merge pull request #1368 from libigl/cursor-projections
Cursor (un-)projections
2019-11-29 19:05:40 -05:00
Alec Jacobson 46a8dd2fd4 rm load_matrix 2019-11-29 19:03:10 -05:00
Alec Jacobson 6a7428694f rm load_mesh 2019-11-29 18:58:45 -05:00
Alec Jacobson 472ee3e576 no load_obj... 2019-11-29 18:50:02 -05:00
Alec Jacobson fabb4ae4ec grid 2019-11-29 11:03:01 -05:00
Alec Jacobson 9c18186640 doc outputs 2019-11-29 10:24:15 -05:00
Alec Jacobson bcbcabf9d3 remove obsolete templates 2019-11-29 10:22:00 -05:00
Alec Jacobson 9b4ffcc591 Update ViewerCore.cpp 2019-11-29 10:17:50 -05:00
Alec Jacobson b29964ccbc cursor un-project with constraint 2019-11-29 09:43:01 -05:00
Alec Jacobson 00e749bf8c merge 2019-11-29 09:09:39 -05:00
Alec Jacobson 8507b929cd Update test_common.h 2019-11-29 09:08:13 -05:00
Alec Jacobson 2c3c2b86f4 templates and other minor changes 2019-11-29 09:05:44 -05:00
Alec Jacobson abe94567a8 Update grid.h 2019-11-29 08:54:26 -05:00
Alec Jacobson a7e2fdd3ed sharp edges 2019-11-29 08:42:19 -05:00
Alec Jacobson 017be56c49 Merge pull request #1352 from libigl/alecjacobson-patch-1
Update heat_geodesics.cpp
2019-11-29 08:37:01 -05:00
Alec Jacobson f323a8ecb1 Update heat_geodesics.cpp 2019-11-13 08:57:00 -05:00
Alec Jacobson 2ecb5fc85f Merge pull request #1347 from libigl/icp
iterative closest point algorithm, tutoiral, test
2019-11-11 09:26:13 -05:00
Alec Jacobson 6121d86961 Merge branch 'dev' into icp 2019-11-10 17:33:50 -05:00
Alec Jacobson 88e3dd1e3e iterative closest point alg, tutoiral, test 2019-11-10 17:20:59 -05:00
Alec Jacobson 024785513b Merge pull request #1345 from libigl/alecjacobson-patch-2
fix https://github.com/libigl/libigl/issues/1343
2019-11-10 15:13:07 -05:00
Alec Jacobson 4b3a874276 Update random_points_on_mesh.h 2019-11-10 14:35:23 -05:00
Alec Jacobson 4bc8ad5206 fix https://github.com/libigl/libigl/issues/1343
floating point error could lead final value in cumsum to be <1. It should be ==1 so that the random values [0,1] do not exceed range spanned by cumsum.

(I couldn't manage to trigger a bad random value, but I confirmed that the old code had values of 0.99999999999993516 instead of 1.0. So I now believe it _could_ have happened.)

https://github.com/libigl/libigl/issues/1343
2019-11-10 12:21:31 -05:00
Alec Jacobson 7ab7dc7394 Merge pull request #1344 from libigl/alecjacobson-patch-1
Fix underflow issue when computing normalization
2019-11-08 14:30:02 -05:00
Alec Jacobson 9145faf782 Fix underflow issue when computing normalization 2019-11-08 10:33:06 -05:00
hanxiao 911124a37b Merge pull request #1332 from hankstag/pr_cut_mesh
cut mesh refactor
2019-11-08 10:31:49 -05:00
hanxiao 306b7c7c78 extend input to support user defined TT 2019-11-05 20:11:47 -05:00
hanxiao a26951b219 renaming 2019-11-05 18:33:28 -05:00
Alec Jacobson 1af9b9707f Merge pull request #1274 from skoch9/python
Python Bindings Template Fixes 2.0
2019-11-04 17:21:55 -05:00
Alec Jacobson 1ac07a19a4 Merge pull request #1218 from libigl/fast-winding-number-soups
Fast winding number soups
2019-11-04 17:20:06 -05:00
Alec Jacobson 27aee6490b minor 2019-11-04 09:49:42 -05:00
Alec Jacobson f2d7b0ccb0 significantly (10x) speed up cloud eval 2019-11-04 09:49:28 -05:00
Alec Jacobson a8f978a42b test for fwn 2019-11-04 09:49:11 -05:00
Alec Jacobson 6d48149a10 templates 2019-11-04 09:48:59 -05:00
Alec Jacobson bdcb2c34c1 merge with dev 2019-11-03 11:19:48 -05:00
Alec Jacobson 8ddec02a01 Merge branch 'master' of http://github.com/libigl/libigl into fast-winding-number-soups 2019-11-03 11:17:38 -05:00
Alec Jacobson b856e042e2 Merge pull request #1337 from libigl/alecjacobson-patch-1
Bug fix in marching_tets
2019-11-03 10:46:04 -05:00
Jérémie Dumas 3b0cd79fde Move ti outside v loop. 2019-11-02 13:42:51 -04:00
Alec Jacobson e470b2ea9e Bug fix in marching_tets
J was not always being filled in and then it was erroneously resized to the wrong length. This most immediately _**broke**_ the WindingNumber tutorial.
2019-11-02 13:42:51 -04:00
Ben Jones ea36b688e0 Fix is_irregular_vertex for triangle meshes (#1320)
Output vector was one too short for is_irregular_vertex. It is still broken for quad meshes since it relies on is_border_vertex, which does not work for quad meshes due to using triangle_triangle_adjacency.
2019-10-31 18:00:43 -04:00
Hank Shen 46f534515b update git tag 2019-10-27 14:57:33 -04:00
Hank Shen f4d14cc7d1 change cut mask 2019-10-27 11:56:38 -04:00
Hank Shen b4faebf34e refactor cut_mesh 2019-10-27 11:26:27 -04:00
Thomas Davies e2548f971c python bindings for signed_distance with fast_winding_number 2019-10-24 13:06:24 -04:00
Thomas Davies 6983cfd1f4 explicit templating 2019-10-24 11:06:01 -04:00
hanxiao 72cc55c16e Merge pull request #1303 from hankstag/pr-nrosy
update nrosy to match the MIQ paper
2019-10-22 16:41:21 -04:00
Jérémie Dumas ca24107dda Merge pull request #1278 from tamasmeszaros/raycasting-perf-bottleneck
Fix performance bottleneck caused by unnecessary  memory allocations.
2019-10-22 01:35:41 +00:00
Thomas Davies 2f570a0e97 signed distance from pre computed fast winding number bvh 2019-10-21 13:02:49 -04:00
Thomas Davies edb21bef2c rename fast winding tree for clarity 2019-10-21 10:11:33 -04:00
Thomas Davies 48e3c72dfe fast winding number signed distance function
added dedicted functions to fast winding number for fast inference from pre computed AABB tree and BVH
2019-10-21 10:09:54 -04:00
Thomas Davies d7dd3c2356 expose fast winding in python bindings 2019-10-19 11:42:31 -04:00
tamasmeszaros 2746958a89 Fix performance bottleneck caused by unnecessary memory allocations. 2019-10-19 09:28:35 -04:00
Alec Jacobson 9c049ec9be Revert "Set default value for ViewerCore::rotation_type" (#1319)
* Revert "Set default value for ViewerCore::rotation_type"

* More initialization to constructor.

* Update ViewerCore.cpp
2019-10-19 13:22:50 +00:00
Jérémie Dumas f41aa6ea3d Merge pull request #1314 from libigl/jiangzhongshi-patch-2
Delete Embree_convenience.h
2019-10-18 13:54:40 +00:00
ShuangLiu1992 d4526d742f Update libigl.cmake (#1299)
* Update libigl.cmake

https://github.com/libigl/CoMISo/pull/10

fix Eigen include issue for CoMISo when libigl is being added as a subproject via invoking add_subdirectory, while the master project has already defined Eigen3::Eigen

* Update libigl.cmake

* Update libigl.cmake

* Update libigl.cmake
2019-10-18 08:03:50 -04:00
Jérémie Dumas 28f20cdc18 Merge pull request #1288 from stnoh/dev
# fix issue #1237
2019-10-17 08:27:22 -04:00
Jérémie Dumas 39dd969ce8 Merge pull request #1315 from BruegelN/fix-105_Overlays
activate label rendering for tutorial 105 overlays.
2019-10-17 08:19:00 -04:00
Jérémie Dumas 3eb0d1c670 Merge pull request #1318 from libigl/jiangzhongshi-patch-3
Set default value for ViewerCore::rotation_type
2019-10-17 08:18:02 -04:00
Jérémie Dumas bd8fc309e3 Merge pull request #1317 from BruegelN/fix-install-exclude-embree
Prevent the export of Embree into the directiory specified by 'CMAKE_…
2019-10-17 08:17:51 -04:00
Zhongshi 92f26006cd Set default value for ViewerCore::rotation_type
Fix a complaint from Valgrind.
2019-10-16 23:26:05 -04:00
BruegelN e8969c21a6 Prevent the export of Embree into the directiory specified by 'CMAKE_INSTALL_PREFIX' when calling 'make install'. Tested and verified on both macOS and Ubuntu. 2019-10-16 17:52:36 +02:00
BruegelN 02936bb200 activate label rendering for tutorial 105 overlays. 2019-10-15 21:11:18 +02:00
Zhongshi 1445ad2a50 Delete Embree_convenience.h
This file seems to be out of date and not useful anymore.
2019-10-15 12:17:58 -04:00
Thomas Davies 61878ade62 fast winding for signing distance 2019-10-14 18:45:08 -04:00
Thomas Davies 3404ee671b fast winding number computation of single point 2019-10-13 21:32:35 -04:00
Thomas Davies 21d95881ed Merge branch 'fast-winding-number-soups' of https://github.com/daviesthomas/libigl 2019-10-12 10:45:03 -04:00
Alec Jacobson 47da86a30d Merge pull request #1309 from mtao/master
made list_to_matrix support empty inputs on matrices with static sizes
2019-10-10 12:16:57 -04:00
Zhongshi 8cbc8da130 Update volume.h (#1310) 2019-10-10 12:02:46 -04:00
Teseo Schneider e27c51529a templates 2019-10-10 10:23:12 -04:00
Michael Tao 9bdb6a4554 made list_to_matrix support empty inputs on matrices with static sizes 2019-10-09 11:17:48 -04:00
DerouineauNicolas 83b8e45103 Keep reference to multiple material when reading obj (#1280)
* Update issue_template.md

* Update issue_template.md

* Update issue_template.md

* Update issue_template.md

* Better doc

* WIP: Add function to load obj with material

* Fix error with gcc

* Read material and push it to the FM vector

* Code cleaning

* Use generic function overload

* switch to std::tuple<std::string, Index, Index >> for face material association

* Change SHA1 in libigl test data

* update the URL in the CMake to point to own fork

* Update LibiglDownloadExternal.cmake
2019-10-08 11:47:16 -04:00
Teseo Schneider e4507bbe99 directed_edge_orientations templates 2019-10-07 18:30:05 -04:00
Zhongshi 9294ba04c2 fixes #1295 (#1305) 2019-10-04 14:35:17 -04:00
Teseo Schneider b29b067ff2 temapltes 2019-10-04 12:11:07 -04:00
Zhongshi c9c2d3db79 Revise the documentation for dijkstra (#1298) (#1304) 2019-10-04 09:44:21 -04:00
hanxiao b819252a49 consistent kappa sign in assertion 2019-10-03 10:06:01 -04:00
hanxiao 1bd4a63b29 update nrosy based on MIQ 2019-10-02 17:46:52 -04:00
Teseo Schneider af2e58d313 fixed tetgen warpper for point clouds 2019-09-23 19:36:59 -04:00
Teseo Schneider 3840f803f3 fixed marching tets 2019-09-23 19:04:12 -04:00
Alec Jacobson c645aac0c5 Update adjacency_matrix.h 2019-09-19 16:49:52 -04:00
Francis Williams 9b51e2225e fix some template issues 2019-09-18 19:19:15 -04:00
Seung-Tak Noh a65d3d2bef # fix issue
- make sure to create M.diagonal().transpose() as M_diag_tr
- using proper type: double -> Scalar
2019-09-16 19:07:47 +09:00
Zhongshi b0d7740e0b Use edge length from mesh in igl::dijkstra. (#1170)
* Add new (and sane) overload to Dijkstra

* Add a test for Dijkstra

* Dijkstra: template instantiation for static build, and small fixes
2019-08-15 09:46:29 -04:00
hanxiao bae71eb04b Merge pull request #1169 from hankstag/pr-predicates
Ear clipping triangulation and robust 2d segment intersection test
2019-08-15 09:44:49 -04:00
Teseo Schneider 30c7b6b0e0 fixed sizes on voxedl grid 2019-08-15 12:48:02 +02:00
hanxiaoandZhongshi 238c5a6226 Update include/igl/predicates/point_inside_convex_polygon.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-14 16:17:51 -04:00
martin-marinov77 4e5dfe1aae Fix a potential crash when initializing the map for meshes with holes (#1263)
* * Fix a potential crash when initializing the map for meshes with holes
* Fix a minor conversion warning

* * Fix a potential crash when initializing the map for meshes with holes
* Fix a minor conversion warning
2019-08-14 14:20:02 -04:00
Zhongshi 8e3b2d913d Merge pull request #1267 from libigl/jiangzhongshi-patch-1
Typo in documentation in orient2D
2019-08-14 14:17:01 -04:00
Francis Williams 4c6d732a8b Merge pull request #1271 from skoch9/python
Python v2
2019-08-14 11:52:47 -04:00
KarlLeell 964beea9bf fix HalfEdgeIterator 2019-08-13 14:49:10 -04:00
KarlLeell 32e8366702 fix hessian 2019-08-13 14:18:01 -04:00
KarlLeell 465ad7c9c4 fix hessian_energy 2019-08-13 14:07:49 -04:00
hanxiaoandZhongshi 7a31b0801c Update include/igl/predicates/segment_segment_intersect.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-12 11:04:25 -04:00
hanxiaoandZhongshi c74bfe9504 Update include/igl/predicates/point_inside_convex_polygon.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-12 11:04:15 -04:00
hanxiaoandZhongshi 71d1553a01 Update include/igl/predicates/point_inside_convex_polygon.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-12 11:04:09 -04:00
hanxiaoandZhongshi 6349d39893 Update include/igl/predicates/ear_clipping.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-12 11:04:00 -04:00
hanxiaoandZhongshi 8d1b2f9e87 Update include/igl/predicates/ear_clipping.h
Co-Authored-By: Zhongshi <zj495@nyu.edu>
2019-08-12 11:03:44 -04:00
Zhongshi 243ab03cce Typo in documentation in orient2D 2019-08-11 16:55:04 -04:00
hanxiao ad5747423b fix index 2019-08-11 16:35:33 -04:00
Francis Williams c2a4fdc912 Merge pull request #1228 from skoch9/python
Python
2019-08-09 12:55:54 -04:00
Francis Williams 62a01167b6 fix casting issue 2019-08-09 11:05:54 -04:00
Teseo Schneider a9e2ce5fc5 reverted array to scaf 2019-08-08 16:23:07 +02:00
Teseo Schneider 7f6f1670b4 added another overload of slice 2019-08-08 15:31:14 +02:00
Teseo Schneider 0ba3e92274 reverted arrays 2019-08-08 15:12:25 +02:00
Teseo Schneider 894703eba8 fixed duplicated templates 2019-08-08 14:35:02 +02:00
teseoch 3c5698acfa Merge branch 'dev' into python 2019-08-08 14:26:23 +02:00
Teseo Schneider 0bb49a9f77 composite harmonic 2019-08-08 14:14:44 +02:00
Teseo Schneider f78ff3afe2 fixed loop 2019-08-08 13:49:28 +02:00
Teseo Schneider 7435cce28c fixed types in biharmonic_coordinates.cpp 2019-08-08 11:54:35 +02:00
Jérémie Dumas de91fdd9d0 Merge pull request #1258 from v1kko/dev
Avoid reading beyond boundaries of arrays in readSTL.cpp
2019-07-28 11:22:30 -07:00
Lawson Fulton a03d1a2d56 Path to edges + various template instantiations (#1259)
* templates

* templates

* Templates

* templates

* Adding path_to_edges function and unit test

* Fixes and more tests

* Making index more general

* syntax error

* Fixing test and better name
2019-07-28 10:16:35 -07:00
Jérémie Dumas b79e8374a8 Merge pull request #1251 from BruegelN/fix-dirty-flag-ViewerData.set_color
set dirty flags for specular and ambient too inside igl::opengl::ViewerData::set_colors().
2019-07-28 10:04:07 -07:00
Teseo Schneider dd98677630 fixed singularities 2019-07-25 09:35:08 -04:00
Francis Williams 81c74cf300 small fixes to slim 2019-07-24 18:16:51 -04:00
KarlLeell 1958f02fff fix cut_mesh_from_singularities 2019-07-23 14:32:42 -04:00
KarlLeell 80b2282f69 fix doc includes unnecessary argument 2019-07-23 12:59:55 -04:00
Teseo Schneider dc1a4bbd47 windows templates 2019-07-22 18:05:52 -04:00
Teseo Schneider 40079347cb windows templates 2019-07-22 17:43:52 -04:00
Teseo Schneider 4b45b79e64 added missing templates 2019-07-22 15:40:50 -04:00
KarlLeell d77c8d1647 Fix unproject_in_mesh 2019-07-21 00:08:49 -04:00
KarlLeell 9d2ed3d718 Fix segment_segment_intersect code not templated 2019-07-19 17:55:37 -04:00
KarlLeell 247dbcad52 Fix resolve_duplicated_faces code not templated 2019-07-19 17:27:08 -04:00
KarlLeell 91bdb81556 Fix remove_duplicates, resolve_duplicated_faces, segment_segment_intersect, shape_diameter_function 2019-07-19 01:00:02 -04:00
Teseo Schneider f008687ce4 random point on mesh 2019-07-18 18:45:22 -04:00
KarlLeell 46db744e3c Keep fixing procrustes not templated 2019-07-18 17:30:57 -04:00
KarlLeell e5cded34ff Keep fixing procrustes not templated 2019-07-18 17:24:00 -04:00
KarlLeell 512cfd6830 Fix procrustes code not templated 2019-07-18 17:13:08 -04:00
KarlLeell 3255d6d3d9 Fix procrustes 2019-07-18 16:02:18 -04:00
KarlLeell 21da5574cd per_vertex_attribute_smoothing 2019-07-17 20:59:13 -04:00
Teseo Schneider 594ae9b64e upsample 2019-07-17 15:37:30 -04:00
KarlLeell 8cee0a2d89 Fix unproject_onto_mesh 2019-07-17 15:17:44 -04:00
KarlLeell 46c5349641 Fix a documentation problem 2019-07-17 15:06:10 -04:00
KarlLeell 84b994b1cf Fix in_element 2019-07-17 14:05:50 -04:00
KarlLeell 302073a5f6 Fix crouzeix_raviart_massmatrix and per_edhe_normals for more dtypes binding 2019-07-17 13:32:00 -04:00
KarlLeell 719d3f84c1 fix unproject_onto_mesh 2019-07-17 11:47:24 -04:00
Victor Azizi 734ff706a9 Avoid reading beyond boundaries of arrays in readSTL.cpp 2019-07-17 09:35:24 +02:00
KarlLeell f6ffa60ce8 Fix crouzeix_raviart_massmatrix 2 2019-07-16 23:26:04 -04:00
KarlLeell f56d32d546 Fix crouzeix_raviart_massmatrix 2019-07-16 22:38:41 -04:00
Francis Williams eb1466ef5f fix bad templating 2019-07-16 18:45:29 -04:00
Teseo Schneider 1e3cfb42c7 unproject and crouzeix_raviart_cotmatrix.cpp 2019-07-16 18:16:04 -04:00
Teseo Schneider bc480bc59b Merge branch 'python' of https://github.com/skoch9/libigl into HEAD 2019-07-16 15:51:21 -04:00
Teseo Schneider ce432e4f11 fixed isolines and added missing windows template 2019-07-16 15:50:56 -04:00
KarlLeell c65eb586fe Fix unproject_ray 2019-07-16 15:46:16 -04:00
Teseo Schneider 457d07b7bf merge 2019-07-15 19:07:25 -04:00
Teseo Schneider 6fb2fc37f4 templating hausdorff 2019-07-15 19:03:34 -04:00
KarlLeell b1394524b4 fix hausdorff and point_mesh_squared_distance 2019-07-15 16:53:06 -04:00
KarlLeell 474862caaa pull from remote
Merge branch 'python' of https://github.com/skoch9/libigl into python
2019-07-15 11:11:08 -04:00
KarlLeell 7e115556af Fix euler_characteristic 2019-07-15 11:10:13 -04:00
Teseo Schneider 497308a3a8 fixed plainobjectbase for writers 2019-07-15 10:38:02 -04:00
teseoch cfc1123042 Merge pull request #2 from KarlLeell/python
Add all changed files
2019-07-11 12:35:34 -04:00
KarlLeell e6ecc66496 Add all changed files 2019-07-11 12:31:59 -04:00
BruegelN 0dfaf2a32c set dirty flags for specular and ambient too inside igl::opengl::ViewerData::set_colors(). 2019-07-09 19:19:54 +02:00
Rahul Sheth 84c886b482 Hunterize libigl, attempt 2 (#1242)
* Add HunterGate module

* HunterGate with URL/SHA1

* Hunterize
2019-07-05 17:26:58 -04:00
Jérémie Dumas ed98693ff8 Merge pull request #1247 from BruegelN/fix-is_irregular_vertex
Fix igl::is_irregular_vertex()
2019-07-05 13:55:21 -04:00
Nico Brügel 40db7208d0 use std::any_of to check result in is_irregular_vertex test. 2019-07-05 10:55:08 +02:00
Nico Brügel 7361a30ecb Merge branch 'dev' of https://github.com/libigl/libigl into fix-is_irregular_vertex 2019-07-04 08:31:41 +02:00
Jérémie Dumas 31c4eb24d2 Merge pull request #1244 from BruegelN/update-IGL_DEPRECATED-for-clang
update IGL_DEPRECATED to handle clang (e.g. on macOS) as well.
2019-06-28 15:46:15 -04:00
teseoch e9468f9f33 Merge branch 'dev' into python 2019-06-27 16:37:22 -04:00
Nico Brügel 87a50b8a39 update IGL_DEPRECATED to handle clang (e.g. on macOS) as well. 2019-06-27 08:59:38 +02:00
Jérémie Dumas 7c784ab905 Add conda environment file for boost (helpful for Windows users). (#1239)
* Add conda environment file for boost (helpful for Windows users).

* Try to update Travis image for macOS.
2019-06-26 17:48:38 -04:00
BruegelN 287ae99d3d fixed 'igl::is_irregular_vertex()' exception if CMAKE_BUILD_TYPE=Debug. 2019-06-25 23:48:34 +02:00
Jérémie Dumas b856635ba7 Try to update Travis image for macOS. 2019-06-25 23:44:01 +02:00
BruegelN 263b29b021 added thes for igl::is_irregular_vertex to showcase that it segfaults with CMAKE_BUILD_TYPE=Debug due to a missing F.maxCoeff()+1 in https://github.com/libigl/libigl/blob/master/include/igl/is_irregular_vertex.cpp#L16 2019-06-25 23:02:50 +02:00
Teseo Schneider d9e44e0907 reverted change on slice_into.cpp with DynamicSparseMatrix 2019-06-24 14:11:41 -04:00
X.ZhaoMa cdd8971d1d Add a function to set labels collectively, and clear function for points/lines. (#1196)
* fix issue for octree.

For translating centre, the distance should be the half of width of the sub cell instead of the width h.

* add collective label set method and point/edge clear function.
2019-06-23 18:24:00 -04:00
Jérémie Dumas 091cb4b33b Try to update Travis image for macOS. 2019-06-19 13:22:55 -04:00
Jérémie Dumas 4dd39445ce Merge branch 'dev' into fast-winding-number-soups 2019-06-19 11:18:43 -04:00
Jérémie Dumas 1f7605ea7c Merge pull request #1231 from dpshamonin/vs-2015-error-C2131
fix compiler (VS 2015 error C2131) issue #1226
2019-06-17 08:23:03 -04:00
Denis Shamonin 4228447e3c fix compiler (VS 2015 error C2131) issue #1226 2019-06-17 11:57:29 +02:00
Jérémie Dumas 119f3bdc41 Merge pull request #1210 from evouga/dialogfixes
file_dialog_open/save fixes
2019-06-16 14:29:42 -04:00
Teseo Schneider 53cf9756e0 Merge branch 'python' of github.com:skoch9/libigl into python 2019-06-15 16:40:07 -04:00
Teseo Schneider 03005f1909 Added error if python enabled 2019-06-15 16:39:54 -04:00
Jérémie Dumas bc2e4d6fb7 Add warnings about Python. 2019-06-15 14:28:40 -04:00
Teseo Schneider 6fa0a15996 added template 2019-06-14 19:11:26 -04:00
Teseo Schneider 57b7c285e4 merge conflics 2019-06-14 18:11:58 -04:00
Daniele Panozzo 188167c446 edited writeOFF 2019-06-14 17:59:00 -04:00
Teseo Schneider d6b3f4578a fixed ear 2019-06-14 17:59:00 -04:00
Teseo Schneider 57699054d3 fixed templates on bone parents 2019-06-14 17:59:00 -04:00
Teseo Schneider 5be49b74bc fixing templates 2019-06-14 17:59:00 -04:00
Teseo Schneider 0866fc9aaf fixed cmake 2019-06-14 17:58:02 -04:00
Teseo Schneider 76ce8b64fe harmonic templates for python 2019-06-14 17:58:02 -04:00
Teseo Schneider dd23189751 template instantiations 2019-06-14 17:57:00 -04:00
Teseo Schneider 83af08a071 bump eigen verion and sparse matrices fix 2019-06-14 17:55:33 -04:00
Francis Williams e94a8e98a1 uncomment tests 2019-06-14 17:53:03 -04:00
Teseo Schneider 4140c76dee stuff, test not passing 2019-06-14 17:52:28 -04:00
Teseo Schneider dfaeac6092 avg vertices 2019-06-14 17:21:57 -04:00
Teseo Schneider 67d202d6df fixed arap 2019-06-14 17:20:50 -04:00
Teseo Schneider 3d8635fcfb removed old python binding 2019-06-14 17:18:45 -04:00
Teseo Schneider 487b008147 template instantiations 2019-06-14 17:17:55 -04:00
Teseo Schneider 59c679f5f4 bump eigen verion and sparse matrices fix 2019-06-14 17:16:03 -04:00
Teseo Schneider 473c579420 template stuff 2019-06-14 17:14:41 -04:00
Teseo Schneider 60c783a736 fixed volume size 2019-06-14 17:14:41 -04:00
Teseo Schneider 6b72eff364 fixed matrix types 2019-06-14 17:14:41 -04:00
Francis Williams 559f3971ba uncomment tests 2019-06-14 17:13:48 -04:00
Francis Williams cf21681fa9 add template instantiations for unary op 2019-06-14 17:13:48 -04:00
Teseo Schneider 5ca256fb3a stuff, test not passing 2019-06-14 17:12:38 -04:00
Teseo Schneider d5f443d7d4 avg vertices 2019-06-14 17:09:52 -04:00
Teseo Schneider 1bea273f3c fixed arap 2019-06-14 17:09:52 -04:00
Jérémie Dumas 779af8fb48 Merge pull request #1227 from BruegelN/python_fix-viewer-core
Python: igl.glfw.Viewer().core => igl.glfw.Viewer().core() with default arg unsigned core_id = 0
2019-06-14 08:21:34 -04:00
Jérémie Dumas 8a448d4af4 Merge pull request #1185 from txstc55/master
Added more comments to 407 and 604
2019-06-13 10:55:21 -04:00
Jérémie Dumas 473edba1d7 Update file dialog check. 2019-06-13 09:29:34 -04:00
Jérémie Dumas 15b87c6e84 Merge pull request #1197 from BruegelN/fix-on-linux-path_to_executable
Fix on linux path_to_executable()
2019-06-13 09:12:23 -04:00
Jérémie Dumas d56ab01cfb Merge pull request #1220 from BruegelN/python_fix-viewer-data
Default arg for igl.glfw.Viewer().data() => mesh_id -1
2019-06-13 09:07:50 -04:00
Jérémie Dumas 790dd4d3eb Merge pull request #1224 from nTopology/dev/ig/warningimprovements
Dealing with MSVC warnings a little bit more elegantly
2019-06-13 09:07:23 -04:00
Nico Brügel 6787393cd1 replace 'viewer.core' with 'viewer.core()' in python tutorials. Use same API style like in C++ however other methods for multiple viewport support still do not have python bindings. 2019-06-13 14:58:05 +02:00
Nico Brügel 7162dbe428 expose igl.glfw.Viewer.core() the same way as in C++ and adding default argument. 2019-06-13 14:54:03 +02:00
Ignacio Fraga 3bb73fbdd7 Dealing with MSVC warnings a little bit more elegantly 2019-06-12 18:26:35 -04:00
BruegelN ea48d38056 Due to the changes in glfw::Viewer one should pass a parameter when calling data() to select a mesh. In C++ mesh_id=-1 by default ( the last element). This commit adds this behaviour for the python bindings. 2019-06-10 19:51:26 +02:00
Alec Jacobson f6b4064274 Merge pull request #1206 from libigl/dev
Version 2.1.0
2019-06-10 08:57:39 -04:00
Alec Jacobson c8e57b600a fix pi 2019-06-10 08:48:46 -04:00
Alec Jacobson 16b8ab326c Merge pull request #1205 from rodyo/dev
 Enable OpenMP for MSVC users (#1147)
2019-06-10 08:47:25 -04:00
Alec Jacobson c27e57e85e Merge pull request #1217 from libigl/sort-triangles
Fix templating in sort_triangles
2019-06-10 08:44:58 -04:00
Alec Jacobson 67e99976f1 Merge pull request #1216 from libigl/marching-cubes-redux
Bug fix and feature improvement for marching cubes
2019-06-10 08:43:51 -04:00
evouga 5b32edbddf Update file_dialog_save.cpp
Also handle the case that the second fgets() fails due to an error rather than reaching EOF
2019-06-08 15:07:49 -05:00
evouga 3be6b6c4b4 Update file_dialog_open.cpp
Also handle case that the second fgets() call fails rather than reads EOF.
2019-06-08 15:06:53 -05:00
Jérémie Dumas 241187bbe3 Merge pull request #1213 from lawsonfulton/origin/dev
Fixing missing symbol error for python
2019-06-08 14:18:55 -04:00
Alec Jacobson cfe80da6bc fwn for soups; clean up; templates; tutorial entry 2019-06-08 13:59:12 -04:00
Alec Jacobson 36eb913385 fix brackets 2019-06-07 18:29:52 -04:00
Alec Jacobson de74c292ee merge 2019-06-07 18:20:01 -04:00
Alec Jacobson da7a3eb70b fix templating 2019-06-07 18:14:03 -04:00
Alec Jacobson 33cea64ae8 Better doc 2019-06-07 18:13:08 -04:00
Alec Jacobson bbfc88926e rm lingering test code 2019-06-07 18:09:28 -04:00
Alec Jacobson 19bfe1a203 clean up and add root finding interface 2019-06-07 18:03:23 -04:00
Alec Jacobson 7e0e6a87e0 Update libigl.cmake
fix matlab options
2019-06-07 17:23:46 -04:00
Lawson Fulton ab6bfb7e9f Fixing missing symbol error for python 2019-06-07 13:19:11 -04:00
Etienne Vouga 9839ca1ffb Attempt to fix several issues with the libigl file dialogs, so that they
correctly return an empty string rather than garbage when:
 - the user cancels the dialog
 - the user selects a file somehow longer than the 1024-character limit
 - the file selection using zenity etc. fails for any other reason.
There is a strange erasure of the last character in the Linux version
(presumably to remove some trailing newline?) that I did not touch.
2019-06-03 14:49:17 -05:00
Rody Oldenhuis b407970ecd Changed size_tstd::ptrdiff_t for OpenMP2.0 compatibility 2019-05-31 14:00:28 +12:00
Nico Brügel 1408bd36b0 fix unit test for path_to_executable() on windows by taking into account that it has a '.exe' suffix. 2019-05-15 11:33:20 +02:00
BruegelN d32e71784e path_to_executable: only include unistd.h if not on windows. 2019-05-15 01:19:17 +02:00
BruegelN 49f4b7cfc8 Add unit test for path_to_executable() 2019-05-15 00:40:05 +02:00
Nico Brügel d7925be2e4 Added symboles to check for in path_to_executable() because capital case UNIX is not defined under Linux (i.e. Ubuntu).
Lowercase unix is defined however. See: https://stackoverflow.com/questions/142508/how-do-i-check-os-with-a-preprocessor-directive
Also added missing include for readlink().
readlink() does not append a null byte, thus use information about the written byted when building the resulting string.
2019-05-14 16:57:20 +02:00
Jérémie Dumas fac1d57ee5 Update main.cpp 2019-05-11 18:33:14 +02:00
Alec Jacobson e33f534ffd Merge pull request #1138 from libigl/jdumas-patch-1
Update issue_template.md
2019-05-08 11:33:11 -05:00
Jérémie Dumas 10e04cbef5 Update GLFW to 3.3 (#1153)
* Update GLFW and Embree + use git urls (fixes #1019).

* Simplify Embree build.

* More robust top-level project detection.
2019-05-07 07:48:25 -04:00
Xuan Tang b5f7891c7e added more comments to 407 and 604 2019-05-05 13:40:45 -04:00
Jérémie Dumas aea868bd1f Merge pull request #1172 from jdumas/tmp/viewer-fixes
Viewer const accessors + use viewport size (fixes #1166, fixes #1167).
2019-05-03 14:56:10 -04:00
hanxiao 1a472aaccf use Eigen::Dynamic 2019-04-28 16:55:32 -04:00
hanxiao 0855c2ef8c Merge branch 'dev' of https://github.com/libigl/libigl into pr 2019-04-28 16:43:36 -04:00
hanxiao d7aaf39710 add missing newline char 2019-04-28 15:31:25 -04:00
hanxiao ce07eb79f4 use correct deducd types and rename function 2019-04-28 15:26:44 -04:00
Jérémie Dumas 8d89982555 Update issue_template.md 2019-04-28 13:02:29 -04:00
Lawson Fulton 450935874f Extending igl::cat to work with std::vectors AND Allowing N-gons in writeOBJ (#1108)
* templates

* Extending igl::cat to work with a std::vector of matrices

* Small fix

* Fixing std::vector version of adjacency_list

* Change MatrixBase -> PlainObjectBase to fix compile error in boundary_loop

* Fixing function definition for adjacency_list

* Added test for cat

* Extending writeOBJ to work with mixed tri/quad meshes

* Code review feedback

* Writing lines instead of faces

* Adding template for test compile

* Fixing brace style and switching to trigraph

* Fixing braces

* another brace

* PlainObjectBase -> MatrixBase

* Sneaking in a few more template instantiations

* PlainObjectBase for outputs

* adding template to fix appveyor windows link error
2019-04-27 09:03:47 -04:00
X.ZhaoMa fbcb933c5b fix issue for octree. (#1171)
For translating centre, the distance should be the half of width of the sub cell instead of the width h.
2019-04-27 09:01:25 -04:00
Qingnan Zhou e38ee99766 Fix https://github.com/libigl/libigl/issues/1168 (#1173)
* Replicate linking error described in https://github.com/libigl/libigl/issues/1168

* Fix https://github.com/libigl/libigl/issues/1168.

* Ensure header-only mode works.

* Disambiguate exactinit call in unit test.
2019-04-22 22:24:03 -04:00
hanxiao c4813053b2 update stype and add doc 2019-04-21 11:15:34 -04:00
Jérémie Dumas b15bafaed2 Viewer const accessors + use viewport size (fixes #1166, fixes #1167). 2019-04-21 09:50:47 -04:00
hank 56bbda7827 ear clipping triangulation and robust 2d segment intersection detect 2019-04-20 18:09:11 -04:00
Alec Jacobson bc657bc94b Merge pull request #1163 from PyMesh/dev
Shewchuk's predicates support
2019-04-20 15:34:22 -04:00
Robert Gützkow 7677e66587 Fixed two memory leaks (#1120)
* Fixed two memory leaks

One pointer to allocated memory wasn't freed and realloc didn't have proper error handling. Additionally UB has been identified, because a pointer to a local variable is returned.

* Memory leak removed, cause be setting reference to NULL instead of deleting the object
2019-04-20 14:27:08 -04:00
Jérémie Dumas be2e69a35c Merge pull request #1140 from amrollah/heat_geodesics_python
exposed heat_geodesics in python binding
2019-04-20 14:23:24 -04:00
Kazutaka Nakashima 05666a7e72 Bugfix in remesh_along_isoline.h (#1164)
* fix typo

* fix typo for solving compile error
2019-04-20 09:42:53 -04:00
Qingnan Zhou a7cf3ddc1f Address Hanxiao's comment. 2019-04-19 14:45:17 -04:00
Jérémie Dumas 749b9c1c27 Update predicates.cpp 2019-04-19 14:28:34 -04:00
Jérémie Dumas cefb0fa35f Update static check macro + fit style. 2019-04-19 14:21:39 -04:00
Jérémie Dumas 4959bc5f22 Update predicates.cpp 2019-04-19 14:05:37 -04:00
Qingnan Zhou 6ad790f846 Update predicates and avoid heap allocations. 2019-04-19 13:10:31 -04:00
Qingnan Zhou 832fdc2abb Add doc. 2019-04-18 23:24:20 -04:00
Qingnan Zhou 01a18ac2ed Add unit tests for predicates. 2019-04-18 23:09:18 -04:00
Qingnan Zhou ccfe8b6843 Add support for Shewchuk's predicates. 2019-04-18 22:11:07 -04:00
Jérémie Dumas 86a4a8cb31 Merge pull request #1159 from MeshGeometry/marching_cubes_bug
Fixing bug preventing compilation of sparse marching cubes
2019-04-18 10:51:40 -04:00
Lawson Fulton e2d80105ed Fixing bug preventing compilation in marching cubes 2019-04-17 12:33:42 -04:00
Jérémie Dumas 21b9ce5eff Update issue_template.md 2019-04-15 10:27:09 -04:00
Alec Jacobson 43e043e0b6 fix *bug* when isovalue != 0 2019-04-11 23:01:19 -04:00
Alec Jacobson 72bad999b0 factor out duplicate code 2019-04-11 21:47:05 -04:00
Robert Gützkow c9d0b35b6a Memory leak fixes (#1125)
* Memory leak caused by setting reference NULL instead of deallocating

* Memory leak fix for #1122

* Memory leak fix for #1124

* Memory leak fix for #1123

Instead of deleting, using a unique pointer like the other function that allocates Wraw.

* Memory leak fix for #1121

* Function call fixed

* Use get() Wraw's unique pointer to access pointer for fread()

* Removed unnecessary allocations

* Revert change to boolean array, size is only known at runtime

* Removed callocs for bool arrays, use vector instead

* Init vector with constructor to set default value
2019-04-05 18:31:02 -04:00
amri 60c375f84e exposed heat_geodesics in python binding 2019-04-05 14:19:16 +02:00
Jérémie Dumas 2e04483a46 Merge pull request #1139 from BruegelN/dev
[travis-ci] added build configs to ensure both, static as well as hea…
2019-04-04 21:27:26 -04:00
Alec Jacobson a1fc8f0cb4 Merge pull request #1134 from libigl/fix-include
Fix include
2019-04-04 10:12:03 -04:00
Nico Brügel 1ab05f99e9 [travis-ci] added build configs to ensure both, static as well as header-only mode is build for gcc-7 (ubunutu) and clang(osx). 2019-04-04 15:05:11 +02:00
Jérémie Dumas 1d02b140d2 Update issue_template.md 2019-04-03 18:02:01 -04:00
Jérémie Dumas 3b84f100b5 Update issue_template.md 2019-04-03 17:26:40 -04:00
Jérémie Dumas 2842637d4c Fix #1133. 2019-03-29 18:48:36 -04:00
Alec Jacobson 9230cc8b83 Merge pull request #1132 from libigl/viewer-label-colors
expose label color
2019-03-28 23:35:17 -04:00
Alec Jacobson 9478106d6a fix core issue 2019-03-28 22:03:06 -04:00
Alec Jacobson 289148c069 merge 2019-03-28 20:30:48 -04:00
Alec Jacobson deac455ab9 Merge pull request #1131 from libigl/templates-and-overloads
Templates and overloads
2019-03-28 17:55:58 -04:00
Alec Jacobson c1d4e3a728 fix matlab templates for Eigen 3.3 2019-03-28 11:53:50 -04:00
Alec Jacobson 42cbff3c64 expose label color 2019-03-28 10:40:53 -04:00
Alec Jacobson 16ce83c381 rename test 2019-03-28 10:38:25 -04:00
Alec Jacobson e3cfbc1541 templates, overloads, rm extra includes, etc. 2019-03-28 10:29:25 -04:00
Jérémie Dumas daf7d0707c Merge pull request #978 from jdumas/multiple-views
Multiple viewports
2019-03-22 15:54:33 -04:00
Francis Williams 146a37b892 Merge pull request #1094 from libigl/jdumas-patch-1
Prevent Travis from failing due to #1086
2019-03-20 13:46:13 -04:00
Alec Jacobson 5a51832959 better doc 2019-03-20 12:47:16 -04:00
Jérémie Dumas 4c611d88f9 Merge branch 'dev' into jdumas-patch-1 2019-03-19 18:37:44 -04:00
Francis Williams bb2d2188ef Merge pull request #1039 from jdumas/imgui
Updates ImGui dependency to 1.69
2019-03-19 18:35:01 -04:00
Francis Williams 5e2d8ddebe Merge pull request #1096 from jdumas/fix-randperm
Fix logic error for URNG in igl::randperm
2019-03-19 18:34:05 -04:00
Francis Williams 8641870916 Merge pull request #1110 from libigl/jdumas-patch-2
Enable Eigen 3.3 in Travis for macOS
2019-03-19 18:32:46 -04:00
Jérémie Dumas 412f8c5def Update LibiglDownloadExternal.cmake 2019-03-18 21:48:24 -04:00
Jérémie Dumas 3c79ad18e7 Merge pull request #1112 from ThomasAuzinger/dev
Corrected omission of return argument.
2019-03-18 09:15:04 -04:00
Thomas AUZINGER 07d68473d9 Corrected omission of return argument. 2019-03-18 11:58:30 +01:00
Jérémie Dumas 8b794aa9a6 Update .travis.yml 2019-03-15 10:51:56 -04:00
Jérémie Dumas c7c06e3735 Merge pull request #1107 from ThomasAuzinger/dev
Ensured use of internally defined constants.
2019-03-06 22:12:40 -05:00
Jérémie Dumas f530a2a645 Merge pull request #1106 from NSchertler/master
[knn] Fixed comparison functor in priority queue
2019-03-06 08:53:57 -05:00
Thomas AUZINGER c85ee4ef79 Ensured use of internally defined constants. 2019-03-06 14:33:17 +01:00
Nico Schertler 9621a87edd comparison functor of priority queue is required to represent a strict ordering 2019-03-05 15:49:17 -08:00
Jérémie Dumas eafa7266d4 Merge pull request #1105 from jdumas/fix-labels
Fix label rendering in tutorial 105
2019-03-04 10:25:34 -05:00
Jérémie Dumas a5590c6389 Render text labels in tutorial 105 (fixes #1104 and #1089). 2019-03-04 08:49:51 -05:00
Stefan Reinhold 7a1e0435a8 Fix: Wrong Eigen3 dependency when using find_package(libigl) #1100 (#1101)
* Fix #1100

When the target Eigen3::Eigen is not present but could be found using
find_package() igl::core and igl::common link against the wrong TARGET
PkgConfig::Eigen3. Fixed this and also did some code cleanup.

* Drop support for PkgConfig

* Simplify configuration code

- Removed redundant call to find_package
- Removed LIBIGL_Eigen3_Target variable
- Echo status message
2019-03-01 10:28:47 -05:00
Stefan Reinhold c65e487996 Fix igl common cmake config (#1097)
* Set libigl_common_FOUND if arget is OK

In libigl-config.cmake.in only libigl_core_FOUND was set, resulting in
an error if the user requested the igl::common feature, see #1077

* Replace target_link_libraries with set_target_properties

Otherwise cmake complains that the targets igl::core and igl::common are
not built by the current project.

* Also install .c files
2019-02-27 13:42:40 -05:00
Jérémie Dumas 843438eab9 Fix logic error for URNG in igl::randperm 2019-02-26 19:37:42 -05:00
Jérémie Dumas 4052eef33c Merge pull request #1093 from ShuangLiu1992/dev
Explicit template instantiation of std::vector<std::vector<int>> for boundary_loop
2019-02-25 14:25:53 -05:00
Jérémie Dumas c6a0e1cda5 Update Travis file. 2019-02-25 13:36:50 -05:00
Jérémie Dumas cde3014e2c Prevent Travis from failing due to #1086
This is not a very satisfactory fix, but it should allow other PRs to stop failing due to this (rare) data race.
2019-02-25 12:21:59 -05:00
ShuangLiu b2938a41d9 change PlainObjectBase to MatrixBase to fix compile error 2019-02-25 17:01:15 +00:00
ShuangLiu 96bdfb64ba Explicit template instantiation of std::vector<std::vector<int>> for boundary_loop 2019-02-25 16:12:32 +00:00
Alec Jacobson 77eb3f88fd Merge pull request #1067 from libigl/boundary-faces-extend
Extend boundary_facets with outputs revealing which element facet comes from
2019-02-24 13:41:51 -04:00
Alec Jacobson 01729b533d Update reorder.cpp
missing windows template?
2019-02-24 12:24:56 -04:00
Jérémie Dumas 52d6df75c8 Merge pull request #984 from evouga/patch-1
Update cut_to_disk.cpp
2019-02-23 17:46:42 -05:00
Jérémie Dumas 4575cbd670 Merge pull request #1062 from ycjungSubhuman/master
Use std::shuffle instead of std::random_shuffle in igl/randperm
2019-02-23 15:55:45 -05:00
Jérémie Dumas 8b8a3f7def Merge branch 'dev' into patch-1 2019-02-23 14:55:03 -05:00
Jérémie Dumas 6992440c83 Might as well update ImGui to 1.68 2019-02-23 01:14:51 -05:00
Jérémie Dumas a022f3fcb8 Merge pull request #1072 from w-m/dev
Bump stb_image version
2019-02-22 16:53:20 -05:00
Jérémie Dumas 7404dc98fa Update comments. 2019-02-19 09:24:41 -05:00
Jérémie Dumas 5065640657 Turn mesh visualization option into viewport bitmasks. 2019-02-19 08:53:14 -05:00
Jérémie Dumas 63b5effada Fix indexing issue when erasing a viewport. 2019-02-18 19:49:30 -05:00
Jérémie Dumas ae5af1be35 Merge pull request #1088 from breannansmith/undef_fix_flip_avoiding_line_search
Fixed undefined behavior in the SolveP3 function of flip_avoiding_lin…
2019-02-18 17:06:38 -05:00
Breannan Smith 3a72136c4d Fixed undefined behavior in the SolveP3 function of flip_avoiding_line_search. 2019-02-18 15:03:40 -05:00
Kacper Pluta b1058a4eb7 Code clean-ups of nrosy() (#1027)
* code clean ups

* remove useless includes

* remove prints

* the last changes

* avoid using full namespaces and avoid some loops

* make acos call nan resistant

* throw an exception when zero norm vector calculations happened

* overlooked lines

* make sure to use CPP versions

* remove unneeded variable

* overlooked lines

* revert

* comments from J

* overlooked lines

* avoid variable overwriting and set size when declaring.

* This should be aliasing free.

* It seems like some of the variables were not necessary
2019-02-12 15:13:00 -05:00
Kacper Pluta 48ac6aa0b5 Some further cleanups for MIQ (#998)
* Cleanups: unified arguments' names, variable types, unused variables removed, initialization of fileds. Many Clang-tidy hints have been applied, etc.

* ints should be unsigned

* changes overlooked duing refactorization

* changes overlooked duing refactorization

* changes overlooked duing refactorization

* changes overlooked duing refactorization

* changes overlooked duing refactorization and suggestions from @jdumas

* remove unneeded var.

* indents

* extract a constant

* a name changed
2019-02-12 11:45:50 -05:00
Jérémie Dumas 6b1870aea4 Merge pull request #1085 from djkeyes/fix-template-type-min_quad_with_fixed
fix min_quad_with_fixed to work for non-double template types
2019-02-12 11:26:29 -05:00
Daniel Keyes e7d4ec2599 fix min_quad_with_fixed to work for non-double template types 2019-02-11 20:23:27 -08:00
Wieland Morgenstern f102334b7a Bump stb_image version 2019-01-15 22:27:06 +01:00
Jérémie Dumas 0294540603 Merge pull request #1073 from jdumas/travis
Fix Travis build + minor CMake improvements.
2019-01-15 16:00:49 -05:00
Jérémie Dumas ad43734d8d Switch gcc build to Release on Travis. 2019-01-10 15:37:01 -05:00
Jérémie Dumas b62b908d1d Fix paths. 2019-01-10 14:51:37 -05:00
Jérémie Dumas 0920459a45 Fix Travis build + minor CMake improvements.
* Add option to skip cmake external download (#1068);
* Add option 'TLS_VERIFY OFF' directly in libigl's CMake script instead
  of 'DownloadProject.CMakeLists.cmake.in' (#1021).
2019-01-10 14:17:46 -05:00
Alec Jacobson 7895811be4 Merge pull request #1066 from libigl/fix-cotmatrix-test
Fix cot matrix unit test to avoid Eigen bug (only outstanding CGAL test is failing)
2018-12-28 15:04:21 -06:00
Alec Jacobson 1deb471727 extra boundary_facets outputs; better sort prototypes; templates; cleanup 2018-12-28 14:16:20 -06:00
Alec Jacobson 67257e8ed0 fix test 2018-12-28 14:12:20 -06:00
Alec Jacobson a87d62a78f Merge pull request #1064 from libigl/dev-fix-cgal
Dev fix cgal
2018-12-28 10:19:09 -06:00
Jérémie Dumas a5cd601cb5 Fix default cmake variables. 2018-12-28 15:19:11 +01:00
Jérémie Dumas 607148cf72 Misc compilation fixes for Eigen 3.3 compatibility. 2018-12-28 15:02:21 +01:00
Jérémie Dumas b9d547b2bd Try different switches. 2018-12-28 13:51:38 +01:00
Jérémie Dumas e8d0ffa43f Maybe AppVeyor was not building in parallel? 2018-12-28 13:40:39 +01:00
Jérémie Dumas 44fc595bcb Run python tutorial in Travis. 2018-12-28 10:14:20 +01:00
Jérémie Dumas 28d72d3b81 Use dynamic version of Boost with Python bindings. 2018-12-28 09:49:59 +01:00
Jérémie Dumas 5ceedbff82 Do not disable python bindings on Travis. 2018-12-28 01:48:53 +01:00
Jérémie Dumas 917158c851 Stop trying to be smart. 2018-12-28 01:40:04 +01:00
Jérémie Dumas 652b4db6d3 Make Travis happy. 2018-12-28 01:35:12 +01:00
Jérémie Dumas 2eef4a9b30 Fix compilation issues. 2018-12-28 01:28:11 +01:00
ycjungSubhuman 429745301a Remove unnecesary comment in randperm 2018-12-27 20:44:36 +08:00
ycjungSubhuman 217b838df2 Make randperm take URBG using func overloading 2018-12-27 20:34:58 +08:00
Alec Jacobson f186bed09c update tests 2018-12-26 18:37:34 -06:00
Alec Jacobson 9f663dfdce rm __1:: 2018-12-26 15:59:03 -05:00
Alec Jacobson 72b6464f7e compiles on mac 2018-12-26 14:54:46 -06:00
Alec Jacobson 0751e904b0 Merge branch 'dev' into boundary-faces-extend 2018-12-26 14:38:56 -06:00
Alec Jacobson f140e63649 Merge pull request #1057 from libigl/PR_fix_mesh_to_polyhedron
Bug fix: mesh_to_polyhedron compiles
2018-12-26 15:13:59 -05:00
Alec Jacobson 418d48ead3 boundary facets test 2018-12-26 13:53:47 -06:00
Jérémie Dumas cec2f07c0b Merge branch 'dev' into PR_fix_mesh_to_polyhedron 2018-12-26 00:48:38 +01:00
Alec Jacobson 48c7fa98c1 Merge branch 'jdumas-fix-cgal' into dev 2018-12-24 17:42:26 -06:00
Jérémie Dumas 70be34da08 Merge pull request #1056 from libigl/styleFix
Tabs --> spaces
2018-12-25 00:21:25 +01:00
Alec Jacobson b5875d5ea1 accumarray implementation 2018-12-24 17:20:08 -06:00
Alec Jacobson 85b93826a2 merge 2018-12-24 16:41:35 -06:00
Alec Jacobson 0b1f0b2009 mesh_to_polyhedron compiles (but not tested since CGAL tests are broken) 2018-12-24 16:35:56 -06:00
Alec Jacobson bce6685db0 formatting 2018-12-24 16:03:40 -06:00
Jérémie Dumas 8df183bc46 Merge pull request #1053 from metorm/typo_in_remesh_along_isoline.h
Fix the typo in a `#include` statement.
2018-12-23 14:49:17 +01:00
Wesley Ranger d5778fea4b Fix the typo in a #include statement.
"remesh_along_isoline.cpp" instead of "remesh_along_isoline.h" shall be included.
2018-12-23 19:20:25 +08:00
Jérémie Dumas d621a19859 Merge pull request #1051 from metorm/mesh_to_polyhedron_for_float
Building a CGAL polyhedron via a float-type Eigen matrix.
2018-12-22 06:05:22 -05:00
Wesley Ranger e8d993dd73 Templatize parameter F of function mesh_to_polyhedron.
As suggested by @jdumas.
2018-12-22 10:07:09 +08:00
Wesley Ranger 7c66185d74 Building a CGAL polyhedron via a float-type Eigen matrix.
The origin version only accepts Eigen::MatrixXd as vertices.
2018-12-21 14:15:45 +08:00
Alec Jacobson 3934ce09d8 LibIGL --> libigl 2018-12-17 18:16:10 -05:00
Alec Jacobson e699d257fe Update hausdorff.h
comment about unreferenced vertices.
2018-12-10 08:52:10 -05:00
Qingnan Zhou 626aeba4bd Add cut to disk unittest (#1007)
* Add failing unit test for https://github.com/libigl/libigl/pull/984.

* Update test data repo.

* Remove check on number of cuts since boundary may also be reported as cut.

* Update unittest tag.

* Update LibiglDownloadExternal.cmake
2018-12-08 16:29:49 +09:00
Jérémie Dumas 987321eb1b Update imgui dependency. 2018-12-04 17:52:27 +09:00
Francis Williams 86f5f170b3 Merge pull request #1036 from copyme/commentsSortTraingles
Remove commented code from sort_triangles
2018-12-03 12:43:02 -05:00
Jérémie Dumas 8eac86c163 Make teseo happy. 2018-12-01 09:49:11 -05:00
Julian Panetta 3c9cf28948 HighDPI fix for viewer interaction 2018-11-30 00:11:02 +01:00
Kacper Pluta 22b271aefc remove commented code 2018-11-29 22:15:02 +02:00
Kacper Pluta 0295a6523f Merge branch 'dev' of https://github.com/libigl/libigl into commentsSortTraingles 2018-11-29 22:13:35 +02:00
Alec Jacobson 20d69977b1 Merge pull request #1035 from libigl/revert-997-master
Revert "cylinder with caps"
2018-11-29 09:17:19 -05:00
Alec Jacobson 2a2e5b74d5 Revert "cylinder with caps" 2018-11-29 09:17:00 -05:00
Francis Williams b47c6b5472 Merge pull request #997 from wucm1994/master
cylinder with caps
2018-11-29 15:15:17 +01:00
Francis Williams 485662856a Merge pull request #999 from twodee/flattencaps
Flatten wiremesh caps when vertex on single edge.
2018-11-29 15:13:33 +01:00
Chris Johnson a6e97d4df6 Explicitly zero-fill incidence vector. 2018-11-29 11:40:21 +10:00
Chris Johnson 1a67e24a41 Remove unnecessary std::vector initialization. 2018-11-29 10:41:58 +10:00
Julian Panetta ac0f60903e Fix trackball rotation with multiple viewports 2018-11-28 22:12:10 +01:00
Jérémie Dumas 1d12983ce2 Merge branch 'dev' into multiple-views 2018-11-28 14:05:38 -05:00
Julian Panetta 724eda9174 Support viewports with different background colors. 2018-11-28 19:21:12 +01:00
Jérémie Dumas e8305e944d Remove LIM tutorial. 2018-11-28 13:03:36 -05:00
Julian Panetta 90cad1cfda Fix buggy mouse interaction with multiple views. 2018-11-28 18:12:55 +01:00
Alec Jacobson 608fc010a5 Merge pull request #993 from libigl/jdumas-patch-1
Warning about rewritten history (fix #992).
2018-11-28 09:46:15 -05:00
Francis Williams b87a8b2743 Merge pull request #1008 from jdumas/fix-python
Fix build python bindings
2018-11-28 15:27:36 +01:00
Chenming Wu bde427319f with 2018-11-28 22:19:49 +08:00
Chenming Wu b2e4c75f9a header define 2018-11-28 22:19:24 +08:00
Chenming Wu 15c84780f4 header 2018-11-28 22:17:00 +08:00
Chenming Wu 0caefd9dc8 up_caps 2018-11-28 22:14:59 +08:00
Jérémie Dumas b7d36697df python3 -> python 2018-11-28 08:29:23 -05:00
Francis Williams fe382012fd Merge pull request #1014 from jdumas/fix-lim
Remove LIM tutorial
2018-11-28 13:54:14 +01:00
Alec Jacobson 6571c463e3 Merge pull request #1029 from libigl/alecjacobson-patch-1
Eigen Alignment issue
2018-11-26 23:05:11 -05:00
Jérémie Dumas 8a3c960eb9 Disable alignment explicitly. 2018-11-26 18:55:15 -05:00
Yucheol Jung 0b6f488f28 Make igl/randperm to receive UniformRandomBitGenerator as argument
The reason behind this change is UniformRandomBitGenerator that
std::shuffle takes require max() and min() to be accessible
in compile-time. Therefore, template specializations for igl::randperm
will require max() and min() values as template variables, which is not
desirable. Instead, we declare template specializations for
pre-defined UniformRandomBitGenerator specified in c++11 standard.
2018-11-24 18:48:54 +09:00
Yucheol Jung e686604f4f Make igl/randperm accept random number generator as argument 2018-11-24 17:32:50 +09:00
Alec Jacobson 32910f260e Eigen Alignment issue
https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
2018-11-23 15:09:05 -05:00
Francis Williams a5a501f3a7 Merge pull request #1028 from MeshGeometry/master
Fixing const correctness and imports for dihedral_angles (plus template instantiations)
2018-11-23 06:25:26 +01:00
zero-impact 173e77d755 template instantiations and const fix 2018-11-22 14:50:19 -05:00
Yucheol Jung 7a56aaf0cc Fix typo 2018-11-21 11:00:40 +08:00
Yucheol Jung b1c29bcef5 Use std::shuffle instead of std::random_shuffle 2018-11-21 10:38:52 +08:00
Alec Jacobson d0ccc52e51 Merge pull request #1023 from libigl/alecjacobson-patch-1
Update DownloadProject.CMakeLists.cmake.in
2018-11-19 20:53:59 -05:00
Alec Jacobson db6c89aa0a Merge pull request #1022 from libigl/alecjacobson-patch-1
Update DownloadProject.CMakeLists.cmake.in
2018-11-19 20:52:53 -05:00
Alec Jacobson 46c76ee772 Update DownloadProject.CMakeLists.cmake.in
Fix https://github.com/libigl/libigl/issues/1021#issuecomment-440078712
2018-11-19 18:26:29 -05:00
Oded Stein fb63fbcdc7 PlainObjectBase -> MatrixBase (#1016)
* PlainObjectBase -> MatrixBase

Replacing PlainObjectBase with MatrixBase for const arguments in a few functions
2018-11-16 08:15:21 +01:00
Jérémie Dumas 9e5a72582e Remove LIM tutorial (fixes #1012). 2018-11-13 23:25:25 +01:00
Jérémie Dumas fc63f61f97 Stb. 2018-11-13 12:04:40 +01:00
Jérémie Dumas 853240d83c Glad. 2018-11-13 11:24:18 +01:00
Jérémie Dumas c4a31599a5 Update tetgen+triangle CMake. 2018-11-13 10:31:50 +01:00
Jérémie Dumas 47143c1f30 Update CoMiSo dependency. 2018-11-13 09:46:49 +01:00
Jérémie Dumas 7d2a958ab3 Fix -fPIC issue. 2018-11-13 00:08:47 +01:00
Jérémie Dumas b0c518a05f Fix build for current python bindings. 2018-11-12 22:56:45 +01:00
teseoch 1225b8d5a9 Merge pull request #994 from xarthurx/dev
fix segments_intersection bug.
2018-11-12 14:47:34 -05:00
Alec Jacobson 230df4d30b Merge branch 'dev' of https://github.com/libigl/libigl into dev 2018-11-11 22:30:41 -05:00
Alec Jacobson f4eff4ea57 PlainObjectBase -> MatrixBase 2018-11-11 22:30:31 -05:00
x.ZM 116d2bc1de fix tab. 2018-11-10 15:01:27 +01:00
x.ZM de180a073f fix: move return value downwards + change tabs to 2-space. 2018-11-10 14:48:57 +01:00
Chris Johnson 4190af313e Flatten wiremesh caps when vertex on single edge. 2018-11-07 13:00:50 +10:00
Teseo Schneider 70ec447489 fixed return value bug 2018-11-06 19:10:03 -05:00
Jérémie Dumas 1dce7f09b6 Merge pull request #977 from jdumas/glfw
Bump version of glfw.
2018-11-06 18:52:14 -05:00
Jérémie Dumas a3f240620a Fix cgal dll problem. 2018-11-05 21:37:11 -05:00
Jérémie Dumas 985ad5d623 Stupid script. 2018-11-05 20:02:24 -05:00
Jérémie Dumas 6952f3f158 Trying again... 2018-11-05 19:58:10 -05:00
Jérémie Dumas 866a073a84 Try to set path to python executable directly. 2018-11-05 19:42:39 -05:00
Jérémie Dumas 0eb685643b Hint Python 3.7 path on AppVeyor. 2018-11-05 19:28:00 -05:00
Jérémie Dumas d696b54ba9 Set minimum python version. 2018-11-05 19:09:17 -05:00
Jérémie Dumas a5da5ca3dc Reenable python bindings on Windows. 2018-11-05 18:44:59 -05:00
Jérémie Dumas b7db5a8ee0 Stupid template should compile now. 2018-11-05 18:04:07 -05:00
Jérémie Dumas 1917b63220 Rince and repeat. 2018-11-05 09:51:23 -05:00
Jérémie Dumas 9b9da70b8e Rince and repeat. 2018-11-05 08:59:03 -05:00
Jérémie Dumas d568485242 Rince and repeat. 2018-11-05 08:15:31 -05:00
Jérémie Dumas a1395f916a Update LibiglDownloadExternal.cmake 2018-11-05 00:50:54 -05:00
Jérémie Dumas 928045da6f Missing template instantiations. 2018-11-05 00:46:33 -05:00
Jérémie Dumas 8bebcf827e Grrr. 2018-11-04 21:49:09 -05:00
Jérémie Dumas 470f03dc41 Stupid tests. 2018-11-04 18:36:29 -05:00
Jérémie Dumas ac8b269300 More test fixing. 2018-11-04 18:02:18 -05:00
Jérémie Dumas 3dd8e3e0e6 Fix boolean test. 2018-11-04 17:18:23 -05:00
Jérémie Dumas 67edc94c8a Fix CGAL tests + try Travis without python. 2018-11-04 14:41:49 -05:00
Jérémie Dumas b580234968 Try to make Travis/AppVeyor happy. 2018-11-04 13:38:20 -05:00
Jérémie Dumas 80b95c0aad Enable CGAL on Travis + AppVeyor. 2018-11-04 11:03:33 -05:00
ikoruk b7124f179f add unit tests for embree (#952)
* add unit tests for embree

* discovered bug with intersect beam and wrote unit test for the fix

* Update EmbreeIntersector.cpp

updated test to catch2

* Update CMakeLists.txt

removed tab to rerun CI

* Update CMakeLists.txt

* Update CMakeLists.txt

* caching value of BUILD_TESTING before resetting it

* Try to build embree statically on Windows.

* Try to enable testing early on.

* Update Catch2 version.

* Set CMake build type.

* Trying to build embree statically.

* Fix static compilation of embree on Windows.

* Cleanup.
2018-11-04 11:00:35 -05:00
x.ZM 33510d9f1b fix: segments intersection bug.
Unit test also added.
2018-11-03 16:44:22 +01:00
X.ZhaoMa 1ca0e9bb3d Merge pull request #1 from libigl/dev
Dev
2018-11-03 14:13:30 +01:00
Jérémie Dumas fc7ecbb046 Warning about rewritten history (fix #992). 2018-11-02 11:38:07 -04:00
Francis Williams 7cd05d594c Merge pull request #947 from rayform/embree3
update for embree 3
2018-10-30 15:40:57 -04:00
Jérémie Dumas 475ddcd2e8 Merge pull request #990 from rayform/fixCotmatrixIntrinsic
fix wrong reference in cotmatrix_intrinsic
2018-10-30 08:28:31 -04:00
Yuliy Schwartzburg 78a33cf870 fix wrong reference in cotmatrix_intrinsic 2018-10-30 10:50:44 +01:00
Alec Jacobson 7f7551af16 Merge pull request #961 from teseoch/catch2
Changed from google test to catch
2018-10-29 17:45:10 -04:00
Teseo Schneider 1c3c7c7b6f ported new tests to catch2 2018-10-29 16:39:58 -04:00
teseoch 8338d9e6ee Merge pull request #960 from teseoch/unit-test-windows
enabled testing on windows
2018-10-29 16:07:34 -04:00
teseoch 6f41773f47 Merge branch 'dev' into catch2 2018-10-29 15:59:34 -04:00
teseoch 64803e08c5 Update .appveyor.yml
disabled COMISO build. run fails because of missing boost dll
2018-10-29 10:17:36 -04:00
Alec Jacobson 80a8e2df21 Merge pull request #988 from libigl/dev-intrinsic-delaunay
Heat Geodesics and Intrinsic Delaunay Triangulation
2018-10-29 09:26:28 -04:00
Alec Jacobson 83553eb3bb windows template 2018-10-29 08:37:25 -04:00
Alec Jacobson c6e6f809da missing include 2018-10-28 22:27:03 -04:00
Alec Jacobson 788f0bc2f2 Merge branch 'dev-intrinsic-delaunay' of https://github.com/libigl/libigl into dev-intrinsic-delaunay 2018-10-28 22:11:32 -04:00
Alec Jacobson 1c6e530501 remove overzealous asserts 2018-10-28 22:11:18 -04:00
Alec Jacobson ce2eaf8fc9 don't consider i==j 2018-10-28 22:08:03 -04:00
Alec Jacobson 3593e5ca8b fix reverse sort order on linux 2018-10-28 21:56:24 -04:00
Alec Jacobson 894a51f132 sorts may differ 2018-10-28 21:48:22 -04:00
Alec Jacobson ab730005e9 template nonsense 2018-10-28 21:28:42 -04:00
Alec Jacobson e032f31a92 using intrinsic div/grad 2018-10-28 21:09:25 -04:00
Alec Jacobson 7e976f3666 templates 2018-10-28 21:09:03 -04:00
Jérémie Dumas 5864468596 Fix typo. 2018-10-28 20:50:40 -04:00
Alec Jacobson 44f93fa0d9 intrinsic gradient operator + test 2018-10-28 19:58:38 -04:00
Alec Jacobson 3c9ca8a0c1 clean up grad + templates 2018-10-28 19:58:21 -04:00
Alec Jacobson b5a0619ae2 clean up grad and add test 2018-10-28 19:30:16 -04:00
Alec Jacobson e5c78841a8 grad test 2018-10-28 19:11:09 -04:00
Jérémie Dumas b94304fd75 Try re-enabling CoMiSo on AppVeyor. 2018-10-28 19:01:06 -04:00
Alec Jacobson 49535abdad formatting 2018-10-28 18:33:02 -04:00
Alec Jacobson 2c31834bab missing template 2018-10-28 18:29:45 -04:00
Jérémie Dumas a103eb67fe Move CMake Windows code to a separate file. 2018-10-28 17:43:50 -04:00
Alec Jacobson 840e762291 Merge pull request #956 from libigl/dev-delaunay-tests-attempt-2
delaunay unit tests, expose is_delaunay, templates, PlainObject -> Matrix
2018-10-28 17:30:44 -04:00
Alec Jacobson 552da1fae0 Merge branch 'dev-delaunay-tests-attempt-2' of https://github.com/libigl/libigl into dev-intrinsic-delaunay 2018-10-28 16:00:39 -04:00
Alec Jacobson 9036259dc3 fix broken template 2018-10-28 15:55:14 -04:00
Alec Jacobson fbd4eb8457 Merge branch 'dev-delaunay-tests-attempt-2' of https://github.com/libigl/libigl into dev-intrinsic-delaunay 2018-10-28 15:47:07 -04:00
Alec Jacobson 918061f1dc revert accidental change to cgal unit test 2018-10-28 15:43:05 -04:00
Alec Jacobson 3edbcc8662 merge 2018-10-28 15:41:17 -04:00
Alec Jacobson ebdc43fd30 heat geodesics tutorial 2018-10-28 15:33:22 -04:00
Alec Jacobson 8692a04310 heat geodesics 2018-10-28 15:33:02 -04:00
Alec Jacobson 345f82245d templates 2018-10-28 15:32:41 -04:00
Alec Jacobson 688b137e8d intrinsic mass matrix using only edge lengths 2018-10-28 15:32:22 -04:00
Alec Jacobson f11eb36f47 templates 2018-10-28 15:31:35 -04:00
Alec Jacobson f6af195656 typo 2018-10-28 15:31:16 -04:00
Alec Jacobson c60f5f1297 templates 2018-10-28 15:30:48 -04:00
Alec Jacobson ae257dd8a1 PlainObject -> Matrix 2018-10-28 15:30:23 -04:00
Alec Jacobson ab00135605 PlainObject -> Matrix 2018-10-28 15:30:00 -04:00
Alec Jacobson 5fe542d003 intrinsic delaunay cotmatrix + test 2018-10-26 18:26:06 -04:00
Alec Jacobson 5bee6c7f48 templates 2018-10-26 18:25:23 -04:00
Alec Jacobson 4180f4b778 did I forget to add this? 2018-10-26 18:25:11 -04:00
Alec Jacobson 4f6d98e504 deprecate (V,F) version; PlainObject -> Matrix 2018-10-26 18:18:12 -04:00
Alec Jacobson beb304e729 cotmatrix computed intrinsically (using edge lengths) + templates + tests 2018-10-26 23:16:00 +02:00
Alec Jacobson 07c44a392d removed regularity check 2018-10-26 22:11:59 +02:00
Alec Jacobson c1de27fbf0 function to determine if edge already exists nearby + test 2018-10-26 22:03:25 +02:00
Alec Jacobson 0e04d631b1 reinstate tet test 2018-10-26 21:38:56 +02:00
Alec Jacobson b97523348c reinstate queue 2018-10-26 21:31:52 +02:00
Alec Jacobson 7b7086162f refactor and added extra while loop 2018-10-26 20:57:42 +02:00
evouga d7cd36b42e Update cut_to_disk.cpp
Fixed a bug in my implementation (did not correctly update all data structures when reversing the direction of traversal of a cut when hitting a dead end).
2018-10-25 16:56:29 -05:00
Jérémie Dumas 9b5e48cfe6 Merge pull request #975 from copyme/MIQ-TypeInComp
Avoid possible incompatible type casting
2018-10-25 11:59:05 -04:00
Jérémie Dumas fb55f764d7 Merge branch 'dev' into MIQ-TypeInComp 2018-10-25 08:42:33 -04:00
Jérémie Dumas a826bc5f33 Merge pull request #982 from teseoch/windows-templ-instantiation
added missing template instantiation
2018-10-25 08:40:18 -04:00
Teseo Schneider 4ff99273aa typos fixed 2018-10-24 17:58:36 -04:00
Teseo Schneider 0c563d4bf6 added missing template instantiation 2018-10-24 16:48:06 -04:00
Kacper Pluta 75d60e40a8 Documentation and code clean ups (MIQ related) (#971)
* remove commented code

* typo

* clean up list of the arguments

* typo

* typos and different names

* rename files due to a typo and remove double include

* remove comments that do not document the code but are used to comment out code or to store TODOs that should not be placed in the code, anyway.

* clean up the documentation

* remove commented code

* add information to the doc

* improve readability of the code

* typo and a missing space

* fix a typo: missmatch -> mismatch

* remove unnecessary header files

* typos

* changed to camel notation

* clean up

* typo

* add limitations into the documentation

* camelCase

* lost refactor

* unify the variable's names

* clean up

* clean up

* missed refactor

* clean up

* name in the doc

* name in the doc

* further nameing convention changes

* refactored names missed by clion.

* unify names

* align the constructor's args
2018-10-24 13:30:58 -04:00
Jérémie Dumas cf3b31ce47 Remove buggy viewport resize. 2018-10-24 11:34:27 -04:00
Roi Poranne 0f40780d5d Multiple viewports. 2018-10-24 11:15:21 -04:00
Teseo Schneider 67ad5eb9e5 disabled parallel_for in windows 2018-10-24 09:48:38 -04:00
Jérémie Dumas f838c51c03 Merge pull request #972 from copyme/SafeACos-Nrosy
avoid unsafe calls to acos by fixing potential floating-point errors …
2018-10-23 14:18:16 -04:00
Jérémie Dumas 87a59c5fcd Merge pull request #970 from Salingo/ImGuiTraits_fix
compilation error fix
2018-10-23 14:17:34 -04:00
Jérémie Dumas bb187b5b84 Merge pull request #954 from jdumas/cmake
Make libigl targets installable only for toplevel projects by default…
2018-10-23 14:17:02 -04:00
Kacper Pluta a6b6fe2a90 use probably the fastest way to initialize the container's elements to 0. (#976) 2018-10-23 19:38:52 +02:00
teseoch 8d5533a308 Merge pull request #953 from teseoch/dev
Macos Mojave different hack and Windows minimisation fix
2018-10-23 11:56:02 -04:00
Teseo Schneider 6b13d5a70b fixed typo in cmake test 2018-10-23 09:47:30 -04:00
Yuliy Schwartzburg 8b34137a90 trying to reduce travis build time 2018-10-23 15:38:03 +02:00
Kacper Pluta 0e6a09026f remove extra space 2018-10-23 16:03:38 +03:00
Kacper Pluta b3681c14bd remove extra spaces 2018-10-23 15:49:43 +03:00
Kacper Pluta 6f08784072 Avoid type possible incompatible type casting. clock_t here is long int but in the code int was used instead. 2018-10-23 15:18:32 +03:00
Kacper Pluta ffdcbb5114 avoid unsafe calls to acos by fixing potential floating-point errors and avoiding division by zero. 2018-10-23 12:23:22 +03:00
DESKTOP-SALINGO\Salingo 4f5ba3ccdb compilation error fix 2018-10-23 14:54:10 +08:00
Teseo Schneider 49a74590d4 cleand cmake and added INSTANTIATE_TEST_CASE_P 2018-10-22 16:05:42 -04:00
Alec Jacobson 65c2cd3af4 performance optimizations 2018-10-21 08:02:34 +02:00
Alec Jacobson fd27d213d8 performance optimizations 2018-10-21 07:57:05 +02:00
Alec Jacobson e452f5c8c3 add link condition + new tests 2018-10-21 06:52:51 +02:00
Alec Jacobson bd524580e6 fix buggy assert, missing header, template 2018-10-21 06:52:22 +02:00
Alec Jacobson f12cecd9d6 fix buggy assert 2018-10-21 06:51:44 +02:00
Alec Jacobson 758a353e99 template 2018-10-21 06:51:24 +02:00
Alec Jacobson bd3a7c6b9c fix buggy assert 2018-10-21 06:51:03 +02:00
Alec Jacobson be75695e02 circulation does not need F,E args + tests 2018-10-21 06:50:37 +02:00
Alec Jacobson c29460666a better parameter name 2018-10-20 22:37:46 -04:00
Alec Jacobson e930df68d1 added intrinsic version of cotmatrix_entries + test 2018-10-20 13:22:27 -04:00
Alec Jacobson 7c214ce04a intrinsic delaunay (re-)triangulation [Fisher 2007] + tests 2018-10-20 13:14:48 -04:00
Alec Jacobson aa0faffe9f pull out tan_half_angle; templates 2018-10-20 13:14:14 -04:00
Alec Jacobson 53c46c8041 template 2018-10-20 13:12:49 -04:00
Alec Jacobson 5251bce154 license header + template 2018-10-20 13:12:24 -04:00
Alec Jacobson ca3868ca65 better comment 2018-10-20 13:10:49 -04:00
Alec Jacobson 0eb3fa2acb triangulated grid + test 2018-10-20 13:01:41 -04:00
Alec Jacobson ee3d3a373d cumulative product; tests + cumsum test 2018-10-20 12:18:42 -04:00
Alec Jacobson 2e91bb3a00 generalize grid to any dimension; 2d test 2018-10-20 12:13:26 -04:00
Alec Jacobson 7401f5b650 grid test 2018-10-20 12:12:24 -04:00
Alec Jacobson 56e0642fbb intrinsic delaunay and corresponding test 2018-10-19 18:36:37 -04:00
Teseo Schneider aa40b908c9 updated gtest to catch 2018-10-19 17:46:41 -04:00
Teseo Schneider 167599e4d2 enabled testing on windows 2018-10-19 15:49:24 -04:00
Alec Jacobson 7f6f93c424 Merge branch 'dev-delaunay-tests-attempt-2' of https://github.com/libigl/libigl into dev-intrinsic-delaunay 2018-10-19 08:25:04 -04:00
Alec Jacobson 79a1d67a7f fix infinite loop 2018-10-19 08:24:59 -04:00
Alec Jacobson 3e203ac69e Update unique_simplices.cpp
fix infinite loop
2018-10-19 08:24:13 -04:00
Alec Jacobson 6bead806ee purge __1 2018-10-18 20:33:31 -04:00
Alec Jacobson ac7fb9913a files should end with newline 2018-10-18 20:33:25 -04:00
Alec Jacobson 71508b1b30 delaunay unit tests, expose is_delaunay, templates, PlainObject -> Matrix 2018-10-18 19:53:29 -04:00
Jérémie Dumas ef73edafd1 Fix CMake 3.11 warning about FindOpenGL. 2018-10-18 18:27:54 -04:00
Jérémie Dumas d49c892643 Bump version of glfw. 2018-10-18 18:06:49 -04:00
Jérémie Dumas eb3953d901 Make libigl targets installable only for toplevel projects by default (follow-up on #839). 2018-10-18 14:41:05 -04:00
Teseo Schneider b367156df7 changed hack for mojave such that it is not runining transparency and fixed a bug on windows when iconizing the window 2018-10-18 14:21:22 -04:00
Yuliy Schwartzburg b02f622c39 disable AVX512 for Skylake processors to fix travis 2018-10-17 17:28:32 +02:00
Yuliy Schwartzburg 0eb5ddfa40 update for embree 3 2018-10-16 15:47:02 +02:00
Qingnan Zhou e6116bf9dd Bug fix in unit test. (#944) 2018-10-16 09:15:43 -04:00
Jérémie Dumas ed363da1f6 Update .travis.yml
Former-commit-id: 941b40334633a419e095aa62cf69ee4adab63800
2018-10-15 14:55:30 -04:00
Teseo Schneider 15bd0e0996 fixed test
Former-commit-id: 4f840e8649e912c2db1c1c24f4fc39966a7cc0b3
2018-10-15 14:51:18 -04:00
Alec Jacobson 8235ccb3d0 do python last
Former-commit-id: 02b367811edac92ad1acb3a561e5a3615425bc9b
2018-10-15 14:29:59 -04:00
Alec Jacobson 61639328f9 make test --> ctest --verbose
Former-commit-id: b4438c593e008230dc94194936b65b32c3c8605b
2018-10-15 14:27:23 -04:00
teseoch 8ca734ee17 Update .appveyor.yml
removed build of test target on windows

Former-commit-id: 568278dbc3bc0ced682a54775ae8fbd8cd8fb3bd
2018-10-15 14:12:53 -04:00
teseoch 1bfaa60e32 Update .travis.yml
removed verbose tests

Former-commit-id: e13f25477ea07ed146c689beebcb638bdc905ab6
2018-10-15 13:43:54 -04:00
teseoch 67c8d6a141 Update .appveyor.yml
small fix on windows compilation

Former-commit-id: 6dbc01bb8a773ea4b8bf381051654ef4e77ed937
2018-10-15 13:41:56 -04:00
teseoch 971d190108 Update .appveyor.yml
fixed windows compilation

Former-commit-id: 9b2a86e98c650fbacd230fe1fef055c8c17d3f99
2018-10-15 13:31:41 -04:00
Francis Williams b2e8d0b3d3 Sparse grid bfs (#942)
* Add a utility function which computes a sparse set of epsilon-sized grid cells surrounding an input surface. The function takes a point on the surface as input and finds all those epsilon grid cells that intersect the surface using a breadth first search over the grid space.

* Add a utility function which computes a sparse set of epsilon-sized grid cells surrounding an input surface. The function takes a point on the surface as input and finds all those epsilon grid cells that intersect the surface using a breadth first search over the grid space.


Former-commit-id: 1dbd225d993a5417c7d3bedc3a6ba354cc256956
2018-10-15 13:17:06 -04:00
Qingnan Zhou ae3df06258 Remove a cgal unit test temporarily. (#943)
Former-commit-id: 8df208b5f1ad712d5fc5003a1fe7534a5a7cca62
2018-10-15 13:04:01 -04:00
Alec Jacobson 75577c62d7 change message
Former-commit-id: bb1a0b6d20
2018-10-15 12:50:15 -04:00
Jérémie Dumas 8895c712b6 Fix position independent code on Linux. (#941)
Former-commit-id: e21aa88a8b
2018-10-15 12:46:03 -04:00
Alec Jacobson 7f852d8aee fix options
Former-commit-id: 8a2d93cf14
2018-10-15 12:41:49 -04:00
Jérémie Dumas d3dd83f11b Set default options based on toplevel project. (#940)
* Enable options based on toplevel CMake call.

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt


Former-commit-id: 86d3564a14
2018-10-15 12:05:43 -04:00
Qingnan Zhou 5977205363 Make boost static lib an option. (#936)
* Migrate unit tests back to the main repo.

* Minor bug fixes and getting unit test migrated.

* Minor cmake bug for unit tests.

* Make CGAL boost static lib an option.

* Update libigl.cmake

change to ON


Former-commit-id: eb3b18002e
2018-10-15 11:46:38 -04:00
Francis Williams 954cd99196 Sparse Voxel Grid (#937)
* Add a utility function which computes a sparse set of epsilon-sized grid cells surrounding an input surface. The function takes a point on the surface as input and finds all those epsilon grid cells that intersect the surface using a breadth first search over the grid space.

* Add a utility function which computes a sparse set of epsilon-sized grid cells surrounding an input surface. The function takes a point on the surface as input and finds all those epsilon grid cells that intersect the surface using a breadth first search over the grid space.


Former-commit-id: 4f030acb67
2018-10-15 11:46:23 -04:00
Qingnan Zhou 883d0a5028 Remove .gitattributes to avoid line ending problem...
Former-commit-id: fa773a79f4
2018-10-15 11:44:39 -04:00
teseoch 036fc21668 update test for verbose (#938)
* fixed unit test

* partial revert of cmake glob

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* changed build dont know if it works

* verbose testing


Former-commit-id: 7a70f449d4
2018-10-15 11:37:04 -04:00
Jérémie Dumas 8035584024 Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: 024f7cb2ac
2018-10-15 11:28:29 -04:00
Alec Jacobson 72f08a45b8 ignore tests data
Former-commit-id: c45d8a6fda
2018-10-15 11:27:07 -04:00
Alec Jacobson a1e026fbe6 rm tutorial shared
Former-commit-id: 8fd4d1eee9
2018-10-15 11:24:12 -04:00
Jérémie Dumas b672900456 Clean external/ folder.
Former-commit-id: 13c715d56b
2018-10-15 11:17:29 -04:00
teseoch e9fc2a82eb travis and appveyor build test (#935)
* fixed unit test

* partial revert of cmake glob

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* changed build dont know if it works


Former-commit-id: 8502e8d856
2018-10-15 11:05:22 -04:00
Daniele Panozzo 0c831a3fe9 Merge pull request #933 from jdumas/external
Clean external/ folder.

Former-commit-id: bd78e59278
2018-10-15 11:03:16 -04:00
Jérémie Dumas 956c94dfad Merge remote-tracking branch 'origin/dev' into external
Former-commit-id: 9d1dab22c1
2018-10-15 10:51:24 -04:00
Jérémie Dumas 8825f6f94a Hide warning about detached HEAD.
Former-commit-id: 40c3279113
2018-10-15 10:50:15 -04:00
teseoch e4d513a0b7 Teseo (#934)
* fixed unit test

* partial revert of cmake glob

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt


Former-commit-id: 38948329fc
2018-10-15 10:50:01 -04:00
Alec Jacobson 5066b5d253 Create pull_request_template.md (#931)
* Create pull_request_template.md

* Update pull_request_template.md


Former-commit-id: c5dd003a18
2018-10-15 10:46:50 -04:00
Alec Jacobson 99bc7bddb6 Create issue_template.md (#932)
* Create issue_template.md

* Update issue_template.md


Former-commit-id: 207a121296
2018-10-15 10:46:40 -04:00
Daniele Panozzo 14da3a4a9a Merge branch 'dev' of https://github.com/libigl/libigl into dev
Former-commit-id: 65fca1fc2e
2018-10-15 10:31:19 -04:00
Daniele Panozzo ee2599de1a updated cmake files and options
Former-commit-id: 54980dbb68
2018-10-15 10:28:26 -04:00
Jérémie Dumas ba47646bc5 Clean external/ folder.
Former-commit-id: c80df363b7
2018-10-15 10:28:04 -04:00
Teseo Schneider 8ce9abcfc6 fixed template instantiation
Former-commit-id: 4e3654f442
2018-10-15 09:48:55 -04:00
Qingnan Zhou 0bfa95b9d9 Minor cmake bug fix. (#929)
* Migrate unit tests back to the main repo.

* Minor bug fixes and getting unit test migrated.

* Minor cmake bug for unit tests.


Former-commit-id: 7ffcdfe5ff
2018-10-15 09:40:23 -04:00
Qingnan Zhou 10200efa2b Unittests!! (#928)
* Migrate unit tests back to the main repo.

* Minor bug fixes and getting unit test migrated.


Former-commit-id: 823ef3e404
2018-10-15 09:12:38 -04:00
Jérémie Dumas af18599ef7 Fix submodule issue.
Former-commit-id: 7ffb60a73e
2018-10-14 23:39:31 -04:00
Teseo Schneider c722b46cbd Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: 9527889111
2018-10-14 23:17:28 -04:00
Teseo Schneider 2921ffaff6 Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: ea8f88578f
2018-10-14 23:17:18 -04:00
Alec Jacobson 76370d4525 ok, maybe one phrase
Former-commit-id: 5db42e6ef7
2018-10-14 23:17:16 -04:00
Teseo Schneider 0787113a1b main cmake inclding only one igl
Former-commit-id: 5ee5360fa0
2018-10-14 23:17:12 -04:00
Alec Jacobson 3f7895d172 simple readme
Former-commit-id: 3a9673ff28
2018-10-14 23:16:02 -04:00
Teseo Schneider ef78023af4 cleanup cmake
Former-commit-id: 3c4d98ce56
2018-10-14 22:48:56 -04:00
Teseo Schneider 242a4485af added download of data and cleaned up cmake
Former-commit-id: b63e31340f
2018-10-14 22:33:37 -04:00
Daniele Panozzo 4ffc570482 docs moved to a separate repo https://github.com/libigl/libigl.github.io
Former-commit-id: e21e99c40e
2018-10-14 21:54:46 -04:00
Daniele Panozzo 4d66545557 scripts folder is now in a separate repo libigl-scripts
Former-commit-id: 41229497f6
2018-10-14 21:51:18 -04:00
Jérémie Dumas 628375d4d2 Merge pull request #927 from jdumas/skinny
Move from submodules to cmake external.

Former-commit-id: 824ab2d754
2018-10-14 21:45:31 -04:00
Jérémie Dumas 340521757c Update cmake.
Former-commit-id: c80da2902f
2018-10-14 21:36:41 -04:00
Jérémie Dumas 76b8ca17d8 Update cmake.
Former-commit-id: 430271682c
2018-10-14 19:46:27 -04:00
Jérémie Dumas 1ef33b03a2 Move from submodules to cmake external.
Former-commit-id: de5e3215de
2018-10-14 19:35:08 -04:00
Francis Williams 0d1d133330 marching tetrahedra documentation (#926)
Former-commit-id: 3bb85d91df
2018-10-14 19:31:17 -04:00
Alec Jacobson 1fe4eb190f Revert "Revert "Marching Tetrahedra (#716)" (#924)" (#925)
This reverts commit 65aa93e9ef [formerly 47634615ce].

Former-commit-id: fd8d66156c
2018-10-14 19:17:01 -04:00
Alec Jacobson 65aa93e9ef Revert "Marching Tetrahedra (#716)" (#924)
This reverts commit 7cb42ce972 [formerly d152b6072e].

Former-commit-id: 47634615ce
2018-10-14 19:16:39 -04:00
Francis Williams 7cb42ce972 Marching Tetrahedra (#716)
* Marching Tetrahedra

* dropping cxx11


Former-commit-id: d152b6072e
2018-10-14 19:14:45 -04:00
Qingnan Zhou c0c396c237 Adds interface for the multi-zone mesh generation capabilities of TetGen (#923)
* Update tetrahedralize.h

* Update tetrahedralize.h

* WIP: adding overload for allowing holes and regions in tetgen mesh

* Update tetrahedralize.h

* Update tetrahedralize.h

* WIP: adding overload for allowing holes and regions in tetgen mesh

* WIP: skeleton code for tetrahedralize supporting holes and regions

* removes comments

* call to overloaded mesh_to_tetgenio()

* overload to allow for holes and regions

* WIP: overload to allow for holes and regions

* fixes typos

* fixed function signature

* adds comments

* adds overload for returning regionID information

* added overload for holes and regions

* added Eigen wrapper

* WIP: add support for neighborlist and point2tet

* WIP: adding point2tet and neighborlist info

* adds support for face to tet list

* WIP: bug fixes, regions, holes

* support for holes, regions, point2tet, face2tet, tet neighbors

* Update tetgen to 1.5.1.


Former-commit-id: b4eaa0dac7
2018-10-14 18:58:58 -04:00
Alec Jacobson 7dc2b11c2a Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: 6802bb2a4e
2018-10-14 18:43:46 -04:00
Alec Jacobson 3f442b54f3 [bug fix]: uncomment boundary_facets
Former-commit-id: a79f95b7ca
2018-10-14 18:43:42 -04:00
Jérémie Dumas 96c8ea4931 Update .appveyor.yml
Former-commit-id: 6fba5b123a
2018-10-14 18:41:04 -04:00
Alec Jacobson 928cbe67bb Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: 28dd927d18
2018-10-14 18:12:11 -04:00
Alec Jacobson 9a149ece72 rm stray cout
Former-commit-id: 3253bed881
2018-10-14 18:12:06 -04:00
Jérémie Dumas 76ae819489 Merge pull request #839 from ithron/installable
Make libigl installable using CMake

Former-commit-id: d1d48f2b67
2018-10-14 18:08:41 -04:00
Daniele Panozzo 66ec792368 Merge pull request #819 from vskhitkov/principal_curvature_fix
fix: principal_curvature returns vector of bad vertex indices
Former-commit-id: 20c76ca2a2
2018-10-14 18:05:53 -04:00
Zhongshi 2726464472 Adding 2D version of SCAF for Bijective Maps and a tutorial (#752)
* Add scaf code

Add the tutorial entry

Tutorial entry for SCAF. still need polishing

Put -4 in the energy computation of scaf:SymmD

* 🏫 Insert SCAF to 711

Fixes in tutorial.md

updating tutorial.html

Fix for gcc 4.8

Remove 4.1

Refactoring scaf WIP

Further refactoring WIP

Code Cleaning

* 🔨 Improve SLIM interface

* ♻️ refactor SCAF with less lines

* ♻️ refactor harmonic with boundary

*  Add direct signature for scaf

* 📝 Change tutorial order wip

* 🏫 Timer in SLIM tutorial makes more sense

*  Add direct interface for SLIM

* 🎨 format SCAF code.

* 🐍 Python binding for slim and scaf

* 🐍 expose SLIMData (maybe elevate its status more in the future)

* 👽 🐍 deprecate PYBIND11_PLUGIN

*  harmonic with holes

* ♻️ SCAF, Decouple Initialization to tutorial

* 🏫 SCAF tutorial improvement

* 🏫 Tutorial order; insert scaf

* 🎨 Removing Adjusted_grad

*     🏫 Inserted SCAF, not messing around with tutorials order until the new page is online

* 💚 Fix for static build

* ♻️ Uniform SLIM and SCAF and  python binding canonical

* 🐛 Change in ScafData

* 🍎 Fix namespace for build

*  Introduced Mapping Energy Type to replace adhoc SLIMEnergy

* ♻️ Refactor subroutines from SLIM

* Revert python changes

* leave fill hole outside harmonic

* Revert Python changes

* hole fill

* Minor Fixes for SCAF

SCAF->IGL_SCAF
Topological_hole_fill 
"<igl/XXX>" in slim tutorial


Former-commit-id: 4edf5dede5
2018-10-14 17:55:36 -04:00
Oded Stein 31d419e2c0 Tetrahedral adjacenct functions (#835)
* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* Add tet_tet_adjacency

* Add tet_tet_adjacency

* added parallelization of the preprocessing

* added parallelization of the preprocessing

* fixed rebasing stuff

* Use template for index type


Former-commit-id: ab3f20c83e
2018-10-14 17:21:31 -04:00
hanxiao 9e10c1b534 Merge branch 'vskhitkov-principal_curvature_fix' into dev
Former-commit-id: b9567ca191
2018-10-14 17:19:46 -04:00
hanxiao 4e739bc528 update tutorial 203
Former-commit-id: cb4a4d111f
2018-10-14 17:14:52 -04:00
hanxiao d3510ceeba Merge branch 'dev' of https://github.com/libigl/libigl into dev
Former-commit-id: f6be209bad
2018-10-14 16:26:40 -04:00
Alec Jacobson 41b4a5e62e Merge pull request #908 from MeshGeometry/master
Added optional weights to Dijkstra's algorithm + some template definitions

Former-commit-id: 8bfa7e9a59
2018-10-14 16:26:34 -04:00
Francis Williams 2de5e29fc9 Merge pull request #575 from fwilliams/sparse_mc
Marching cubes over sparse indexed grids

Former-commit-id: 044b1626d2
2018-10-14 16:25:39 -04:00
Alec Jacobson 93cba2e044 rename
Former-commit-id: 23e9373fdf
2018-10-14 16:24:56 -04:00
Alec Jacobson a38371d231 Merge pull request #809 from evouga/cutmesh
Code to cut meshes into topological disks

Former-commit-id: b72c9a7b96
2018-10-14 16:18:05 -04:00
Alec Jacobson 5e20808faa Update cut_to_disk.cpp
Former-commit-id: d974e22c6f
2018-10-14 16:17:47 -04:00
hanxiao 714658b8d7 Merge branch 'vskhitkov-principal_curvature_fix' into dev
Former-commit-id: ad42bf1d2c
2018-10-14 16:01:47 -04:00
hanxiao 414740aa38 add overload function for principal_curvature
Former-commit-id: 73cb2a97f1
2018-10-14 16:01:22 -04:00
Alec Jacobson 0cdc451a80 Merge pull request #530 from milkpku/comb_cross_field
add while loop for comb_cross_field.cpp, making comb support separated manifold

Former-commit-id: 71e1bb476a
2018-10-14 15:41:56 -04:00
Alec Jacobson 56eee0e3a4 Merge pull request #859 from jdumas/imgui
Update ImGui bindings.

Former-commit-id: 908da7473c
2018-10-14 15:40:58 -04:00
Alec Jacobson 5b534bff4c Merge pull request #857 from jdumas/viewer
Minor fixes to the viewer.

Former-commit-id: 65700c1958
2018-10-14 15:40:29 -04:00
Francis Williams 12b904a5b8 Add isovalue support
Former-commit-id: 1194f8921e
2018-10-14 15:39:27 -04:00
hanxiao bcddf01d77 Merge branch 'principal_curvature_fix' of https://github.com/vskhitkov/libigl into vskhitkov-principal_curvature_fix
Former-commit-id: 4807ce91a3
2018-10-14 15:25:55 -04:00
Francis Williams b0eb3db0aa hide marching cubes internal state in class
Former-commit-id: 32824a591c
2018-10-14 15:22:59 -04:00
Francis Williams 409aee509d Marching cubes over sparse indexed grids
Former-commit-id: 2774fec8f4
2018-10-14 15:18:09 -04:00
Alec Jacobson 0c2b5cec70 Merge pull request #921 from libigl/revert-920-revert-856-master
Revert "Revert "Make avg_edge_length() count interior edges only once.""

Former-commit-id: e874029655
2018-10-14 15:15:07 -04:00
Alec Jacobson 075e95bfd2 Revert "Revert "Make avg_edge_length() count interior edges only once.""
Former-commit-id: 584d437b9a
2018-10-14 15:14:38 -04:00
Alec Jacobson 3e35dc3a76 Merge pull request #920 from libigl/revert-856-master
Revert "Make avg_edge_length() count interior edges only once."

Former-commit-id: e74b183473
2018-10-14 15:13:00 -04:00
Alec Jacobson 7b6ebdc3ea Revert "Make avg_edge_length() count interior edges only once."
Former-commit-id: e797ac9b60
2018-10-14 15:12:42 -04:00
Alec Jacobson c192e28084 Merge pull request #856 from jdumas/master
Make avg_edge_length() count interior edges only once.

Former-commit-id: 05db403158
2018-10-14 15:12:38 -04:00
Daniele Panozzo 59251ca327 mojave opengl fix
Former-commit-id: c271bbf50b
2018-10-14 15:01:54 -04:00
Daniele Panozzo 2a47253152 Merge branch 'comb_cross_field' of https://github.com/milkpku/libigl into dev
Former-commit-id: 300903ae99
2018-10-14 14:50:37 -04:00
hanxiao ef42f203ad Merge branch 'fwilliams-function_rename' into dev
Former-commit-id: aa0bd56830
2018-10-14 14:49:22 -04:00
hanxiao e0849c88da update release history markdown
Former-commit-id: 329f32e6cf
2018-10-14 14:49:08 -04:00
hanxiao c415f21858 Merge branch 'function_rename' of https://github.com/fwilliams/libigl into fwilliams-function_rename
Former-commit-id: 62b9246c73
2018-10-14 14:07:27 -04:00
Qingnan Zhou 4125afe80f Merge branch 'dev' into HEAD
Former-commit-id: 5e99913faa
2018-10-14 14:00:50 -04:00
Alec Jacobson f16ee6d7c5 merge
Former-commit-id: 2829ba2cde
2018-10-14 13:50:15 -04:00
Jérémie Dumas 8847026227 Merge branch 'dev' of github.com:libigl/libigl into dev
Former-commit-id: 1e4efe1606
2018-10-14 13:47:53 -04:00
Jérémie Dumas a6423836aa Add missing template instantiation.
Former-commit-id: bbb1c430af
2018-10-14 13:47:43 -04:00
Alec Jacobson 03653319d1 Merge pull request #612 from breannansmith/obj_load_fix
Fix for a segfault when attempting to load a non-existant obj mesh th…

Former-commit-id: 5cb00f2f68
2018-10-14 12:52:37 -04:00
Alec Jacobson f12ffbd24e Merge pull request #872 from jimmyland/patch-2
fix comments for qslim.h

Former-commit-id: 1b4123f4ff
2018-10-14 12:26:52 -04:00
Alec Jacobson 28801efb8b Merge pull request #878 from jiangzhongshi/patch-5
🐛 Allow empty input in exact_geodesic

Former-commit-id: b32090f7f6
2018-10-14 12:23:53 -04:00
Alec Jacobson 4db3a4c521 Merge pull request #887 from jiangzhongshi/patch-4
📝 fix screen capture tutorial

Former-commit-id: 7f12674a7e
2018-10-14 12:23:16 -04:00
Alec Jacobson 85ffda7ef4 Merge pull request #889 from jimmyland/patch-3
cotmatrix appears to support tetrahedra too

Former-commit-id: bc9ca8b942
2018-10-14 12:20:42 -04:00
Alec Jacobson 2e66247d99 Merge pull request #892 from artoonie/bugfix/enableOuput
fix EnableOutput flag for less verbosity in LIM

Former-commit-id: 16bdbf0fa3
2018-10-14 12:20:08 -04:00
Alec Jacobson 5f428b210e Merge pull request #917 from unclejimbo/fix-redux
Fix redux

Former-commit-id: ae30d97242
2018-10-14 12:18:14 -04:00
unclejimbo 7aed747cd7 remove unneeded include
Former-commit-id: c4c431c08c
2018-10-11 21:35:43 +08:00
unclejimbo 3ef2e16408 fix func_wrap argument type
Former-commit-id: c0340bec3d
2018-10-11 21:35:10 +08:00
Alec Jacobson 45acb3a583 adding explicit FindMATLAB.cmake (from cmake 3.10.2), because cmake 3.12.3's broke our build
Former-commit-id: d68f2f4cc2
2018-10-10 08:49:07 -04:00
Alec Jacobson 42883bb57a add cpature
Former-commit-id: 78ed65659d
2018-09-28 14:51:55 -04:00
Daniel Hambleton c7c906c204 fixed win64 compile
Former-commit-id: 82be337653
2018-09-28 13:05:19 -04:00
zero-impact dd44506bcc Removing nanogui..
Former-commit-id: 25a5c60fb8
2018-09-27 10:25:51 -04:00
zero-impact 4f83e01386 Merge remote-tracking branch 'upstream/master' into merge_branch
Former-commit-id: f92b6355db
2018-09-27 10:13:25 -04:00
zero-impact e2a7dc74dd adding templates
Former-commit-id: 9459a9fd41
2018-09-27 10:06:51 -04:00
Alec Jacobson 8c5e9bd9bd better windows support (hopefully), unix unit tests still pass
Former-commit-id: b517b345ed
2018-09-25 23:56:32 -04:00
Alec Jacobson 855f60f9f6 [bug fix]: dirname building single char string wrong.
Former-commit-id: dc4c3379b4
2018-09-25 23:30:51 -04:00
zero-impact bb730dec7d adding template
Former-commit-id: 3ba94e928e
2018-09-21 13:19:05 -04:00
zero-impact cec9df42aa Added a weights option to dijkstras
Former-commit-id: 34be9cb7a8
2018-09-14 17:51:36 -04:00
Daniel Hambleton 2b666475ec Merge branch 'master' of github.com:MeshGeometry/libigl
Former-commit-id: 274ae444e0
2018-09-14 15:58:23 -04:00
Daniel Hambleton fd8ee231b1 merged
Former-commit-id: 750bcc8e4b
2018-09-14 15:57:02 -04:00
Armin Samii 66696c2222 fix EnableOutput flag for less verbosity in LIM
Former-commit-id: 1ef2f83aee
2018-09-14 10:22:44 -07:00
James Andrews c47b26d73a massmatrix also apparently supports tets?
Former-commit-id: c0c158c4ce
2018-09-12 16:29:51 -07:00
James Andrews db2419a6e3 cotmatrix appears to support tetrahedra too
Former-commit-id: c0c1cb00a3
2018-09-12 16:16:35 -07:00
Zhongshi 2ceac853c3 📝 fix screen capture tutorial
Former-commit-id: 852d2ad1b7
2018-09-07 14:51:50 -04:00
Zhongshi f6c1f0bea1 🐛 Allow empty input in exact_geodesic
Former-commit-id: f914d8a175
2018-08-26 22:47:43 -07:00
James Andrews 1a42b39c93 Update qslim.h
also complete the cut off sentence in the V comment

Former-commit-id: bae373e510
2018-08-15 17:11:54 -07:00
James Andrews a54d558f82 "G can be same ref as G" -> "can be same ref as F"
Former-commit-id: fe87d32fb8
2018-08-15 13:12:55 -07:00
Jérémie Dumas ef81faeac2 Fix stupid mistake.
Former-commit-id: d8dc5963bd
2018-08-07 14:08:56 -04:00
Jérémie Dumas 7117af68b5 Merge remote-tracking branch 'upstream/master' into imgui
Former-commit-id: 52be21257f
2018-08-07 11:59:35 -04:00
Jérémie Dumas 5b13a5c490 Merge remote-tracking branch 'upstream/master' into viewer
Former-commit-id: 2944889f64
2018-08-07 11:59:23 -04:00
Jérémie Dumas c314bf9182 Merge remote-tracking branch 'upstream/master'
Former-commit-id: b4bbe7597b
2018-08-07 11:58:36 -04:00
Jérémie Dumas 58f16f00e7 Fix CMake script.
Former-commit-id: 44c8604698
2018-08-04 12:14:26 -04:00
Jérémie Dumas 621f31e10e Fix CMake script.
Former-commit-id: 3ba5cefe1c
2018-08-03 21:02:48 -04:00
Jérémie Dumas 209b81e56c Update ImGui bindings.
Warnings: potentially breaking changes on the ImGui, may require user to
adapt their UI code.

Former-commit-id: ce723d8c00
2018-08-03 20:56:10 -04:00
Jérémie Dumas 92f2e20fa5 Change priority of callbacks vs plugins in the Viewer (fixes #764).
Former-commit-id: 4087099a66
2018-08-03 17:56:20 -04:00
Jérémie Dumas 9cdf351f6b Fixes #757.
Former-commit-id: b1d576dba7
2018-08-03 17:42:50 -04:00
Jérémie Dumas 7fba338427 avg_edge_length() should count interior edges only once.
Former-commit-id: e68568582c
2018-08-03 17:32:08 -04:00
Stefan Reinhold eb6ffec8d5 Add Eigen3 requirement to package configuration
In package configuration file:
1. Look for Eigen3::Eigen target. If not present:
2. use find_package(Eigen3) to look for Eigen3. On failure:
3. Use pkg_check_modules to look for Eigen3. (Eigen provided a
   pkg-config file).
If neither of the three options succeed, find_package(libigl) will fail
with an error message.


Former-commit-id: e777d220fc
2018-07-24 16:58:58 +02:00
Stefan Reinhold edf08926c5 Fix: installed target not prefixed with igl::
Former-commit-id: d66546f12f
2018-07-24 16:58:22 +02:00
Stefan Reinhold b3fce1689c Check if all required components are available
Former-commit-id: 61db9ead55
2018-07-24 16:18:27 +02:00
Stefan Reinhold de3749fc55 Improve export and installation part
Currently only the core module is supported for export and installation

Former-commit-id: 1de5836307
2018-07-24 16:18:11 +02:00
Francis Williams a9c3b6d50a rename components.[h|cpp] to vertex_components.[h|cpp]
Former-commit-id: 989a144269
2018-07-22 23:25:13 -04:00
Francis Williams 18a1eaf38c we have the functions igl::components() and igl::facet_components() for computing connected components on vertices and faces respectively.
The naming here is super confusing (and someone wasted a couple of hours because they didn't know that facet_components existed).

This change improves discoverability in 2 ways:
1 - More consistent naming by changint `components()` to `vertex_components()` which hints that there may exist a `facet_component()` function.
2 - Reference `facet_components()` in the docs for `vertex_components()` and vice versa


Former-commit-id: 43a7d250f5
2018-07-20 15:20:51 -04:00
Stefan Reinhold 075f884f5f Add missing include of CMakePackageConfigHelpers
Former-commit-id: e98b098db9
2018-07-19 16:55:22 +02:00
Stefan Reinhold 28f59dfe2f Add top level CMakeLists.txt
This file currently acts as a placeholder for optional/CMakeLists.txt to
enable automatic builds. Maybe it's a good idea to move
optional/CMakeLists.txt here.


Former-commit-id: f77e8ba252
2018-07-19 16:50:09 +02:00
Stefan Reinhold 2256dd7264 Add package configuration file
Former-commit-id: 2397ab9df8
2018-07-19 15:58:23 +02:00
Stefan Reinhold eaa2d52f4e Change all CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR
Former-commit-id: d101477842
2018-07-19 15:30:07 +02:00
Stefan Reinhold 418d98b02e Change export name to igl-export
Former-commit-id: e098761e9a
2018-07-19 15:24:20 +02:00
Stefan Reinhold e8ca66fb7c Prefix CMake variables with LIBIGL_
Former-commit-id: a9645ac7e6
2018-07-19 15:22:02 +02:00
Stefan Reinhold 90ed035285 Change CMake commands to lowercase
Former-commit-id: a2a7169859
2018-07-19 15:20:32 +02:00
Stefan Reinhold 7f305a8532 Exclude embree module from installation
Former-commit-id: 0d0401454f
2018-07-19 14:46:26 +02:00
Stefan Reinhold 87d401b82b Install Eigen dependency in public location
Eigen shoudl not be installed in include/private/Eigen but in
include/Eigen instead so users can include the same Eigen version.


Former-commit-id: 1ec9614235
2018-07-19 13:36:39 +02:00
Stefan Reinhold dc1d3bb46c Make libigl installable using CMake
Installation is currently only supported for the core library. All
optional dependencies do not generate cmake exports, yet.
However, the commands required for installation were added but commented
out, so that as soon as an optional dependency adds cmake exports they
can be installed, too.


Former-commit-id: 28f815f866
2018-07-19 12:59:24 +02:00
vskhitkov da3bd928dd Replace return value by vector of indices of bad vertices
Former-commit-id: 0914f34a91
2018-06-21 19:21:35 +03:00
vskhitkov 86128972f6 Fixed my own fix
Former-commit-id: dca5f4e8a2
2018-06-21 17:07:10 +03:00
vskhitkov dfbc3ee1c1 bugfix: principal_curvature returns boolean instead of segfault
Former-commit-id: 8f6a4c4c07
2018-06-21 16:04:48 +03:00
Daniel Hambleton 576529d8d9 merged upstream
Former-commit-id: 2d9020d881
2018-06-19 13:52:37 -04:00
Alec Jacobson 792c814200 Update cut_to_disk.cpp
move headers to cpp

Former-commit-id: bfa6e9a716
2018-06-14 11:09:51 -04:00
Alec Jacobson 4a3ce8d896 Update cut_to_disk.h
move headers to cpp

Former-commit-id: 697195a764
2018-06-14 11:09:35 -04:00
Alec Jacobson dde2f93dd7 Update cut_to_disk.cpp
Former-commit-id: f077dea827
2018-06-14 11:08:55 -04:00
Alec Jacobson 83db1d2f19 Update cut_to_disk.h
Former-commit-id: 50e8037b31
2018-06-14 11:08:37 -04:00
Etienne Vouga 94dac679eb Code to cut meshes into topological disks
Former-commit-id: 808ffb637a
2018-06-13 19:56:42 -05:00
Alec Jacobson e2e4926241 Merge branch 'master' into obj_load_fix
Former-commit-id: 9b94c4100d
2018-03-19 22:29:44 -04:00
Breannan Smith 8571d5f3a2 Fix for a segfault when attempting to load a non-existant obj mesh through read_triangle_mesh.
Former-commit-id: c0e8e210f8
2017-10-01 21:11:35 -07:00
Like Ma 7c249cb5e2 add while loop for comb_cross_field.cpp, making comb support manifold that
is made up with several separated part


Former-commit-id: 247043cc71
2017-05-11 17:10:12 +08:00
1202 changed files with 52537 additions and 111153 deletions
-41
View File
@@ -1,41 +0,0 @@
version: 1.0.{build}
os: Visual Studio 2017
test: off
clone_folder: C:\projects\libigl
branches:
only:
- master
- alecjacobson
- cmake
- cgal
environment:
BOOST_ROOT: C:/Libraries/boost_1_65_1
install:
- git submodule update --init --recursive
- cinstall: python
build_script:
- cd c:\projects\libigl
# External libraries (boost)
# - cd external
# - mkdir build
# - cd build
# - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
# - msbuild %MSBuildOptions% libigl_external.sln
# - cd ../..
# Python bindings
# - cd python
# - mkdir build
# - cd build
# - cmake -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON ../
# - msbuild %MSBuildOptions% pyigl.sln
# - cd ../tutorial
# - ${PYTHON} 101_FileIO.py
# - cd ../../
# Tutorials
- cd tutorial
- mkdir build
- cd build
- cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -G "Visual Studio 15 2017 Win64" ../
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
- msbuild %MSBuildOptions% libigl_tutorials.sln
+17
View File
@@ -0,0 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug, pending verification
assignees: ''
---
#### Describe the bug
A clear and concise description of what the bug is.
#### Check all that apply (change to `[x]`)
- [ ] Windows
- [ ] macOS
- [ ] Linux
+17
View File
@@ -0,0 +1,17 @@
---
name: Compilation issue
about: Report a problem when compiling the code
title: ''
labels: 'compilation'
assignees: ''
---
#### Describe your question
...
#### Check all that apply (change to `[x]`)
- [ ] Windows
- [ ] macOS
- [ ] Linux
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: false
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''
---
#### Describe your feature request
...
#### Check all that apply (change to `[x]`)
- [ ] Windows
- [ ] macOS
- [ ] Linux
+17
View File
@@ -0,0 +1,17 @@
---
name: Question
about: Ask question about the tutorial or documentation
title: ''
labels: 'question'
assignees: ''
---
#### Describe your question
...
#### Check all that apply (change to `[x]`)
- [ ] Windows
- [ ] macOS
- [ ] Linux
+10
View File
@@ -0,0 +1,10 @@
Fixes # .
[Describe your changes and what you've already done to test it.]
#### Check all that apply (change to `[x]`)
- [ ] All changes meet [libigl style-guidelines](https://libigl.github.io/style-guidelines/).
- [ ] Adds new .cpp file.
- [ ] Adds corresponding unit test.
- [ ] This is a minor change.
+152
View File
@@ -0,0 +1,152 @@
name: Build
on:
push:
branches:
- master
- stable
pull_request:
branches:
- master
- stable
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
####################
# Linux / macOS
####################
Unix:
name: ${{ matrix.name }} (${{ matrix.config }}, ${{ matrix.static }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest]
config: [Release]
static: [ON, OFF]
include:
- os: macos-latest
name: macOS
- os: ubuntu-20.04
name: Linux
env:
LIBIGL_NUM_THREADS: 1 # See https://github.com/libigl/libigl/pull/996
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install \
libblas-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-thread-dev \
libglu1-mesa-dev \
liblapack-dev \
libmpfr-dev \
xorg-dev \
ccache
- name: Dependencies (macOS)
if: runner.os == 'macOS'
run: brew install boost gmp mpfr ccache
- name: Cache Build
id: cache-build
uses: actions/cache@v1
with:
path: ~/.ccache
key: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.static }}-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DLIBIGL_USE_STATIC_LIBRARY=${{ matrix.static }} \
-DLIBIGL_WITH_CGAL=ON \
-DLIBIGL_WITH_COMISO=ON
- name: Build
run: cd build; make -j2; ccache --show-stats
- name: Tests
run: cd build; ctest --verbose
####################
# Windows
####################
Windows:
runs-on: windows-2019
env:
CC: cl.exe
CXX: cl.exe
strategy:
fail-fast: false
matrix:
config: [Release]
static: [ON, OFF]
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set env
run: |
echo "BOOST_ROOT=$env:BOOST_ROOT_1_72_0" >> ${env:GITHUB_ENV}
echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
- name: Cache build
id: cache-build
uses: actions/cache@v1
with:
path: ${{ env.appdata }}\Mozilla\sccache
key: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.static }}-cache
- name: Prepare sccache
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install sccache --global
# Scoop modifies the PATH so we make it available for the next steps of the job
echo "${env:PATH}" >> ${env:GITHUB_PATH}
# We run configure + build in the same step, since they both need to call VsDevCmd
# Also, cmd uses ^ to break commands into multiple lines (in powershell this is `)
- name: Configure and build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake -G Ninja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-DLIBIGL_USE_STATIC_LIBRARY=${{ matrix.static }} ^
-DLIBIGL_WITH_CGAL=ON ^
-DLIBIGL_WITH_COMISO=OFF ^
-DCMAKE_JOB_POOLS=pool-linking=1;pool-compilation=2 ^
-DCMAKE_JOB_POOL_COMPILE:STRING=pool-compilation ^
-DCMAKE_JOB_POOL_LINK:STRING=pool-linking ^
-B build ^
-S .
cmake --build build
- name: Tests
run: cd build; ctest --verbose
+189
View File
@@ -0,0 +1,189 @@
name: Nightly
on:
schedule:
- cron: '0 4 * * *'
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
####################
# Linux / macOS
####################
# Part of this file is inspired from
# https://github.com/onqtam/doctest/blob/dev/.github/workflows/main.yml
Unix:
name: ${{ matrix.name }} (${{ matrix.config }}, Static=${{ matrix.static }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [
ubuntu-20.04-gcc-8,
ubuntu-20.04-gcc-9,
ubuntu-20.04-gcc-10,
ubuntu-20.04-clang-8,
ubuntu-20.04-clang-9,
ubuntu-20.04-clang-10,
macOS-latest,
]
config: [Debug, Release]
static: [ON, OFF]
include:
- name: ubuntu-20.04-gcc-8
os: ubuntu-20.04
compiler: gcc
version: "8"
- name: ubuntu-20.04-gcc-9
os: ubuntu-20.04
compiler: gcc
version: "9"
- name: ubuntu-20.04-gcc-10
os: ubuntu-20.04
compiler: gcc
version: "10"
- name: ubuntu-20.04-clang-8
os: ubuntu-20.04
compiler: clang
version: "8"
- name: ubuntu-20.04-clang-9
os: ubuntu-20.04
compiler: clang
version: "9"
- name: ubuntu-20.04-clang-10
os: ubuntu-20.04
compiler: clang
version: "10"
- name: macOS-latest
os: macOS-latest
# Build tutorials for most configurations
- tutorials: ON
# Except with Debug mode
- config: Debug
tutorials: OFF
env:
LIBIGL_NUM_THREADS: 1 # See https://github.com/libigl/libigl/pull/996
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }}
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
fi
sudo apt-get install \
libblas-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-thread-dev \
libglu1-mesa-dev \
liblapack-dev \
libmpfr-dev \
xorg-dev
- name: Dependencies (macOS)
if: runner.os == 'macOS'
run: brew install boost gmp mpfr
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DLIBIGL_USE_STATIC_LIBRARY=${{ matrix.static }} \
-DLIBIGL_BUILD_TUTORIALS=${{ matrix.tutorials }} \
-DLIBIGL_WITH_CGAL=ON \
-DLIBIGL_WITH_COMISO=ON
- name: Free Disk Space
if: runner.os == 'Linux'
run: |
sudo swapoff -a
sudo apt clean
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
df -h
- name: Build
run: cd build; make -j2
- name: Tests
run: cd build; ctest --verbose
####################
# Windows
####################
Windows:
name: Windows (${{ matrix.config }}, Static=${{ matrix.static }})
runs-on: windows-2019
env:
CC: cl.exe
CXX: cl.exe
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
static: [ON, OFF]
include:
- config: Debug
tutorials: OFF
- config: Release
tutorials: ON
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set env
run: |
echo "BOOST_ROOT=$env:BOOST_ROOT_1_72_0" >> ${env:GITHUB_ENV}
# We run configure + build in the same step, since they both need to call VsDevCmd
# Also, cmd uses ^ to break commands into multiple lines (in powershell this is `)
- name: Configure and build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake -G Ninja ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-DLIBIGL_USE_STATIC_LIBRARY=${{ matrix.static }} ^
-DLIBIGL_BUILD_TUTORIALS=${{ matrix.tutorials }} ^
-DLIBIGL_WITH_CGAL=ON ^
-DLIBIGL_WITH_COMISO=OFF ^
-DCMAKE_JOB_POOLS=pool-linking=1;pool-compilation=2 ^
-DCMAKE_JOB_POOL_COMPILE:STRING=pool-compilation ^
-DCMAKE_JOB_POOL_LINK:STRING=pool-linking ^
-B build ^
-S .
cmake --build build -j 1
- name: Tests
run: cd build; ctest --verbose
+77 -87
View File
@@ -1,110 +1,100 @@
# use glob syntax.
syntax: glob
scripts/change_name.sh
*.a
*.dylib
*.egg-info/
*.exe
*.ilk
*.log
*.o
*.opensdf
*.orig
*.pdb
*.psess
*.pyc
*.sdf
*.so
*.so.[0123456789]
*.so.[0123456789].[0123456789]
*.o
*.a
*.dylib
*~
*CMakeFiles*
example
examples/bbw/bbw_demo_selfcontained/*
examples/bbw/bbw_demo_selfcontained.zip
examples/quicklook-mesh/Mesh.qlgenerator/*
examples/*/*.mexmaci64
examples/*/*.rbr
example_static
example_header_only
example1
external/yimg/.git*
external/tinyxml2/CMakeFiles*
external/tinyxml2/CMakeCache.txt
external/tinyxml2/cmake_install.cmake
external/tinyxml2/Makefile
external/embree/build/*
external/embree/bin/*
external/embree/bin
external/embree/doc/html/*
external/embree/doc/latex/*
external/gmp
external/mpfr
external/boost
external/.cache
external/build
.DS_Store
libigl.zip
*tags
*.exe
*.pdb
*.sdf
*.suo
*.ilk
*.log
*.swo
*.swp
*.tlog
Debug/
Release/
*.orig
*.user
*.vsp
*.opensdf
*.psess
*.swp
*.swo
documentation/*.aux
documentation/*.out
documentation/*.log
*CMakeFiles*
*buildXcode*
*tags
*~
.DS_Store
.idea/
.vs/
.vscode/
/external
Debug/
README.html
Release/
Untitled.ipynb
build
doc.html
documentation/*.aux
documentation/*.log
documentation/*.out
example
example1
example_header_only
example_static
examples/*/*.mexmaci64
examples/*/*.rbr
examples/bbw/bbw_demo
external/medit/rebar.rbr
examples/bbw/bbw_demo_selfcontained.zip
examples/bbw/bbw_demo_selfcontained/*
examples/bbw/examples/*-volume.dmat
examples/bbw/examples/*-volume.mesh
examples/upright/upright
examples/principal_curvature/curvature
examples/quicklook-mesh/Mesh.qlgenerator/*
examples/upright/upright
external/MeshFix/meshfix
external/embree/build/*
external/glew/build
external/glfw/build
external/libpng/build
external/medit/rebar.rbr
external/tetgen/tetgen
external/tinyxml2/build
external/tinyxml2/test
external/tinyxml2/tinyxml2.pc
external/yimg/showpng
README.html
tutorial/readme.html
tutorial/*/build/*
tutorial/*/Makefile
external/glew/build
external/glfw/build
*buildXcode*
tutorial/build*
tutorial/*/*.mexmaci64
external/libpng/build
external/tinyxml2/build
optional/build
iglhelpers.pyc
lib
libigl.zip
optional/build
python/.idea
python/.ipynb_checkpoints
python/__pycache__
python/build
python/build2
python/build3
python/build4
python/builddebug
python/buildstatic
python/py_igl/todo
python/py_igl/todo
python/scripts/generated
scripts/change_name.sh
site/
syntax: glob
tests/bin
tests/build
tests/data
tutorial/*/*.mexmaci64
tutorial/*/Makefile
tutorial/*/build/*
tutorial/.idea
tutorial/XXX_test/CMakeLists.txt
tutorial/XXX_test/main.cpp
python/py_igl/todo
python/build
python/.idea
untitled
Untitled.ipynb
python/.ipynb_checkpoints
python/py_igl/todo
python/__pycache__
iglhelpers.pyc
python/build2
tests/build
tests/bin
python/build3
*.pyc
python/build4
python/scripts/generated
python/builddebug
tutorial/.idea
python/buildstatic
tutorial/build
tutorial/cmake-build-debug
.vscode/
.idea/
site/
*.egg-info/
.vs/
tutorial/data
tutorial/readme.html
untitled
scripts
-33
View File
@@ -1,33 +0,0 @@
[submodule "external/embree"]
path = external/embree
url = https://github.com/embree/embree.git
[submodule "external/cgal"]
path = external/cgal
url = https://github.com/CGAL/cgal.git
[submodule "external/tetgen"]
path = external/tetgen
url = https://github.com/libigl/tetgen.git
[submodule "external/triangle"]
path = external/triangle
url = https://github.com/libigl/triangle.git
[submodule "external/tinyxml2"]
path = external/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
[submodule "external/CoMISo"]
path = external/CoMISo
url = https://github.com/libigl/CoMISo.git
[submodule "external/cork"]
path = external/cork
url = https://github.com/libigl/cork.git
[submodule "external/imgui"]
path = external/imgui/imgui
url = https://github.com/ocornut/imgui.git
[submodule "external/glfw"]
path = external/glfw
url = https://github.com/glfw/glfw.git
[submodule "external/eigen"]
path = external/eigen
url = https://github.com/eigenteam/eigen-git-mirror.git
[submodule "external/pybind11"]
path = external/pybind11
url = https://github.com/pybind/pybind11
-73
View File
@@ -1,73 +0,0 @@
dist: trusty
sudo: true
language: cpp
cache: ccache
matrix:
include:
- os: linux
compiler: gcc # 4.8.4 by default on Trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libmpfr-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-thread-dev
- libblas-dev
- liblapack-dev
- xorg-dev
- libglu1-mesa-dev
- python3-setuptools
- libpython3-dev
env:
- MATRIX_EVAL="export CONFIG=Debug && CHECK_UNDEFINED=ON && PYTHON=python3"
- os: linux
compiler: gcc-7
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-7
- g++-7
- libmpfr-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-thread-dev
- libblas-dev
- liblapack-dev
- xorg-dev
- libglu1-mesa-dev
- python3-setuptools
- libpython3-dev
env:
- MATRIX_EVAL="export CC=gcc-7 && CXX=g++-7 && CONFIG=Debug && CHECK_UNDEFINED=ON && PYTHON=python3"
- os: osx
compiler: clang
env:
- MATRIX_EVAL="export CONFIG=Debug && CHECK_UNDEFINED=ON && PYTHON=python3"
install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
- eval "${MATRIX_EVAL}"
- ccache --max-size=5.0G
- ccache -V && ccache --show-stats && ccache --zero-stats
script:
# Python bindings
- cd python
- ${PYTHON} setup.py develop --user -- -DCMAKE_BUILD_TYPE=${CONFIG} -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON -DCHECK_UNDEFINED=${CHECK_UNDEFINED}
- cd tutorial
- ${PYTHON} 101_FileIO.py
- cd ../../
- rm -rf python/build
# Tutorials
- cd tutorial
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=$CONFIG -DLIBIGL_USE_STATIC_LIBRARY=ON ../
- make -j 2
- ccache --show-stats
+74
View File
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.1)
# Toggles the use of the hunter package manager
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.171.tar.gz"
SHA1 "5d68bcca78eee347239ca5f4d34f4b6c12683154"
)
project(libigl)
# Detects whether this is a top-level project
get_directory_property(LIBIGL_PARENT_DIR PARENT_DIRECTORY)
if(NOT LIBIGL_PARENT_DIR)
set(LIBIGL_TOPLEVEL_PROJECT ON)
else()
set(LIBIGL_TOPLEVEL_PROJECT OFF)
endif()
# Build tests and tutorials
option(LIBIGL_BUILD_TESTS "Build libigl unit test" ${LIBIGL_TOPLEVEL_PROJECT})
option(LIBIGL_BUILD_TUTORIALS "Build libigl tutorial" ${LIBIGL_TOPLEVEL_PROJECT})
option(LIBIGL_EXPORT_TARGETS "Export libigl CMake targets" ${LIBIGL_TOPLEVEL_PROJECT})
# USE_STATIC_LIBRARY speeds up the generation of multiple binaries,
# at the cost of a longer initial compilation time
# (by default, static build is off since libigl is a header-only library)
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" ON)
# All dependencies that are downloaded as cmake projects and tested on the auto-builds are ON
# (by default, all build options are off)
option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
option(LIBIGL_WITH_EMBREE "Use Embree" ON)
option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
option(LIBIGL_WITH_PNG "Use PNG" ON)
option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
option(LIBIGL_WITH_PREDICATES "Use exact predicates" ON)
option(LIBIGL_WITH_XML "Use XML" ON)
option(LIBIGL_WITH_PYTHON "Use Python" OFF)
### End
if(${LIBIGL_WITH_PYTHON})
message(FATAL_ERROR "Python binding are in the process of being redone. Please use the master branch or refer to https://github.com/geometryprocessing/libigl-python-bindings for the developement version or https://anaconda.org/conda-forge/igl for the stable version.")
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
### conditionally compile certain modules depending on libraries found on the system
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
### Adding libIGL: choose the path to your local copy libIGL
include(libigl)
if(LIBIGL_BUILD_TUTORIALS)
add_subdirectory(tutorial)
endif()
if(LIBIGL_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
if(LIBIGL_TOPLEVEL_PROJECT)
# Set folders for Visual Studio/Xcode
igl_set_folders()
endif()
+5 -265
View File
@@ -1,268 +1,8 @@
# libigl - A simple C++ geometry processing library
[![Build Status](https://travis-ci.org/libigl/libigl.svg?branch=master)](https://travis-ci.org/libigl/libigl)
[![Build status](https://ci.appveyor.com/api/projects/status/mf3t9rnhco0vhly8/branch/master?svg=true)](https://ci.appveyor.com/project/danielepanozzo/libigl-6hjk1/branch/master)
![](https://github.com/libigl/libigl/raw/5ff6387765fa85ca46f1a6222728e35e2b8b8961/libigl-teaser.png)
[![](https://github.com/libigl/libigl/workflows/Build/badge.svg?event=push)](https://github.com/libigl/libigl/actions?query=workflow%3ABuild+branch%3Amaster+event%3Apush)
[![](https://github.com/libigl/libigl/workflows/Nightly/badge.svg)](https://github.com/libigl/libigl/actions?query=workflow%3ANightly+branch%3Amaster+event%3Aschedule)
[![](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://anaconda.org/conda-forge/igl)
<https://github.com/libigl/libigl/>
![](https://libigl.github.io/libigl-teaser.png)
> Get started with:
>
```bash
git clone --recursive https://github.com/libigl/libigl.git
```
libigl is a simple C++ geometry processing library. We have a wide
functionality including construction of sparse discrete differential geometry
operators and finite-elements matrices such as the cotangent Laplacian and
diagonalized mass matrix, simple facet and edge-based topology data structures,
mesh-viewing utilities for OpenGL and GLSL, and many core functions for matrix
manipulation which make [Eigen](http://eigen.tuxfamily.org) feel a lot more
like MATLAB.
It is **a header-only library**. You do not need to compile anything to use,
just include igl headers (e.g. `#include <igl/cotmatrix.h>`) and run. Each
header file contains a single function (e.g. `igl/cotmatrix.h` contains
`igl::cotmatrix()`). Most are tailored to operate on a generic triangle mesh
stored in an n-by-3 matrix of vertex positions `V` and an m-by-3 matrix of
triangle indices `F`.
_Optionally_ the library may also be [pre-compiled](http://libigl.github.io/libigl/static-library/) into a statically
linked library, for faster compile times with your projects. This only effects
compile time (run-time performance and behavior is identical). If in doubt, use
the header-only default mode: (i.e. just include the headers you want to use).
We use the [Eigen](http://eigen.tuxfamily.org) library heavily in our code. Our
group prototypes a lot in MATLAB, and we have a useful [MATLAB to libigl+Eigen
conversion table](matlab-to-eigen.html).
We regularly test compiling our library on Mac OS X with clang, Linux with gcc
and Windows with Visual Studio 2015 Community Edition.
## Tutorial
As of version 1.0, libigl includes an introductory
[tutorial](http://libigl.github.io/libigl/tutorial) that covers many functionalities.
## libigl Example Project
We provide a [blank project example](https://github.com/libigl/libigl-example-project) showing how to use libigl and cmake. Feel free and encouraged to copy or fork this project as a way of starting a new personal project using libigl.
## Coding Guidelines and Tips
libigl follows strict coding guidelines, please take a look [here](http://libigl.github.io/libigl/style-guidelines) before submitting your pull requests. We also have a set of [general coding tips](http://libigl.github.io/libigl/coding-guidelines) on how to code a geometry processing research project.
## Installation
Libigl is a **header-only** library. You do **not** need to build anything to
install. Simply add `libigl/include` to your include path and include relevant
headers. Here is a small "Hello, World" program:
```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;
}
```
If you save this in `hello.cpp`, then you could compile this with (assuming
Eigen is installed in `/usr/local/include/eigen3`):
```bash
g++ -std=c++11 -I/usr/local/include/eigen3 -I./libigl/include/ hello.cpp -o hello
```
Running `./hello` would then produce
```
Hello, mesh:
0.5 0.5
-0.5 0.5
-0.5 -0.5
0.5 -0.5
```
## Dependencies
Dependencies are on a per-include basis and the majority of the functions in
libigl depends only on the [Eigen](http://eigen.tuxfamily.org) library.
For more information see our [tutorial](http://libigl.github.io/libigl/tutorial).
### Optional Dependencies
Libigl compartmentalizes its **optional** dependences via its directory
organization in the `include/` folder. All header files located _directly_ in
the `include/igl/` folder have only stl and Eigen as dependencies. For example,
all of the headers that depend on CGAL are located in `include/igl/copyleft/cgal`.
For a full list of _optional_ dependencies check `optional/CMakeLists.txt`.
### GCC and the Optional CGAL Dependency
The `include/igl/copyleft/cgal/*.h` headers depend on CGAL. It has come to
our attention that CGAL does not work properly with GCC 4.8. To the best of
our knowledge, GCC 4.7 and clang will work correctly.
### OpenMP and Windows
Some of our functions will take advantage of OpenMP if available. However, it
has come to our attention that Visual Studio + Eigen + OpenMP does not work
properly. Since we use OpenMP only to improve performance, we recommend
avoiding OpenMP on Windows or proceeding with caution.
## Download
You can keep up to date by cloning a read-only copy of our GitHub
[repository](https://github.com/libigl).
## Known Issues
We rely heavily on Eigen. Nearly all inputs and outputs are Eigen matrices of
some kind. However, we currently _only_ officially support Eigen's default
column-major ordering. That means, we **do not** expect our code to work for
matrices using the `Eigen::RowMajor` flag. If you can, change definitions like:
```cpp
Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor> A;
```
to
```cpp
Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::ColMajor> A;
// or simply
Eigen::Matrix<double, Eigen::Dynamic, 3> A;
```
We hope to fix this, or at least identify which functions are safe (many of
them probably work just fine). This requires setting up unit testing, which is
a major _todo_ for our development.
## Git Submodules
Libigl uses git submodules for its _optional_ dependencies,
in particular, those needed by the OpenGL viewer to run the examples in the
[tutorial](http://libigl.github.io/libigl/tutorial). Git submodules allow use to treat clones of
other libraries as sub-directories within ours while separating our commits.
Read the [documentation](http://git-scm.com/docs/git-submodule) for a detailed
explanation, but essentially our libigl repo stores a hash for each of its
subrepos containing which version to update to. When a change is introduced in
a dependencies repo we can incorporate that change by pulling in our sub-repo
and updating (i.e. committing) that change to the hash.
When pulling new changes to libigl it's also a good idea to update changes to
subrepos:
```bash
git pull
git submodule update --recursive
```
## Unit Testing
Libigl maintains [separate
repository](https://github.com/libigl/libigl-unit-tests) for unit testing.
## How to Contribute
If you are interested in joining development, please fork the repository and
submit a [pull request](https://help.github.com/articles/using-pull-requests/)
with your changes. libigl follows strict coding guidelines, please take a look at our [style guidelines](http://libigl.github.io/libigl/style-guidelines) before submitting your pull requests.
## License
libigl is primarily [MPL2](http://www.mozilla.org/MPL/2.0/) licensed
([FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html)). Some files contain
third-party code under other licenses. We're currently in the processes of
identifying these and marking appropriately.
## Attribution
If you use libigl in your academic projects, please cite the papers we
implement as appropriate. To cite the library in general, you could use this
BibTeX entry:
```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 = {2017},
}
```
## Projects/Universities using libigl
Libigl is used by many research groups around the world. In 2015, it won the
Eurographics/ACM Symposium on Geometry Processing software award. Here are a
few labs/companies/institutions using libigl:
- [Activision](http://www.activision.com)
- [Adobe Research](http://www.adobe.com/technology/)
- [Electronic Arts, Inc](http://www.ea.com)
- [Epic Games](https://epicgames.com)
- [Google Research](https://research.google.com)
- [Industrial Light and Magic](http://ilm.com)
- [Mesh consultants](http://meshconsultants.ca/), Canada
- [Microsoft Research](https://www.microsoft.com/en-us/research/)
- [Pixar](http://graphics.pixar.com/research/)
- [Spine by Esoteric Software](http://esotericsoftware.com/) is an animation tool dedicated to 2D characters.
- [vvvv toolkit](http://vvvv.org) a multipurpose tookit
- Columbia University, [Columbia Computer Graphics Group](http://www.cs.columbia.edu/cg/), USA
- [Cornell University](http://www.graphics.cornell.edu/), USA
- [Czech Technical University in Prague](http://dcgi.felk.cvut.cz/), Czech
- EPF Lausanne, [Computer Graphics and Geometry Laboratory](http://lgg.epfl.ch/people.php), Switzerland
- ETH Zurich, [Interactive Geometry Lab](http://igl.ethz.ch/) and [Advanced Technologies Lab](http://ait.inf.ethz.ch/), Swizterland
- George Mason University, [CraGL](http://cs.gmu.edu/~ygingold/), USA
- [Hong Kong University of Science and Technology](http://www.ust.hk/), Hong Kong
- [Inria, Université Grenoble Alpes](https://www.inria.fr/centre/grenoble/), France
- [Jiangnan university](http://english.jiangnan.edu.cn), China
- [National Institute of Informatics](http://www.nii.ac.jp/en/), Japan
- New York University, [Media Research Lab](http://mrl.nyu.edu/), USA
- NYUPoly, [Game Innovation Lab](http://game.engineering.nyu.edu/), USA
- [TU Berlin](https://www.cg.tu-berlin.de), Germany
- [TU Delft](http://www.tudelft.nl/en/), Netherlands
- [TU Wien](https://www.tuwien.ac.at/en/tuwien_home/), Austria
- [Telecom ParisTech](http://www.telecom-paristech.fr/en/formation-et-innovation-dans-le-numerique.html), Paris, France
- [UBISOFT](https://www.ubisoft.com/en-us/), USA
- [Utrecht University](http://www.staff.science.uu.nl/~vaxma001/), The Netherlands
- [Universidade Federal de Santa Catarina](http://mtm.ufsc.br/~leo/), Brazil
- [University College London](http://vecg.cs.ucl.ac.uk/), England
- [University of California Berkeley](http://vis.berkeley.edu/), USA
- [University of Cambridge](http://www.cam.ac.uk/), England
- [University of Pennsylvania](http://cg.cis.upenn.edu/), USA
- [University of Texas at Austin](http://www.cs.utexas.edu/users/evouga/), USA
- [University of Toronto](http://dgp.toronto.edu), Canada
- [University of Victoria](https://www.csc.uvic.ca/Research/graphics/), Canada
- [University of Wisconsin-Eau Claire](http://www.uwec.edu/computer-science/), USA
- [Università della Svizzera Italiana](http://www.usi.ch/en), Switzerland
- [Université Toulouse III Paul Sabatier](http://www.univ-tlse3.fr/), France
- [Zhejiang University](http://www.math.zju.edu.cn/cagd/), China
## Contact
Libigl is a group endeavor led by [Alec
Jacobson](http://www.cs.toronto.edu/~jacobson/) and [Daniele
Panozzo](http://cs.nyu.edu/~panozzo/). Please [contact
us](mailto:alecjacobson@gmail.com,daniele.panozzo@gmail.com) if you have
questions or comments. For troubleshooting, please post an
[issue](https://github.com/libigl/libigl/issues) on github.
If you're using libigl in your projects, quickly [drop us a
note](mailto:alecjacobson@gmail.com,daniele.panozzo@gmail.com). Tell us who you
are and what you're using it for. This helps us apply for funding and justify
spending time maintaining this.
If you find bugs or have problems please use our [github issue tracking
page](https://github.com/libigl/libigl/issues).
## Copyright
2017 Alec Jacobson, Daniele Panozzo, Christian Schüller, Olga Diamanti, Qingnan Zhou, Sebastian Koch, Jeremie Dumas, Amir Vaxman, Nico Pietroni, Stefan Brugger, Kenshi Takayama, Wenzel Jakob, Nikolas De Giorgis, Luigi Rocca, Leonardo Sacht, Kevin Walliman, Olga Sorkine-Hornung, and others.
Please see individual files for appropriate copyright notices.
Documentation, tutorial, and instructions at <https://libigl.github.io>.
-6
View File
@@ -1,6 +0,0 @@
# This file should contain the current version number of libigl
# World.Major.Minor
# Anyone may increment Minor to indicate a small change.
# Major indicates a large change or large number of changes (upload to website)
# World indicates a substantial change or release
1.2.1
@@ -1,7 +1,7 @@
# Distributed under the OSI-approved MIT License. See accompanying
# file LICENSE or https://github.com/Crascit/DownloadProject for details.
cmake_minimum_required(VERSION 2.8.2)
cmake_minimum_required(VERSION 3.1)
project(${DL_ARGS_PROJ}-download NONE)
File diff suppressed because it is too large Load Diff
@@ -9,8 +9,10 @@
# Hardcoded search paths
set(SEARCH_PATHS
${CMAKE_SOURCE_DIR}/mosek/9.2/tools/platform/osx64x86/
/usr/local/mosek/7/tools/platform/osx64x86/
/usr/local/mosek/8/tools/platform/osx64x86/
/usr/local/mosek/9.2/tools/platform/osx64x86/
/opt/mosek/7/tools/platform/linux64x86/
)
+540
View File
@@ -0,0 +1,540 @@
# Copyright (c) 2013-2018, Ruslan Baratov
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This is a gate file to Hunter package manager.
# Include this file using `include` command and add package you need, example:
#
# cmake_minimum_required(VERSION 3.2)
#
# include("cmake/HunterGate.cmake")
# HunterGate(
# URL "https://github.com/path/to/hunter/archive.tar.gz"
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
# )
#
# project(MyProject)
#
# hunter_add_package(Foo)
# hunter_add_package(Boo COMPONENTS Bar Baz)
#
# Projects:
# * https://github.com/hunter-packages/gate/
# * https://github.com/ruslo/hunter
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
if(HUNTER_ENABLED)
if(CMAKE_VERSION VERSION_LESS "3.2")
message(
FATAL_ERROR
"At least CMake version 3.2 required for Hunter dependency management."
" Update CMake or set HUNTER_ENABLED to OFF."
)
endif()
endif()
include(CMakeParseArguments) # cmake_parse_arguments
option(HUNTER_STATUS_PRINT "Print working status" ON)
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON)
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
function(hunter_gate_status_print)
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
foreach(print_message ${ARGV})
message(STATUS "[hunter] ${print_message}")
endforeach()
endif()
endfunction()
function(hunter_gate_status_debug)
if(HUNTER_STATUS_DEBUG)
foreach(print_message ${ARGV})
string(TIMESTAMP timestamp)
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
endforeach()
endif()
endfunction()
function(hunter_gate_wiki wiki_page)
message("------------------------------ WIKI -------------------------------")
message(" ${HUNTER_WIKI}/${wiki_page}")
message("-------------------------------------------------------------------")
message("")
message(FATAL_ERROR "")
endfunction()
function(hunter_gate_internal_error)
message("")
foreach(print_message ${ARGV})
message("[hunter ** INTERNAL **] ${print_message}")
endforeach()
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("error.internal")
endfunction()
function(hunter_gate_fatal_error)
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
if(have_no_wiki)
hunter_gate_internal_error("Expected wiki")
endif()
message("")
foreach(x ${hunter_UNPARSED_ARGUMENTS})
message("[hunter ** FATAL ERROR **] ${x}")
endforeach()
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
message("")
hunter_gate_wiki("${hunter_WIKI}")
endfunction()
function(hunter_gate_user_error)
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
endfunction()
function(hunter_gate_self root version sha1 result)
string(COMPARE EQUAL "${root}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("root is empty")
endif()
string(COMPARE EQUAL "${version}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("version is empty")
endif()
string(COMPARE EQUAL "${sha1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("sha1 is empty")
endif()
string(SUBSTRING "${sha1}" 0 7 archive_id)
if(EXISTS "${root}/cmake/Hunter")
set(hunter_self "${root}")
else()
set(
hunter_self
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
)
endif()
set("${result}" "${hunter_self}" PARENT_SCOPE)
endfunction()
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
function(hunter_gate_detect_root)
# Check CMake variable
string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
return()
endif()
# Check environment variable
string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty)
if(not_empty)
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
return()
endif()
# Check HOME environment variable
string(COMPARE NOTEQUAL "$ENV{HOME}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
return()
endif()
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
if(WIN32)
string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
)
return()
endif()
string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result)
if(result)
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
hunter_gate_status_debug(
"HUNTER_ROOT set using USERPROFILE environment variable"
)
return()
endif()
endif()
hunter_gate_fatal_error(
"Can't detect HUNTER_ROOT"
WIKI "error.detect.hunter.root"
)
endfunction()
function(hunter_gate_download dir)
string(
COMPARE
NOTEQUAL
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
""
disable_autoinstall
)
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
hunter_gate_fatal_error(
"Hunter not found in '${dir}'"
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
"Settings:"
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
WIKI "error.run.install"
)
endif()
string(COMPARE EQUAL "${dir}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("Empty 'dir' argument")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
endif()
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
if(is_bad)
hunter_gate_internal_error("HUNTER_GATE_URL empty")
endif()
set(done_location "${dir}/DONE")
set(sha1_location "${dir}/SHA1")
set(build_dir "${dir}/Build")
set(cmakelists "${dir}/CMakeLists.txt")
hunter_gate_status_debug("Locking directory: ${dir}")
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
hunter_gate_status_debug("Lock done")
if(EXISTS "${done_location}")
# while waiting for lock other instance can do all the job
hunter_gate_status_debug("File '${done_location}' found, skip install")
return()
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
# Disabling languages speeds up a little bit, reduces noise in the output
# and avoids path too long windows error
file(
WRITE
"${cmakelists}"
"cmake_minimum_required(VERSION 3.2)\n"
"project(HunterDownload LANGUAGES NONE)\n"
"include(ExternalProject)\n"
"ExternalProject_Add(\n"
" Hunter\n"
" URL\n"
" \"${HUNTER_GATE_URL}\"\n"
" URL_HASH\n"
" SHA1=${HUNTER_GATE_SHA1}\n"
" DOWNLOAD_DIR\n"
" \"${dir}\"\n"
" TLS_VERIFY\n"
" ${HUNTER_TLS_VERIFY}\n"
" SOURCE_DIR\n"
" \"${dir}/Unpacked\"\n"
" CONFIGURE_COMMAND\n"
" \"\"\n"
" BUILD_COMMAND\n"
" \"\"\n"
" INSTALL_COMMAND\n"
" \"\"\n"
")\n"
)
if(HUNTER_STATUS_DEBUG)
set(logging_params "")
else()
set(logging_params OUTPUT_QUIET)
endif()
hunter_gate_status_debug("Run generate")
# Need to add toolchain file too.
# Otherwise on Visual Studio + MDD this will fail with error:
# "Could not find an appropriate version of the Windows 10 SDK installed on this machine"
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}")
else()
# 'toolchain_arg' can't be empty
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=")
endif()
string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make)
if(no_make)
set(make_arg "")
else()
# Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM
set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
endif()
execute_process(
COMMAND
"${CMAKE_COMMAND}"
"-H${dir}"
"-B${build_dir}"
"-G${CMAKE_GENERATOR}"
"${toolchain_arg}"
${make_arg}
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error(
"Configure project failed."
"To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}"
"In directory ${dir}"
)
endif()
hunter_gate_status_print(
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
" ${HUNTER_GATE_URL}"
" -> ${dir}"
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
WORKING_DIRECTORY "${dir}"
RESULT_VARIABLE download_result
${logging_params}
)
if(NOT download_result EQUAL 0)
hunter_gate_internal_error("Build project failed")
endif()
file(REMOVE_RECURSE "${build_dir}")
file(REMOVE_RECURSE "${cmakelists}")
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
file(WRITE "${done_location}" "DONE")
hunter_gate_status_debug("Finished")
endfunction()
# Must be a macro so master file 'cmake/Hunter' can
# apply all variables easily just by 'include' command
# (otherwise PARENT_SCOPE magic needed)
macro(HunterGate)
if(HUNTER_GATE_DONE)
# variable HUNTER_GATE_DONE set explicitly for external project
# (see `hunter_download`)
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
# First HunterGate command will init Hunter, others will be ignored
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
if(NOT HUNTER_ENABLED)
# Empty function to avoid error "unknown function"
function(hunter_add_package)
endfunction()
set(
_hunter_gate_disabled_mode_dir
"${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode"
)
if(EXISTS "${_hunter_gate_disabled_mode_dir}")
hunter_gate_status_debug(
"Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}"
)
list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}")
endif()
elseif(_hunter_gate_done)
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
hunter_gate_self(
"${HUNTER_CACHED_ROOT}"
"${HUNTER_VERSION}"
"${HUNTER_SHA1}"
_hunter_self
)
include("${_hunter_self}/cmake/Hunter")
else()
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}")
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
if(_have_project_name)
hunter_gate_fatal_error(
"Please set HunterGate *before* 'project' command. "
"Detected project: ${PROJECT_NAME}"
WIKI "error.huntergate.before.project"
)
endif()
cmake_parse_arguments(
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
)
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
string(
COMPARE
NOTEQUAL
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
""
_have_unparsed
)
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
if(_have_unparsed)
hunter_gate_user_error(
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
)
endif()
if(_empty_sha1)
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
endif()
if(_empty_url)
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
endif()
if(_have_global)
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
endif()
endif()
if(HUNTER_GATE_LOCAL)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
endif()
if(_have_filepath)
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
endif()
endif()
if(_have_filepath)
if(_have_global)
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
endif()
if(HUNTER_GATE_LOCAL)
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
endif()
endif()
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
# Beautify path, fix probable problems with windows path slashes
get_filename_component(
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
)
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
if(NOT _contain_spaces EQUAL -1)
hunter_gate_fatal_error(
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
"(Use at your own risk!)"
WIKI "error.spaces.in.hunter.root"
)
endif()
endif()
string(
REGEX
MATCH
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
HUNTER_GATE_VERSION
"${HUNTER_GATE_URL}"
)
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
if(_is_empty)
set(HUNTER_GATE_VERSION "unknown")
endif()
hunter_gate_self(
"${HUNTER_GATE_ROOT}"
"${HUNTER_GATE_VERSION}"
"${HUNTER_GATE_SHA1}"
_hunter_self
)
set(_master_location "${_hunter_self}/cmake/Hunter")
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
# Hunter downloaded manually (e.g. by 'git clone')
set(_unused "xxxxxxxxxx")
set(HUNTER_GATE_SHA1 "${_unused}")
set(HUNTER_GATE_VERSION "${_unused}")
else()
get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE)
set(_done_location "${_archive_id_location}/DONE")
set(_sha1_location "${_archive_id_location}/SHA1")
# Check Hunter already downloaded by HunterGate
if(NOT EXISTS "${_done_location}")
hunter_gate_download("${_archive_id_location}")
endif()
if(NOT EXISTS "${_done_location}")
hunter_gate_internal_error("hunter_gate_download failed")
endif()
if(NOT EXISTS "${_sha1_location}")
hunter_gate_internal_error("${_sha1_location} not found")
endif()
file(READ "${_sha1_location}" _sha1_value)
string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal)
if(NOT _is_equal)
hunter_gate_internal_error(
"Short SHA1 collision:"
" ${_sha1_value} (from ${_sha1_location})"
" ${HUNTER_GATE_SHA1} (HunterGate)"
)
endif()
if(NOT EXISTS "${_master_location}")
hunter_gate_user_error(
"Master file not found:"
" ${_master_location}"
"try to update Hunter/HunterGate"
)
endif()
endif()
include("${_master_location}")
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
endif()
endmacro()
+198
View File
@@ -0,0 +1,198 @@
################################################################################
include(DownloadProject)
# With CMake 3.8 and above, we can hide warnings about git being in a
# detached head by passing an extra GIT_CONFIG option.
set(LIBIGL_EXTRA_OPTIONS TLS_VERIFY OFF)
if(NOT (${CMAKE_VERSION} VERSION_LESS "3.8.0"))
list(APPEND LIBIGL_EXTRA_OPTIONS GIT_CONFIG advice.detachedHead=false)
endif()
# On CMake 3.6.3 and above, there is an option to use shallow clones of git repositories.
# The shallow clone option only works with real tags, not SHA1, so we use a separate option.
set(LIBIGL_BRANCH_OPTIONS)
if(NOT (${CMAKE_VERSION} VERSION_LESS "3.6.3"))
# Disabled for now until we can make sure that it has no adverse effects
# (Downside is that the eigen mirror is huge again)
# list(APPEND LIBIGL_BRANCH_OPTIONS GIT_SHALLOW 1)
endif()
option(LIBIGL_SKIP_DOWNLOAD "Skip downloading external libraries" OFF)
# Shortcut functions
function(igl_download_project_aux name source)
if(NOT LIBIGL_SKIP_DOWNLOAD)
download_project(
PROJ ${name}
SOURCE_DIR "${source}"
DOWNLOAD_DIR "${LIBIGL_EXTERNAL}/.cache/${name}"
QUIET
${LIBIGL_EXTRA_OPTIONS}
${ARGN}
)
endif()
endfunction()
function(igl_download_project name)
igl_download_project_aux(${name} "${LIBIGL_EXTERNAL}/${name}" ${ARGN})
endfunction()
################################################################################
## CGAL
function(igl_download_cgal)
igl_download_project(cgal
GIT_REPOSITORY https://github.com/CGAL/cgal.git
GIT_TAG v5.2
)
endfunction()
## CoMISo
function(igl_download_comiso)
igl_download_project(CoMISo
GIT_REPOSITORY https://github.com/libigl/CoMISo.git
GIT_TAG d60aa4759fba76b0b793b1efb090b7a771dd7c56
)
endfunction()
## Cork
function(igl_download_cork)
igl_download_project(cork
GIT_REPOSITORY https://github.com/libigl/cork.git
GIT_TAG 27ad8a285838f5a480d856429e39d3d56d4338f9
)
endfunction()
## Eigen
set(LIBIGL_EIGEN_VERSION 3.3.7 CACHE STRING "Default version of Eigen used by libigl.")
function(igl_download_eigen)
igl_download_project(eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG ${LIBIGL_EIGEN_VERSION}
${LIBIGL_BRANCH_OPTIONS}
)
endfunction()
## Embree
function(igl_download_embree)
igl_download_project(embree
GIT_REPOSITORY https://github.com/embree/embree.git
GIT_TAG v3.12.1
${LIBIGL_BRANCH_OPTIONS}
)
endfunction()
## glad
function(igl_download_glad)
igl_download_project(glad
GIT_REPOSITORY https://github.com/libigl/libigl-glad.git
GIT_TAG 09b4969c56779f7ddf8e6176ec1873184aec890f
)
endfunction()
## GLFW
function(igl_download_glfw)
igl_download_project(glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3327050ca66ad34426a82c217c2d60ced61526b7
${LIBIGL_BRANCH_OPTIONS}
)
endfunction()
## ImGui
function(igl_download_imgui)
igl_download_project(imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.76
${LIBIGL_BRANCH_OPTIONS}
)
igl_download_project(libigl-imgui
GIT_REPOSITORY https://github.com/libigl/libigl-imgui.git
GIT_TAG 99f0643089b19f6daf5b3efd9544a65c9a851966
)
endfunction()
## ImGuizmo
function(igl_download_imguizmo)
igl_download_project(imguizmo
GIT_REPOSITORY https://github.com/CedricGuillemet/ImGuizmo.git
GIT_TAG a23567269f6617342bcc112394bdad937b54b2d7
${LIBIGL_BRANCH_OPTIONS}
)
endfunction()
## pybind11
function(igl_download_pybind11)
igl_download_project(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG 2d0507db43cd5a117f7843e053b17dffca114107
)
endfunction()
## stb_image
function(igl_download_stb)
igl_download_project(stb
GIT_REPOSITORY https://github.com/libigl/libigl-stb.git
GIT_TAG cd0fa3fcd90325c83be4d697b00214e029f94ca3
)
endfunction()
## TetGen
function(igl_download_tetgen)
igl_download_project(tetgen
GIT_REPOSITORY https://github.com/jdumas/tetgen.git
GIT_TAG c63e7a6434652b8a2065c835bd9d6d298db1a0bc
)
endfunction()
## TinyXML
function(igl_download_tinyxml2)
igl_download_project(tinyxml2
GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
GIT_TAG d175e9de0be0d4db75d0a8cf065599a435a87eb6
)
endfunction()
## Triangle
function(igl_download_triangle)
igl_download_project(triangle
GIT_REPOSITORY https://github.com/libigl/triangle.git
GIT_TAG 5a70326574b34d6a51d9eaf6a9f78813657ee108
)
endfunction()
## Catch2
function(igl_download_catch2)
igl_download_project(catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.11.0
)
endfunction()
## Predicates
function(igl_download_predicates)
igl_download_project(predicates
GIT_REPOSITORY https://github.com/libigl/libigl-predicates.git
GIT_TAG 488242fa2b1f98a9c5bd1441297fb4a99a6a9ae4
)
endfunction()
################################################################################
## Test data
function(igl_download_test_data)
igl_download_project_aux(test_data
"${LIBIGL_EXTERNAL}/../tests/data"
GIT_REPOSITORY https://github.com/libigl/libigl-tests-data
GIT_TAG 19cedf96d70702d8b3a83eb27934780c542356fe
)
endfunction()
## Tutorial data
function(igl_download_tutorial_data)
igl_download_project_aux(tutorial_data
"${LIBIGL_EXTERNAL}/../tutorial/data"
GIT_REPOSITORY https://github.com/libigl/libigl-tutorial-data
GIT_TAG c1f9ede366d02e3531ecbaec5e3769312f31cccd
)
endfunction()
+118
View File
@@ -0,0 +1,118 @@
# Sort projects inside the solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
function(igl_folder_targets FOLDER_NAME)
foreach(target IN ITEMS ${ARGN})
if(TARGET ${target})
get_target_property(TYPE ${target} TYPE)
if(NOT (TYPE STREQUAL "INTERFACE_LIBRARY"))
set_target_properties(${target} PROPERTIES FOLDER "${FOLDER_NAME}")
endif()
endif()
endforeach()
endfunction()
function(igl_set_folders)
igl_folder_targets("ThirdParty/Embree"
algorithms
embree
lexers
math
simd
sys
tasking
)
igl_folder_targets("ThirdParty"
CoMISo
glad
glfw
imgui
predicates
tetgen
tinyxml2
triangle
)
igl_folder_targets("Libigl"
igl
igl_comiso
igl_embree
igl_opengl
igl_opengl_glfw
igl_opengl_glfw_imgui
igl_png
igl_predicates
igl_stb_image
igl_tetgen
igl_triangle
igl_xml
)
igl_folder_targets("Unit Tests"
libigl_tests
)
igl_folder_targets("Tutorials"
101_FileIO_bin
102_DrawMesh_bin
103_Events_bin
104_Colors_bin
105_Overlays_bin
106_ViewerMenu_bin
107_MultipleMeshes_bin
108_MultipleViews_bin
201_Normals_bin
202_GaussianCurvature_bin
203_CurvatureDirections_bin
204_Gradient_bin
205_Laplacian_bin
206_GeodesicDistance_bin
301_Slice_bin
302_Sort_bin
303_LaplaceEquation_bin
304_LinearEqualityConstraints_bin
305_QuadraticProgramming_bin
306_EigenDecomposition_bin
401_BiharmonicDeformation_bin
402_PolyharmonicDeformation_bin
403_BoundedBiharmonicWeights_bin
404_DualQuaternionSkinning_bin
405_AsRigidAsPossible_bin
406_FastAutomaticSkinningTransformations_bin
407_BiharmonicCoordinates_bin
408_DirectDeltaMush_bin
501_HarmonicParam_bin
502_LSCMParam_bin
503_ARAPParam_bin
504_NRosyDesign_bin
505_MIQ_bin
506_FrameField_bin
507_Planarization_bin
601_Serialization_bin
604_Triangle_bin
605_Tetgen_bin
606_AmbientOcclusion_bin
607_ScreenCapture_bin
701_Statistics_bin
702_WindingNumber_bin
703_Decimation_bin
704_SignedDistance_bin
705_MarchingCubes_bin
706_FacetOrientation_bin
707_SweptVolume_bin
708_Picking_bin
709_SLIM_bin
710_SCAF_bin
711_Subdivision_bin
712_DataSmoothing_bin
713_ShapeUp_bin
714_MarchingTets_bin
715_MeshImplicitFunction_bin
716_HeatGeodesics_bin
718_IterativeClosestPoint_bin
719_ExplodedView_bin
)
endfunction()
+26
View File
@@ -0,0 +1,26 @@
if(MSVC)
option(IGL_STATIC_RUNTIME "Use libigl with the static MSVC runtime." OFF)
if(IGL_STATIC_RUNTIME)
message(STATUS "MSVC -> forcing use of statically-linked runtime.")
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
string(REPLACE /MD /MT CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
string(REPLACE /MD /MT CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
endforeach()
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
else()
message(STATUS "MSVC -> forcing use of dynamically-linked runtime.")
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
string(REPLACE /MT /MD CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
string(REPLACE /MT /MD CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
endforeach()
string(REPLACE "/MTd" "/MDd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# https://github.com/mozilla/sccache/issues/242
if(CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache")
string(REGEX REPLACE "/Z[iI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7")
endif()
endif()
+151
View File
@@ -0,0 +1,151 @@
# OS X requires a Mach-O dynamic library to have a baked "install name", that is used by other modules to link to it. Depending
# on how the library is built, the install name is not always an absolute path, nor necessarily the same as the name of the
# library file itself. This macro takes as input the name of a target, and a list of libraries that it links to (the output of
# FIND_PACKAGE or FIND_LIBRARY calls), and generates a set of custom, post-build commands that, for each linked dylib, changes
# the name the target uses to refer to it with a fully-qualified (absolute) version of the library's own install name. This
# helps ensure that the target can be used from any location while still being able to locate the linked dynamic libraries.
#
# Note that this script does NOT handle the case when a linked library itself refers to another library using a non-absolute
# name (Boost is a notorious example). To avoid such issues, it is recommended to use a static library instead of a shared one
# in a non-standard location. Alternatively, set DYLD_LIBRARY_PATH to include these non-standard locations when running the
# program (not recommended).
#
# Author: Siddhartha Chaudhuri, 2009.
#
# Set the minimum required CMake version
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# See cmake --help-policy CMP0011 for details on this one
IF(POLICY CMP0011)
CMAKE_POLICY(SET CMP0011 NEW)
ENDIF(POLICY CMP0011)
# See cmake --help-policy CMP0026 for details on this one
IF(POLICY CMP0026)
CMAKE_POLICY(SET CMP0026 NEW)
ENDIF(POLICY CMP0026)
# See cmake --help-policy CMP0045 for details on this one
IF(POLICY CMP0045)
CMAKE_POLICY(SET CMP0045 NEW)
ENDIF(POLICY CMP0045)
MACRO(OSX_FIX_DYLIB_REFERENCES target libraries)
IF(APPLE)
SET(OFIN_${target}_RPATHS )
FOREACH(OFIN_${target}_Library ${libraries})
IF(${OFIN_${target}_Library} MATCHES "[.]dylib$"
OR ${OFIN_${target}_Library} MATCHES "[.]framework/.+")
# Resolve symlinks and get absolute location
GET_FILENAME_COMPONENT(OFIN_${target}_LibraryAbsolute ${OFIN_${target}_Library} ABSOLUTE)
# Get the baked install name of the library
EXECUTE_PROCESS(COMMAND otool -D ${OFIN_${target}_LibraryAbsolute}
OUTPUT_VARIABLE OFIN_${target}_LibraryInstallNameOutput
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "[\r\n]" " " OFIN_${target}_LibraryInstallNameOutput ${OFIN_${target}_LibraryInstallNameOutput})
SEPARATE_ARGUMENTS(OFIN_${target}_LibraryInstallNameOutput)
LIST(GET OFIN_${target}_LibraryInstallNameOutput 1 OFIN_${target}_LibraryInstallName)
IF(${OFIN_${target}_LibraryInstallName} MATCHES "^[@]rpath/")
# Ideally, we want to eliminate the longest common suffix of the install name and the absolute path. Whatever's left
# will be the desired rpath. But this is difficult to do (especially if there are naming variations, e.g.
# "Versions/Current" vs "Versions/5" is a common culprit). So we'll add various candidate rpaths and hope at least one
# is correct.
# Typically, the rpath to a library within a framework looks like this:
# @rpath/A.framework/Versions/5/libFoo.dylib
#
# Hence, we'll extract for the path unit immediately following the @rpath (in this case A.framework) and then look for
# it in the library's actual path. Everything before this location will be put in the rpath.
SET(OFIN_${target}_PathPrefix ${OFIN_${target}_LibraryInstallName})
SET(OFIN_${target}_RpathFirstChild )
WHILE(NOT OFIN_${target}_PathPrefix STREQUAL "@rpath")
GET_FILENAME_COMPONENT(OFIN_${target}_RpathFirstChild ${OFIN_${target}_PathPrefix} NAME)
GET_FILENAME_COMPONENT(OFIN_${target}_PathPrefix ${OFIN_${target}_PathPrefix} PATH)
IF(NOT OFIN_${target}_PathPrefix) # should never happen but just in case
BREAK()
ENDIF(NOT OFIN_${target}_PathPrefix)
IF(OFIN_${target}_PathPrefix STREQUAL "/") # should never happen but just in case
BREAK()
ENDIF(OFIN_${target}_PathPrefix STREQUAL "/")
ENDWHILE(NOT OFIN_${target}_PathPrefix STREQUAL "@rpath")
IF(OFIN_${target}_RpathFirstChild)
SET(OFIN_${target}_PathPrefix ${OFIN_${target}_LibraryAbsolute})
SET(OFIN_${target}_PathUnit )
WHILE(NOT OFIN_${target}_PathUnit STREQUAL ${OFIN_${target}_RpathFirstChild})
GET_FILENAME_COMPONENT(OFIN_${target}_PathUnit ${OFIN_${target}_PathPrefix} NAME)
GET_FILENAME_COMPONENT(OFIN_${target}_PathPrefix ${OFIN_${target}_PathPrefix} PATH)
IF(NOT OFIN_${target}_PathPrefix)
BREAK()
ENDIF(NOT OFIN_${target}_PathPrefix)
IF(OFIN_${target}_PathPrefix STREQUAL "/")
BREAK()
ENDIF(OFIN_${target}_PathPrefix STREQUAL "/")
ENDWHILE(NOT OFIN_${target}_PathUnit STREQUAL ${OFIN_${target}_RpathFirstChild})
IF(OFIN_${target}_PathPrefix)
SET(OFIN_${target}_RPATHS ${OFIN_${target}_RPATHS} "${OFIN_${target}_PathPrefix}")
ENDIF(OFIN_${target}_PathPrefix)
ENDIF(OFIN_${target}_RpathFirstChild)
# Add the directory containing the library
GET_FILENAME_COMPONENT(OFIN_${target}_LibraryAbsolutePath ${OFIN_${target}_LibraryAbsolute} PATH)
SET(OFIN_${target}_RPATHS ${OFIN_${target}_RPATHS} "${OFIN_${target}_LibraryAbsolutePath}")
# Add paths specified as library search prefixes
FOREACH(prefix ${CMAKE_PREFIX_PATH})
SET(OFIN_${target}_RPATHS ${OFIN_${target}_RPATHS} "${CMAKE_PREFIX_PATH}")
SET(OFIN_${target}_RPATHS ${OFIN_${target}_RPATHS} "${CMAKE_PREFIX_PATH}/lib")
ENDFOREACH()
ELSEIF(NOT ${OFIN_${target}_LibraryInstallName} MATCHES "^[@/]") # just a relative path
# Replace the unqualified filename, if it appears, with the absolute location, either by directly changing the path or
# by editing the rpath
# -- handle the case when the actual filename is baked in
GET_FILENAME_COMPONENT(OFIN_${target}_LibraryFilename ${OFIN_${target}_LibraryAbsolute} NAME)
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
COMMAND install_name_tool
ARGS -change
${OFIN_${target}_LibraryFilename}
${OFIN_${target}_LibraryAbsolute}
$<TARGET_FILE:${target}>)
# -- handle the case when the install name is baked in
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
COMMAND install_name_tool
ARGS -change
${OFIN_${target}_LibraryInstallName}
${OFIN_${target}_LibraryAbsolute}
$<TARGET_FILE:${target}>)
ENDIF()
ENDIF()
ENDFOREACH(OFIN_${target}_Library)
# Add the collected rpaths
IF(OFIN_${target}_RPATHS)
LIST(REMOVE_DUPLICATES OFIN_${target}_RPATHS)
FOREACH(rpath ${OFIN_${target}_RPATHS})
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
COMMAND bash
ARGS -c "install_name_tool -add_rpath '${rpath}' '$<TARGET_FILE:${target}>' > /dev/null 2>&1 || true"
VERBATIM)
ENDFOREACH()
ENDIF()
ENDIF()
ENDMACRO(OSX_FIX_DYLIB_REFERENCES)
+8
View File
@@ -0,0 +1,8 @@
# This is a conda environment that can be used to compile libigl with CGAL on Windows
# Only boost is required to be installed on the system, CGAL is automatically downloaded
# by CMake and is built with libigl.
name: libigl-cgal
channels:
- conda-forge
dependencies:
- boost-cpp=1.65.0
+31
View File
@@ -0,0 +1,31 @@
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/libigl-export.cmake)
# Check if Eigen3 target is avaiable, if not try to locate it
# with find_package.
message(STATUS "[libigl] Looking for Eigen3")
if (NOT TARGET Eigen3::Eigen)
# Try if Eigen3 can be found with find_package
find_package(Eigen3 CONFIG REQUIRED)
endif()
if (TARGET igl::core)
if (TARGET Eigen3::Eigen)
# Inject dependency
set_target_properties(igl::core PROPERTIES INTERFACE_LINK_LIBRARIES Eigen3::Eigen)
set(libigl_core_FOUND TRUE)
endif()
endif()
if (TARGET igl::common)
if (TARGET Eigen3::Eigen)
# Inject dependency
set_target_properties(igl::common PROPERTIES INTERFACE_LINK_LIBRARIES Eigen3::Eigen)
set(libigl_common_FOUND TRUE)
endif()
endif()
check_required_components(libigl)
+258 -115
View File
@@ -11,48 +11,40 @@ if(APPLE)
message(STATUS "Found libtool - ${CMAKE_LIBTOOL}")
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach(lang ${languages})
# Added -c
# Added -c
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
"${CMAKE_LIBTOOL} -c -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
endforeach()
endif()
endif()
### Find packages to populate default options ###
#
# COMPONENTS should match subsequent calls
find_package(Matlab COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY) # --> Matlab_FOUND
find_package(MOSEK) # --> MOSEK_FOUND
find_package(OpenGL) # --> OPENGL_FOUND
### Available options ###
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" ON)
option(LIBIGL_WITH_ANTTWEAKBAR "Use AntTweakBar" OFF)
option(LIBIGL_WITH_CGAL "Use CGAL" ON)
option(LIBIGL_WITH_COMISO "Use CoMiso" ON)
option(LIBIGL_WITH_CORK "Use Cork" OFF)
option(LIBIGL_WITH_EMBREE "Use Embree" OFF)
option(LIBIGL_WITH_LIM "Use LIM" ON)
option(LIBIGL_WITH_MATLAB "Use Matlab" "${Matlab_FOUND}")
option(LIBIGL_WITH_MOSEK "Use MOSEK" "${MOSEK_FOUND}")
option(LIBIGL_WITH_OPENGL "Use OpenGL" "${OPENGL_FOUND}")
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" "${OPENGL_FOUND}")
option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" OFF)
option(LIBIGL_WITH_PNG "Use PNG" ON)
option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON)
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" "${OPENGL_FOUND}")
option(LIBIGL_WITH_XML "Use XML" ON)
option(LIBIGL_WITH_PYTHON "Use Python" OFF)
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
option(LIBIGL_WITH_CGAL "Use CGAL" OFF)
option(LIBIGL_WITH_COMISO "Use CoMiso" OFF)
option(LIBIGL_WITH_CORK "Use Cork" OFF)
option(LIBIGL_WITH_EMBREE "Use Embree" OFF)
option(LIBIGL_WITH_MATLAB "Use Matlab" OFF)
option(LIBIGL_WITH_MOSEK "Use MOSEK" OFF)
option(LIBIGL_WITH_OPENGL "Use OpenGL" OFF)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" OFF)
option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" OFF)
option(LIBIGL_WITH_PNG "Use PNG" OFF)
option(LIBIGL_WITH_TETGEN "Use Tetgen" OFF)
option(LIBIGL_WITH_TRIANGLE "Use Triangle" OFF)
option(LIBIGL_WITH_PREDICATES "Use exact predicates" OFF)
option(LIBIGL_WITH_XML "Use XML" OFF)
option(LIBIGL_WITHOUT_COPYLEFT "Disable Copyleft libraries" OFF)
option(LIBIGL_EXPORT_TARGETS "Export libigl CMake targets" OFF)
if(LIBIGL_WITH_VIEWER AND (NOT LIBIGL_WITH_OPENGL_GLFW OR NOT LIBIGL_WITH_OPENGL) )
message(FATAL_ERROR "LIBIGL_WITH_VIEWER=ON requires LIBIGL_WITH_OPENGL_GLFW=ON and LIBIGL_WITH_OPENGL=ON")
if(LIBIGL_BUILD_PYTHON)
message(FATAL_ERROR "Python bindings have been removed in this version. Please use an older version of libigl, or wait for the new bindings to be released.")
endif()
################################################################################
### Configuration
set(LIBIGL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")
set(LIBIGL_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
set(LIBIGL_SOURCE_DIR "${LIBIGL_ROOT}/include")
set(LIBIGL_EXTERNAL "${LIBIGL_ROOT}/external")
@@ -63,12 +55,24 @@ else()
set(IGL_SCOPE INTERFACE)
endif()
# Download and update 3rdparty libraries
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(LibiglDownloadExternal)
# Provides igl_set_folders() to set folders for Visual Studio/Xcode
include(LibiglFolders)
################################################################################
### IGL Common
################################################################################
add_library(igl_common INTERFACE)
target_include_directories(igl_common SYSTEM INTERFACE ${LIBIGL_SOURCE_DIR})
target_include_directories(igl_common SYSTEM INTERFACE
$<BUILD_INTERFACE:${LIBIGL_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
# Export igl_common as igl::common
set_property(TARGET igl_common PROPERTY EXPORT_NAME igl::common)
if(LIBIGL_USE_STATIC_LIBRARY)
target_compile_definitions(igl_common INTERFACE -DIGL_STATIC_LIBRARY)
endif()
@@ -81,41 +85,46 @@ target_compile_features(igl_common INTERFACE ${CXX11_FEATURES})
if(MSVC)
# Enable parallel compilation for Visual Studio
target_compile_options(igl_common INTERFACE /MP /bigobj)
target_compile_definitions(igl_common INTERFACE -DNOMINMAX)
endif()
# Controls whether to use the static MSVC runtime or not
include(LibiglWindows)
if(BUILD_SHARED_LIBS)
# Generate position independent code
set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)
endif()
# Eigen
if(TARGET Eigen3::Eigen)
# If an imported target already exists, use it
target_link_libraries(igl_common INTERFACE Eigen3::Eigen)
else()
target_include_directories(igl_common SYSTEM INTERFACE ${LIBIGL_EXTERNAL}/eigen)
if(UNIX AND NOT HUNTER_ENABLED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()
if(HUNTER_ENABLED)
hunter_add_package(Eigen)
find_package(Eigen3 CONFIG REQUIRED)
endif()
# Eigen
if(NOT TARGET Eigen3::Eigen)
igl_download_eigen()
add_library(igl_eigen INTERFACE)
target_include_directories(igl_eigen SYSTEM INTERFACE
$<BUILD_INTERFACE:${LIBIGL_EXTERNAL}/eigen>
$<INSTALL_INTERFACE:include>
)
set_property(TARGET igl_eigen PROPERTY EXPORT_NAME Eigen3::Eigen)
add_library(Eigen3::Eigen ALIAS igl_eigen)
endif()
target_link_libraries(igl_common INTERFACE Eigen3::Eigen)
# C++11 Thread library
find_package(Threads REQUIRED)
target_link_libraries(igl_common INTERFACE ${CMAKE_THREAD_LIBS_INIT})
################################################################################
include(DownloadProject)
# Shortcut function
function(igl_download_project name)
download_project(
PROJ ${name}
SOURCE_DIR ${LIBIGL_EXTERNAL}/${name}
DOWNLOAD_DIR ${LIBIGL_EXTERNAL}/.cache/${name}
${ARGN}
)
endfunction()
################################################################################
## CGAL dependencies on Windows: GMP & MPFR
function(igl_download_cgal_deps)
if(WIN32)
@@ -144,12 +153,31 @@ function(compile_igl_module module_dir)
if(LIBIGL_USE_STATIC_LIBRARY)
file(GLOB SOURCES_IGL_${module_name}
"${LIBIGL_SOURCE_DIR}/igl/${module_dir}/*.cpp"
"${LIBIGL_SOURCE_DIR}/igl/copyleft/${module_dir}/*.cpp")
"${LIBIGL_SOURCE_DIR}/igl/${module_dir}/*.h*"
)
if(NOT LIBIGL_WITHOUT_COPYLEFT)
file(GLOB COPYLEFT_SOURCES_IGL_${module_name}
"${LIBIGL_SOURCE_DIR}/igl/copyleft/${module_dir}/*.cpp"
"${LIBIGL_SOURCE_DIR}/igl/copyleft/${module_dir}/*.h*"
)
list(APPEND SOURCES_IGL_${module_name} ${COPYLEFT_SOURCES_IGL_${module_name}})
endif()
add_library(${module_libname} STATIC ${SOURCES_IGL_${module_name}} ${ARGN})
if(MSVC)
target_compile_options(${module_libname} PRIVATE /w) # disable all warnings (not ideal but...)
else()
#target_compile_options(${module_libname} PRIVATE -w) # disable all warnings (not ideal but...)
# Silencing some compile warnings
target_compile_options(${module_libname} PRIVATE
# Type conversion warnings. These can be fixed with some effort and possibly more verbose code.
/wd4267 # conversion from 'size_t' to 'type', possible loss of data
/wd4244 # conversion from 'type1' to 'type2', possible loss of data
/wd4018 # signed/unsigned mismatch
/wd4305 # truncation from 'double' to 'float'
# This one is from template instantiations generated by autoexplicit.sh:
/wd4667 # no function template defined that matches forced instantiation ()
# This one is easy to fix, just need to switch to safe version of C functions
/wd4996 # this function or variable may be unsafe
# This one is when using bools in adjacency matrices
/wd4804 #'+=': unsafe use of type 'bool' in operation
)
endif()
else()
add_library(${module_libname} INTERFACE)
@@ -163,6 +191,8 @@ function(compile_igl_module module_dir)
# Alias target because it looks nicer
message(STATUS "Creating target: igl::${module_name} (${module_libname})")
add_library(igl::${module_name} ALIAS ${module_libname})
# Export as igl::${module_name}
set_property(TARGET ${module_libname} PROPERTY EXPORT_NAME igl::${module_name})
endfunction()
################################################################################
@@ -172,20 +202,16 @@ endfunction()
if(LIBIGL_USE_STATIC_LIBRARY)
file(GLOB SOURCES_IGL
"${LIBIGL_SOURCE_DIR}/igl/*.cpp"
"${LIBIGL_SOURCE_DIR}/igl/copyleft/*.cpp")
"${LIBIGL_SOURCE_DIR}/igl/*.h*"
"${LIBIGL_SOURCE_DIR}/igl/copyleft/*.cpp"
"${LIBIGL_SOURCE_DIR}/igl/copyleft/*.h*"
)
endif()
compile_igl_module("core" ${SOURCES_IGL})
################################################################################
## Compile the AntTweakBar part ###
if(LIBIGL_WITH_ANTTWEAKBAR)
set(ANTTWEAKBAR_DIR "${LIBIGL_EXTERNAL}/AntTweakBar")
if(NOT TARGET AntTweakBar)
add_subdirectory("${ANTTWEAKBAR_DIR}" AntTweakBar)
endif()
compile_igl_module("anttweakbar")
target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
target_include_directories(igl_anttweakbar ${IGL_SCOPE} "${ANTTWEAKBAR_DIR}/include")
### Download the python part ###
if(LIBIGL_WITH_PYTHON)
endif()
################################################################################
@@ -196,11 +222,14 @@ if(LIBIGL_WITH_CGAL)
# `Exact_predicates_exact_constructions_kernel_with_sqrt`
if(NOT TARGET CGAL::CGAL)
set(CGAL_DIR "${LIBIGL_EXTERNAL}/cgal")
igl_download_cgal()
igl_download_cgal_deps()
message("BOOST_ROOT: ${BOOST_ROOT}")
if(EXISTS ${LIBIGL_EXTERNAL}/boost)
set(BOOST_ROOT "${LIBIGL_EXTERNAL}/boost")
endif()
set(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
option(CGAL_Boost_USE_STATIC_LIBS "Use static Boost libs with CGAL" ON)
find_package(CGAL CONFIG COMPONENTS Core PATHS ${CGAL_DIR} NO_DEFAULT_PATH)
endif()
@@ -209,7 +238,7 @@ if(LIBIGL_WITH_CGAL)
compile_igl_module("cgal")
target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core)
else()
set(LIBIGL_WITH_CGAL OFF CACHE BOOL "" FORCE)
message(FATAL_ERROR "Could not define CGAL::CGAL and CGAL::CGAL_Core.")
endif()
endif()
@@ -242,6 +271,7 @@ endfunction()
if(LIBIGL_WITH_COMISO)
compile_igl_module("comiso")
if(NOT TARGET CoMISo)
igl_download_comiso()
add_subdirectory("${LIBIGL_EXTERNAL}/CoMISo" CoMISo)
endif()
target_link_libraries(igl_comiso ${IGL_SCOPE} CoMISo)
@@ -254,6 +284,7 @@ if(LIBIGL_WITH_CORK)
if(NOT TARGET cork)
# call this "lib-cork" instead of "cork", otherwise cmake gets confused about
# "cork" executable
igl_download_cork()
add_subdirectory("${CORK_DIR}" "lib-cork")
endif()
compile_igl_module("cork")
@@ -267,56 +298,33 @@ endif()
if(LIBIGL_WITH_EMBREE)
set(EMBREE_DIR "${LIBIGL_EXTERNAL}/embree")
set(EMBREE_ISPC_SUPPORT OFF CACHE BOOL " " FORCE)
set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
set(BUILD_TESTING OFF CACHE BOOL " " FORCE)
# set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
if(MSVC)
# set(EMBREE_STATIC_RUNTIME OFF CACHE BOOL " " FORCE)
set(EMBREE_STATIC_LIB OFF CACHE BOOL " " FORCE)
else()
set(EMBREE_STATIC_LIB ON CACHE BOOL " " FORCE)
endif()
if(NOT TARGET embree)
add_subdirectory("${EMBREE_DIR}" "embree")
endif()
igl_download_embree()
if(MSVC)
add_custom_target(Copy-Embree-DLL ALL # Adds a post-build event
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E
$<TARGET_FILE:embree> # <--this is in-file
"${CMAKE_BINARY_DIR}" # <--this is out-file path
DEPENDS embree) # Execute after embree target has been built
# Note: On macOS, building embree as a static lib can only be done with a single ISA target.
set(EMBREE_MAX_ISA "DEFAULT" CACHE STRING "Selects highest ISA to support.")
set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "")
set(EMBREE_ISPC_SUPPORT OFF CACHE BOOL " ")
set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " ")
set(EMBREE_TUTORIALS OFF CACHE BOOL " ")
set(EMBREE_STATIC_LIB ON CACHE BOOL " ")
if(MSVC)
set(EMBREE_STATIC_RUNTIME ${IGL_STATIC_RUNTIME} CACHE BOOL "Use the static version of the C/C++ runtime library.")
endif()
add_subdirectory("${EMBREE_DIR}" "embree" EXCLUDE_FROM_ALL)
endif()
compile_igl_module("embree")
target_link_libraries(igl_embree ${IGL_SCOPE} embree)
target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_DIR}/include)
if(NOT MSVC)
target_compile_definitions(igl_embree ${IGL_SCOPE} -DENABLE_STATIC_LIB)
endif()
endif()
################################################################################
### Compile the lim part ###
if(LIBIGL_WITH_LIM)
set(LIM_DIR "${LIBIGL_EXTERNAL}/lim")
if(NOT TARGET lim)
add_subdirectory("${LIM_DIR}" "lim")
endif()
compile_igl_module("lim")
target_link_libraries(igl_lim ${IGL_SCOPE} lim)
target_include_directories(igl_lim ${IGL_SCOPE} ${LIM_DIR})
target_compile_definitions(igl_embree ${IGL_SCOPE} -DEMBREE_STATIC_LIB)
endif()
################################################################################
### Compile the matlab part ###
if(LIBIGL_WITH_MATLAB)
find_package(Matlab REQUIRED COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY)
find_package(Matlab REQUIRED COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY MAT_LIBRARY)
compile_igl_module("matlab")
target_link_libraries(igl_matlab ${IGL_SCOPE} ${Matlab_LIBRARIES})
target_include_directories(igl_matlab ${IGL_SCOPE} ${Matlab_INCLUDE_DIRS})
@@ -336,13 +344,23 @@ endif()
### Compile the opengl part ###
if(LIBIGL_WITH_OPENGL)
# OpenGL module
find_package(OpenGL REQUIRED)
compile_igl_module("opengl")
target_link_libraries(igl_opengl ${IGL_SCOPE} ${OPENGL_gl_LIBRARY})
target_include_directories(igl_opengl SYSTEM ${IGL_SCOPE} ${OPENGL_INCLUDE_DIR})
# OpenGL library
if (NOT CMAKE_VERSION VERSION_LESS "3.11")
cmake_policy(SET CMP0072 NEW)
endif()
find_package(OpenGL REQUIRED)
if(TARGET OpenGL::GL)
target_link_libraries(igl_opengl ${IGL_SCOPE} OpenGL::GL)
else()
target_link_libraries(igl_opengl ${IGL_SCOPE} ${OPENGL_gl_LIBRARY})
target_include_directories(igl_opengl SYSTEM ${IGL_SCOPE} ${OPENGL_INCLUDE_DIR})
endif()
# glad module
if(NOT TARGET glad)
igl_download_glad()
add_subdirectory(${LIBIGL_EXTERNAL}/glad glad)
endif()
target_link_libraries(igl_opengl ${IGL_SCOPE} glad)
@@ -355,10 +373,16 @@ if(LIBIGL_WITH_OPENGL_GLFW)
# GLFW module
compile_igl_module("opengl/glfw")
if(NOT TARGET glfw)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL " " FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL " " FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL " " FORCE)
set(GLFW_INSTALL OFF CACHE BOOL " " FORCE)
igl_download_glfw()
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
option(GLFW_INSTALL "Generate installation target" OFF)
if(IGL_STATIC_RUNTIME)
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "Use MSVC runtime library DLL" FORCE)
else()
set(USE_MSVC_RUNTIME_LIBRARY_DLL ON CACHE BOOL "Use MSVC runtime library DLL" FORCE)
endif()
add_subdirectory(${LIBIGL_EXTERNAL}/glfw glfw)
endif()
target_link_libraries(igl_opengl_glfw ${IGL_SCOPE} igl_opengl glfw)
@@ -372,9 +396,16 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
# ImGui module
compile_igl_module("opengl/glfw/imgui")
if(NOT TARGET imgui)
add_subdirectory(${LIBIGL_EXTERNAL}/imgui imgui)
igl_download_imgui()
add_subdirectory(${LIBIGL_EXTERNAL}/libigl-imgui imgui)
endif()
target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui)
if(NOT TARGET imguizmo)
igl_download_imguizmo()
add_library(imguizmo ${LIBIGL_EXTERNAL}/imguizmo/ImGuizmo.cpp ${LIBIGL_EXTERNAL}/imguizmo/ImGuizmo.h)
target_compile_features(imguizmo PUBLIC cxx_std_11)
target_link_libraries(imguizmo PUBLIC imgui)
endif()
target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui imguizmo)
endif()
endif()
@@ -384,9 +415,9 @@ if(LIBIGL_WITH_PNG)
# png/ module is anomalous because it also depends on opengl it really should
# be moved into the opengl/ directory and namespace ...
if(TARGET igl_opengl)
set(STB_IMAGE_DIR "${LIBIGL_EXTERNAL}/stb_image")
if(NOT TARGET stb_image)
add_subdirectory("${STB_IMAGE_DIR}" "stb_image")
igl_download_stb()
add_subdirectory(${LIBIGL_EXTERNAL}/stb stb_image)
endif()
compile_igl_module("png" "")
target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
@@ -398,6 +429,7 @@ endif()
if(LIBIGL_WITH_TETGEN)
set(TETGEN_DIR "${LIBIGL_EXTERNAL}/tetgen")
if(NOT TARGET tetgen)
igl_download_tetgen()
add_subdirectory("${TETGEN_DIR}" "tetgen")
endif()
compile_igl_module("tetgen")
@@ -410,6 +442,7 @@ endif()
if(LIBIGL_WITH_TRIANGLE)
set(TRIANGLE_DIR "${LIBIGL_EXTERNAL}/triangle")
if(NOT TARGET triangle)
igl_download_triangle()
add_subdirectory("${TRIANGLE_DIR}" "triangle")
endif()
compile_igl_module("triangle")
@@ -417,12 +450,28 @@ if(LIBIGL_WITH_TRIANGLE)
target_include_directories(igl_triangle ${IGL_SCOPE} ${TRIANGLE_DIR})
endif()
################################################################################
### Compile the predicates part ###
if(LIBIGL_WITH_PREDICATES)
set(PREDICATES_DIR "${LIBIGL_EXTERNAL}/predicates")
if(NOT TARGET predicates)
igl_download_predicates()
add_subdirectory("${PREDICATES_DIR}" "predicates")
endif()
compile_igl_module("predicates")
target_link_libraries(igl_predicates ${IGL_SCOPE} predicates)
target_include_directories(igl_predicates ${IGL_SCOPE} ${PREDICATES_DIR})
target_compile_definitions(igl_predicates ${IGL_SCOPE} -DLIBIGL_WITH_PREDICATES)
endif()
################################################################################
### Compile the xml part ###
if(LIBIGL_WITH_XML)
set(TINYXML2_DIR "${LIBIGL_EXTERNAL}/tinyxml2")
if(NOT TARGET tinyxml2)
igl_download_tinyxml2()
add_library(tinyxml2 STATIC ${TINYXML2_DIR}/tinyxml2.cpp ${TINYXML2_DIR}/tinyxml2.h)
target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
set_target_properties(tinyxml2 PROPERTIES
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
VERSION "3.0.0"
@@ -432,3 +481,97 @@ if(LIBIGL_WITH_XML)
target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2)
target_include_directories(igl_xml ${IGL_SCOPE} ${TINYXML2_DIR})
endif()
################################################################################
### Install and export all modules
if(NOT LIBIGL_EXPORT_TARGETS)
return()
endif()
function(install_dir_files dir_name)
if (dir_name STREQUAL "core")
set(subpath "")
else()
set(subpath "/${dir_name}")
endif()
file(GLOB public_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.hpp
)
set(files_to_install ${public_headers})
if(NOT LIBIGL_USE_STATIC_LIBRARY)
file(GLOB public_sources
${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.c
)
endif()
list(APPEND files_to_install ${public_sources})
install(
FILES ${files_to_install}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/igl${subpath}
)
endfunction()
################################################################################
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
if(TARGET igl_eigen)
set(IGL_EIGEN igl_eigen)
else()
set(IGL_EIGEN)
message(WARNING "Trying to export igl targets while using an imported target for Eigen.")
endif()
# Install and export core library
install(
TARGETS
igl
igl_common
${IGL_EIGEN}
EXPORT igl-export
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
export(
TARGETS
igl
igl_common
${IGL_EIGEN}
FILE libigl-export.cmake
)
# Install headers for core library
install_dir_files(core)
install_dir_files(copyleft)
# Write package configuration file
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/libigl-config.cmake.in
${CMAKE_BINARY_DIR}/libigl-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/libigl/cmake
)
install(
FILES
${CMAKE_BINARY_DIR}/libigl-config.cmake
DESTINATION
${CMAKE_INSTALL_DATADIR}/libigl/cmake
)
# Write export file
export(EXPORT igl-export
FILE "${CMAKE_BINARY_DIR}/libigl-export.cmake"
)
install(EXPORT igl-export DESTINATION ${CMAKE_INSTALL_DATADIR}/libigl/cmake FILE libigl-export.cmake)
export(PACKAGE libigl)
+40 -45
View File
@@ -1025,51 +1025,46 @@ namespace igl
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template double igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
// generated by autoexplicit.sh
// generated by autoexplicit.sh
template float igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, float, float, int&, Eigen::PlainObjectBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> >&) const;
// generated by autoexplicit.sh
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&);
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::serialize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, int) const;
// generated by autoexplicit.sh
template std::vector<int, std::allocator<int> > igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::find<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, bool) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::serialize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, int) const;
// generated by autoexplicit.sh
template std::vector<int, std::allocator<int> > igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::find<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, bool) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int);
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int);
// generated by autoexplicit.sh
template float igl::AABB<Eigen::Matrix<float, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
// generated by autoexplicit.sh
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
// generated by autoexplicit.sh
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 2, 1, 1, 2> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 2, 1, 1, 2> >&) const;
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<float, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
// generated by autoexplicit.sh
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, igl::Hit&) const;
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 2, 1, 1, 2> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 2, 1, 1, 2> >&) const;
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template double igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template float igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, float, float, int&, Eigen::PlainObjectBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> >&) const;
template float igl::AABB<Eigen::Matrix<float, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> >&) const;
template std::vector<int, std::allocator<int> > igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::find<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, bool) const;
template std::vector<int, std::allocator<int> > igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::find<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 1, -1, false> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 1, -1, false> > const&, bool) const;
template std::vector<int, std::allocator<int> > igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::find<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> > const&, bool) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::serialize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, int) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&);
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::serialize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, int) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 3, 0, 2, 3>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<int, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 3, 0, 2, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 2, 3, 0, 2, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 3, 0, 2, 3> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&) const;
template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
template void igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&);
template void igl::AABB<Eigen::Matrix<float, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::squared_distance<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, 1, 2, 1, 1, 2> const&, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 2, 1, 1, 2> >&) const;
#ifdef WIN32
template void igl::AABB<class Eigen::Matrix<double,-1,-1,0,-1,-1>,2>::squared_distance<class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,1,0,-1,1>,class Eigen::Matrix<__int64,-1,1,0,-1,1>,class Eigen::Matrix<double,-1,3,0,-1,3> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > &)const;
template void igl::AABB<class Eigen::Matrix<double,-1,-1,0,-1,-1>,3>::squared_distance<class Eigen::Matrix<int,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,-1,0,-1,-1>,class Eigen::Matrix<double,-1,1,0,-1,1>,class Eigen::Matrix<__int64,-1,1,0,-1,1>,class Eigen::Matrix<double,-1,3,0,-1,3> >(class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<double,-1,-1,0,-1,-1> > const &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<double,-1,3,0,-1,3> > &)const;
#endif
#endif
+2 -2
View File
@@ -13,8 +13,8 @@ namespace igl
// Define a standard value for double epsilon
const double DOUBLE_EPS = 1.0e-14;
const double DOUBLE_EPS_SQ = 1.0e-28;
const float FLOAT_EPS = 1.0e-7;
const float FLOAT_EPS_SQ = 1.0e-14;
const float FLOAT_EPS = 1.0e-7f;
const float FLOAT_EPS_SQ = 1.0e-14f;
// Function returning EPS for corresponding type
template <typename S_type> IGL_INLINE S_type EPS();
template <typename S_type> IGL_INLINE S_type EPS_SQ();
File diff suppressed because it is too large Load Diff
@@ -1,13 +1,21 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and Daniele Panozzo <daniele.panozzo@gmail.com>
// Copyright (C) 2020 Jérémie Dumas <jeremie.dumas@ens-lyon.org>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
m.def("get_seconds", []
()
{
return igl::get_seconds();
}, __doc_igl_get_seconds);
#ifndef IGL_FILEENCODING_H
#define IGL_FILEENCODING_H
namespace igl
{
enum class FileEncoding {
Binary,
Ascii
};
}
#endif
+10 -6
View File
@@ -10,9 +10,9 @@
template <typename DerivedF, typename DerivedFF, typename DerivedFFi>
IGL_INLINE igl::HalfEdgeIterator<DerivedF,DerivedFF,DerivedFFi>::HalfEdgeIterator(
const Eigen::PlainObjectBase<DerivedF>& _F,
const Eigen::PlainObjectBase<DerivedFF>& _FF,
const Eigen::PlainObjectBase<DerivedFFi>& _FFi,
const Eigen::MatrixBase<DerivedF>& _F,
const Eigen::MatrixBase<DerivedFF>& _FF,
const Eigen::MatrixBase<DerivedFFi>& _FFi,
int _fi,
int _ei,
bool _reverse
@@ -138,8 +138,8 @@ IGL_INLINE bool igl::HalfEdgeIterator<DerivedF,DerivedFF,DerivedFFi>::operator==
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> >::HalfEdgeIterator(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, int, int, bool);
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >::HalfEdgeIterator(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, int, bool);
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> >::HalfEdgeIterator(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, int, int, bool);
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >::HalfEdgeIterator(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, int, bool);
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::NextFE();
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::Ei();
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::Ei();
@@ -147,12 +147,16 @@ template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen:
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> >::Fi();
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> ,Eigen::Matrix<int, -1, 3, 0, -1, 3> >::NextFE();
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::Vi();
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::HalfEdgeIterator(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, int, bool);
template igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::HalfEdgeIterator(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, int, bool);
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::Fi();
template void igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::flipE();
template void igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >::flipE();
template void igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::flipF();
template void igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >::flipF();
template void igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::flipV();
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >::operator==(igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template int igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >::Fi();
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >::NextFE();
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >::isBorder();
template bool igl::HalfEdgeIterator<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >::isBorder();
#endif
+6 -6
View File
@@ -49,9 +49,9 @@ namespace igl
public:
// Init the HalfEdgeIterator by specifying Face,Edge Index and Orientation
IGL_INLINE HalfEdgeIterator(
const Eigen::PlainObjectBase<DerivedF>& _F,
const Eigen::PlainObjectBase<DerivedFF>& _FF,
const Eigen::PlainObjectBase<DerivedFFi>& _FFi,
const Eigen::MatrixBase<DerivedF>& _F,
const Eigen::MatrixBase<DerivedFF>& _FF,
const Eigen::MatrixBase<DerivedFFi>& _FFi,
int _fi,
int _ei,
bool _reverse = false
@@ -100,9 +100,9 @@ namespace igl
bool reverse;
// All the same type? This is likely to break.
const Eigen::PlainObjectBase<DerivedF> & F;
const Eigen::PlainObjectBase<DerivedFF> & FF;
const Eigen::PlainObjectBase<DerivedFFi> & FFi;
const Eigen::MatrixBase<DerivedF> & F;
const Eigen::MatrixBase<DerivedFF> & FF;
const Eigen::MatrixBase<DerivedFFi> & FFi;
};
}
+7 -3
View File
@@ -17,9 +17,13 @@ namespace igl
struct Hit
{
int id; // primitive id
int gid; // geometry id
float u,v; // barycentric coordinates
float t; // distance = direction*t to intersection
int gid; // geometry id (not used)
// barycentric coordinates so that
// pos = V.row(F(id,0))*(1-u-v)+V.row(F(id,1))*u+V.row(F(id,2))*v;
float u,v;
// parametric distance so that
// pos = origin + t * dir
float t;
};
}
#endif
+27
View File
@@ -0,0 +1,27 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2018 Zhongshi Jiang <jiangzs@nyu.edu>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_MAPPINGENERGYTYPE_H
#define IGL_MAPPINGENERGYTYPE_H
namespace igl
{
// Energy Types used for Parameterization/Mapping.
// Refer to SLIM [Rabinovich et al. 2017] for more details
// Todo: Integrate with ARAPEnergyType
enum MappingEnergyType
{
ARAP = 0,
LOG_ARAP = 1,
SYMMETRIC_DIRICHLET = 2,
CONFORMAL = 3,
EXP_CONFORMAL = 4,
EXP_SYMMETRIC_DIRICHLET = 5,
NUM_SLIM_ENERGY_TYPES = 6
};
}
#endif
+497
View File
@@ -0,0 +1,497 @@
// based on MSH reader from PyMesh
// Copyright (c) 2015 Qingnan Zhou <qzhou@adobe.com>
// Copyright (C) 2020 Vladimir Fonov <vladimir.fonov@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "MshLoader.h"
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <string.h>
namespace igl {
// helper function
void inline _msh_eat_white_space(std::ifstream& fin) {
char next = fin.peek();
while (next == '\n' || next == ' ' || next == '\t' || next == '\r') {
fin.get();
next = fin.peek();
}
}
}
IGL_INLINE igl::MshLoader::MshLoader(const std::string &filename) {
std::ifstream fin(filename, std::ios::in | std::ios::binary);
if (!fin.is_open()) {
std::stringstream err_msg;
err_msg << "failed to open file \"" << filename << "\"";
throw std::ios_base::failure(err_msg.str());
}
// Parse header
std::string buf;
double version;
int type;
fin >> buf;
if (buf != "$MeshFormat") { throw std::runtime_error("Unexpected .msh format"); }
fin >> version >> type >> m_data_size;
m_binary = (type == 1);
if(version>2.2 || version<2.0)
{
// probably unsupported version
std::stringstream err_msg;
err_msg << "Error: Unsupported file version:" << version << std::endl;
throw std::runtime_error(err_msg.str());
}
// Some sanity check.
if (m_data_size != 8) {
std::stringstream err_msg;
err_msg << "Error: data size must be 8 bytes." << std::endl;
throw std::runtime_error(err_msg.str());
}
if (sizeof(int) != 4) {
std::stringstream err_msg;
err_msg << "Error: code must be compiled with int size 4 bytes." << std::endl;
throw std::runtime_error(err_msg.str());
}
// Read in extra info from binary header.
if (m_binary) {
int one;
igl::_msh_eat_white_space(fin);
fin.read(reinterpret_cast<char*>(&one), sizeof(int));
if (one != 1) {
std::stringstream err_msg;
err_msg << "Binary msh file " << filename
<< " is saved with different endianness than this machine."
<< std::endl;
throw std::runtime_error(err_msg.str());
}
}
fin >> buf;
if (buf != "$EndMeshFormat")
{
std::stringstream err_msg;
err_msg << "Unexpected contents in the file header." << std::endl;
throw std::runtime_error(err_msg.str());
}
while (!fin.eof()) {
buf.clear();
fin >> buf;
if (buf == "$Nodes") {
parse_nodes(fin);
fin >> buf;
if (buf != "$EndNodes") { throw std::runtime_error("Unexpected tag"); }
} else if (buf == "$Elements") {
parse_elements(fin);
fin >> buf;
if (buf != "$EndElements") { throw std::runtime_error("Unexpected tag"); }
} else if (buf == "$NodeData") {
parse_node_field(fin);
fin >> buf;
if (buf != "$EndNodeData") { throw std::runtime_error("Unexpected tag"); }
} else if (buf == "$ElementData") {
parse_element_field(fin);
fin >> buf;
if (buf != "$EndElementData") { throw std::runtime_error("Unexpected tag"); }
} else if (fin.eof()) {
break;
} else {
parse_unknown_field(fin, buf);
}
}
fin.close();
}
IGL_INLINE void igl::MshLoader::parse_nodes(std::ifstream& fin) {
size_t num_nodes;
fin >> num_nodes;
m_nodes.resize(num_nodes*3);
if (m_binary) {
size_t stride = (4+3*m_data_size);
size_t num_bytes = stride * num_nodes;
char* data = new char[num_bytes];
igl::_msh_eat_white_space(fin);
fin.read(data, num_bytes);
for (size_t i=0; i<num_nodes; i++) {
int node_idx;
memcpy(&node_idx, data+i*stride, sizeof(int));
node_idx-=1;
// directly move into vector storage
// this works only when m_data_size==sizeof(Float)==sizeof(double)
memcpy(&m_nodes[node_idx*3], data+i*stride + 4, m_data_size*3);
}
delete [] data;
} else {
int node_idx;
for (size_t i=0; i<num_nodes; i++) {
fin >> node_idx;
node_idx -= 1;
// here it's 3D node explicitly
fin >> m_nodes[node_idx*3]
>> m_nodes[node_idx*3+1]
>> m_nodes[node_idx*3+2];
}
}
}
IGL_INLINE void igl::MshLoader::parse_elements(std::ifstream& fin) {
m_elements_tags.resize(2); //hardcoded to have 2 tags
size_t num_elements;
fin >> num_elements;
size_t nodes_per_element;
if (m_binary) {
igl::_msh_eat_white_space(fin);
int elem_read = 0;
while (elem_read < num_elements) {
// Parse element header.
int elem_type, num_elems, num_tags;
fin.read((char*)&elem_type, sizeof(int));
fin.read((char*)&num_elems, sizeof(int));
fin.read((char*)&num_tags, sizeof(int));
nodes_per_element = num_nodes_per_elem_type(elem_type);
// store node info
for (size_t i=0; i<num_elems; i++) {
int elem_idx;
// all elements in the segment share the same elem_type and number of nodes per element
m_elements_types.push_back(elem_type);
m_elements_lengths.push_back(nodes_per_element);
fin.read((char*)&elem_idx, sizeof(int));
elem_idx -= 1;
m_elements_ids.push_back(elem_idx);
// read first two tags
for (size_t j=0; j<num_tags; j++) {
int tag;
fin.read((char*)&tag, sizeof(int));
if(j<2) m_elements_tags[j].push_back(tag);
}
for (size_t j=num_tags; j<2; j++)
m_elements_tags[j].push_back(-1); // fill up tags if less then 2
m_elements_nodes_idx.push_back(m_elements.size());
// Element values.
for (size_t j=0; j<nodes_per_element; j++) {
int idx;
fin.read((char*)&idx, sizeof(int));
m_elements.push_back(idx-1);
}
}
elem_read += num_elems;
}
} else {
for (size_t i=0; i<num_elements; i++) {
// Parse per element header
int elem_num, elem_type, num_tags;
fin >> elem_num >> elem_type >> num_tags;
// read tags.
for (size_t j=0; j<num_tags; j++) {
int tag;
fin >> tag;
if(j<2) m_elements_tags[j].push_back(tag);
}
for (size_t j=num_tags; j<2; j++)
m_elements_tags[j].push_back(-1); // fill up tags if less then 2
nodes_per_element = num_nodes_per_elem_type(elem_type);
m_elements_types.push_back(elem_type);
m_elements_lengths.push_back(nodes_per_element);
elem_num -= 1;
m_elements_ids.push_back(elem_num);
m_elements_nodes_idx.push_back(m_elements.size());
// Parse node idx.
for (size_t j=0; j<nodes_per_element; j++) {
int idx;
fin >> idx;
m_elements.push_back(idx-1); // msh index starts from 1.
}
}
}
// debug
assert(m_elements_types.size() == m_elements_ids.size());
assert(m_elements_tags[0].size() == m_elements_ids.size());
assert(m_elements_tags[1].size() == m_elements_ids.size());
assert(m_elements_lengths.size() == m_elements_ids.size());
}
IGL_INLINE void igl::MshLoader::parse_node_field( std::ifstream& fin ) {
size_t num_string_tags;
size_t num_real_tags;
size_t num_int_tags;
fin >> num_string_tags;
std::vector<std::string> str_tags(num_string_tags);
for (size_t i=0; i<num_string_tags; i++) {
igl::_msh_eat_white_space(fin);
if (fin.peek() == '\"') {
// Handle field name between quotes.
char buf[128];
fin.get(); // remove the quote at the beginning.
fin.getline(buf, 128, '\"');
str_tags[i] = std::string(buf);
} else {
fin >> str_tags[i];
}
}
fin >> num_real_tags;
std::vector<Float> real_tags(num_real_tags);
for (size_t i=0; i<num_real_tags; i++)
fin >> real_tags[i];
fin >> num_int_tags;
std::vector<int> int_tags(num_int_tags);
for (size_t i=0; i<num_int_tags; i++)
fin >> int_tags[i];
if (num_string_tags <= 0 || num_int_tags <= 2) {
throw std::runtime_error("Unexpected number of field tags");
}
std::string fieldname = str_tags[0];
int num_components = int_tags[1];
int num_entries = int_tags[2];
std::vector<Float> field( num_entries*num_components );
if (m_binary) {
size_t num_bytes = (num_components * m_data_size + 4) * num_entries;
char* data = new char[num_bytes];
igl::_msh_eat_white_space(fin);
fin.read(data, num_bytes);
for (size_t i=0; i<num_entries; i++) {
int node_idx;
memcpy(&node_idx,&data[i*(4+num_components*m_data_size)],4);
if(node_idx<1) throw std::runtime_error("Negative or zero index");
node_idx -= 1;
if(node_idx>=num_entries) throw std::runtime_error("Index too big");
size_t base_idx = i*(4+num_components*m_data_size) + 4;
// TODO: make this work when m_data_size != sizeof(double) ?
memcpy(&field[node_idx*num_components], &data[base_idx], num_components*m_data_size);
}
delete [] data;
} else {
int node_idx;
for (size_t i=0; i<num_entries; i++) {
fin >> node_idx;
node_idx -= 1;
for (size_t j=0; j<num_components; j++) {
fin >> field[node_idx*num_components+j];
}
}
}
m_node_fields_names.push_back(fieldname);
m_node_fields.push_back(field);
m_node_fields_components.push_back(num_components);
}
IGL_INLINE void igl::MshLoader::parse_element_field(std::ifstream& fin) {
size_t num_string_tags;
size_t num_real_tags;
size_t num_int_tags;
fin >> num_string_tags;
std::vector<std::string> str_tags(num_string_tags);
for (size_t i=0; i<num_string_tags; i++) {
igl::_msh_eat_white_space(fin);
if (fin.peek() == '\"') {
// Handle field name between quoates.
char buf[128];
fin.get(); // remove the quote at the beginning.
fin.getline(buf, 128, '\"');
str_tags[i] = buf;
} else {
fin >> str_tags[i];
}
}
fin >> num_real_tags;
std::vector<Float> real_tags(num_real_tags);
for (size_t i=0; i<num_real_tags; i++)
fin >> real_tags[i];
fin >> num_int_tags;
std::vector<int> int_tags(num_int_tags);
for (size_t i=0; i<num_int_tags; i++)
fin >> int_tags[i];
if (num_string_tags <= 0 || num_int_tags <= 2) {
throw std::runtime_error("Invalid file format");
}
std::string fieldname = str_tags[0];
int num_components = int_tags[1];
int num_entries = int_tags[2];
std::vector<Float> field(num_entries*num_components);
if (m_binary) {
size_t num_bytes = (num_components * m_data_size + 4) * num_entries;
char* data = new char[num_bytes];
igl::_msh_eat_white_space(fin);
fin.read(data, num_bytes);
for (int i=0; i<num_entries; i++) {
int elem_idx;
// works with sizeof(int)==4
memcpy(&elem_idx, &data[i*(4+num_components*m_data_size)],4);
elem_idx -= 1;
// directly copy data into vector storage space
memcpy(&field[elem_idx*num_components], &data[i*(4+num_components*m_data_size) + 4], m_data_size*num_components);
}
delete [] data;
} else {
int elem_idx;
for (size_t i=0; i<num_entries; i++) {
fin >> elem_idx;
elem_idx -= 1;
for (size_t j=0; j<num_components; j++) {
fin >> field[elem_idx*num_components+j];
}
}
}
m_element_fields_names.push_back(fieldname);
m_element_fields.push_back(field);
m_element_fields_components.push_back(num_components);
}
IGL_INLINE void igl::MshLoader::parse_unknown_field(std::ifstream& fin,
const std::string& fieldname) {
std::cerr << "Warning: \"" << fieldname << "\" not supported yet. Ignored." << std::endl;
std::string endmark = fieldname.substr(0,1) + "End"
+ fieldname.substr(1,fieldname.size()-1);
std::string buf("");
while (buf != endmark && !fin.eof()) {
fin >> buf;
}
}
IGL_INLINE int igl::MshLoader::num_nodes_per_elem_type(int elem_type) {
int nodes_per_element = 0;
switch (elem_type) {
case ELEMENT_LINE: // 2-node line
nodes_per_element = 2;
break;
case ELEMENT_TRI:
nodes_per_element = 3; // 3-node triangle
break;
case ELEMENT_QUAD:
nodes_per_element = 4; // 5-node quad
break;
case ELEMENT_TET:
nodes_per_element = 4; // 4-node tetrahedra
break;
case ELEMENT_HEX: // 8-node hexahedron
nodes_per_element = 8;
break;
case ELEMENT_PRISM: // 6-node prism
nodes_per_element = 6;
break;
case ELEMENT_LINE_2ND_ORDER:
nodes_per_element = 3;
break;
case ELEMENT_TRI_2ND_ORDER:
nodes_per_element = 6;
break;
case ELEMENT_QUAD_2ND_ORDER:
nodes_per_element = 9;
break;
case ELEMENT_TET_2ND_ORDER:
nodes_per_element = 10;
break;
case ELEMENT_HEX_2ND_ORDER:
nodes_per_element = 27;
break;
case ELEMENT_PRISM_2ND_ORDER:
nodes_per_element = 18;
break;
case ELEMENT_PYRAMID_2ND_ORDER:
nodes_per_element = 14;
break;
case ELEMENT_POINT: // 1-node point
nodes_per_element = 1;
break;
default:
std::stringstream err_msg;
err_msg << "Element type (" << elem_type << ") is not supported yet."
<< std::endl;
throw std::runtime_error(err_msg.str());
}
return nodes_per_element;
}
IGL_INLINE bool igl::MshLoader::is_element_map_identity() const
{
for(int i=0;i<m_elements_ids.size();i++) {
int id=m_elements_ids[i];
if (id!=i) return false;
}
return true;
}
IGL_INLINE void igl::MshLoader::index_structures(int tag_column)
{
//cleanup
m_structure_index.clear();
m_structures.clear();
m_structure_length.clear();
//index structure tags
for(auto i=0; i != m_elements_tags[tag_column].size(); ++i )
{
m_structure_index.insert(
std::pair<msh_struct,int>(
msh_struct( m_elements_tags[tag_column][i],
m_elements_types[i]), i)
);
}
// identify unique structures
std::vector<StructIndex::value_type> _unique_structs;
std::unique_copy(std::begin(m_structure_index),
std::end(m_structure_index),
std::back_inserter(_unique_structs),
[](const StructIndex::value_type &c1, const StructIndex::value_type &c2)
{ return c1.first == c2.first; });
std::for_each( _unique_structs.begin(), _unique_structs.end(),
[this](const StructIndex::value_type &n){ this->m_structures.push_back(n.first); });
for(auto t = m_structures.begin(); t != m_structures.end(); ++t)
{
// identify all elements corresponding to this tag
auto structure_range = m_structure_index.equal_range( *t );
int cnt=0;
for(auto i=structure_range.first; i!=structure_range.second; i++)
cnt++;
m_structure_length.insert( std::pair<msh_struct,int>( *t, cnt));
}
}
+190
View File
@@ -0,0 +1,190 @@
// based on MSH reader from PyMesh
// Copyright (c) 2015 Qingnan Zhou <qzhou@adobe.com>
// Copyright (C) 2020 Vladimir Fonov <vladimir.fonov@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_MSH_LOADER_H
#define IGL_MSH_LOADER_H
#include "igl_inline.h"
#include <fstream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
namespace igl {
// Class for loading information from .msh file
// depends only on c++stl library
class MshLoader {
public:
struct msh_struct {
int tag,el_type;
msh_struct(int _tag=0,int _type=0):
tag(_tag),el_type(_type){}
bool operator== (const msh_struct& a) const {
return this->tag==a.tag &&
this->el_type==a.el_type;
}
bool operator< (const msh_struct& a) const {
return (this->tag*100+this->el_type) <
(a.tag*100+a.el_type);
}
};
typedef double Float;
typedef std::vector<int> IndexVector;
typedef std::vector<int> IntVector;
typedef std::vector<Float> FloatVector;
typedef std::vector<FloatVector> FloatField;
typedef std::vector<IntVector> IntField;
typedef std::vector<std::string> FieldNames;
typedef std::multimap<msh_struct,int> StructIndex;
typedef std::vector<msh_struct> StructVector;
enum {ELEMENT_LINE=1, ELEMENT_TRI=2, ELEMENT_QUAD=3,
ELEMENT_TET=4, ELEMENT_HEX=5, ELEMENT_PRISM=6,
ELEMENT_PYRAMID=7,
// 2nd order elements
ELEMENT_LINE_2ND_ORDER=8, ELEMENT_TRI_2ND_ORDER=9,
ELEMENT_QUAD_2ND_ORDER=10,ELEMENT_TET_2ND_ORDER=11,
ELEMENT_HEX_2ND_ORDER=12, ELEMENT_PRISM_2ND_ORDER=13,
ELEMENT_PYRAMID_2ND_ORDER=14,
// other elements
ELEMENT_POINT=15 };
public:
MshLoader(const std::string &filename);
public:
// get nodes , x,y,z sequentially
const FloatVector& get_nodes() const { return m_nodes; }
// get elements , identifying nodes that create an element
// variable length per element
const IndexVector& get_elements() const { return m_elements; }
// get element types
const IntVector& get_elements_types() const { return m_elements_types; }
// get element lengths
const IntVector& get_elements_lengths() const { return m_elements_lengths; }
// get element tags ( physical (0) and elementary (1) )
const IntField& get_elements_tags() const { return m_elements_tags; }
// get element IDs
const IntVector& get_elements_ids() const { return m_elements_ids; }
// get reverse index from node to element
const IndexVector& get_elements_nodes_idx() const { return m_elements_nodes_idx; }
// get fields assigned per node, all fields and components sequentially
const FloatField& get_node_fields() const { return m_node_fields;}
// get node field names,
const FieldNames& get_node_fields_names() const { return m_node_fields_names;}
// get number of node field components
const IntVector& get_node_fields_components() const {return m_node_fields_components;}
int get_node_field_components(size_t c) const
{
return m_node_fields_components[c];
}
// get fields assigned per element, all fields and components sequentially
const FloatField& get_element_fields() const { return m_element_fields;}
// get element field names
const FieldNames& get_element_fields_names() const { return m_element_fields_names;}
// get number of element field components
const IntVector& get_element_fields_components() const {return m_element_fields_components;}
int get_element_field_components(size_t c) const {
return m_element_fields_components[c];
}
// check if field is present at node level
bool is_node_field(const std::string& fieldname) const {
return (std::find(std::begin(m_node_fields_names),
std::end(m_node_fields_names),
fieldname) != std::end(m_node_fields_names) );
}
// check if field is present at element level
bool is_element_field(const std::string& fieldname) const {
return (std::find(std::begin(m_element_fields_names),
std::end(m_element_fields_names),
fieldname) != std::end(m_node_fields_names) );
}
// check if all elements have ids assigned sequentially
bool is_element_map_identity() const ;
// create tag index
// tag_column: ( physical (0) or elementary (1) ) specifying which tag to use
void index_structures(int tag_column);
// get tag index, call index_structure_tags first
const StructIndex& get_structure_index() const
{
return m_structure_index;
}
// get size of a structure identified by tag and element type
const StructIndex& get_structure_length() const
{
return m_structure_length;
}
//! get list of structures
const StructVector& get_structures() const
{
return m_structures;
}
public:
// helper function, calculate number of nodes associated with an element
static int num_nodes_per_elem_type(int elem_type);
private:
void parse_nodes(std::ifstream& fin);
void parse_elements(std::ifstream& fin);
void parse_node_field(std::ifstream& fin);
void parse_element_field(std::ifstream& fin);
void parse_unknown_field(std::ifstream& fin,
const std::string& fieldname);
private:
bool m_binary;
size_t m_data_size;
FloatVector m_nodes; // len x 3 vector
IndexVector m_elements; // linear array for nodes corresponding to each element
IndexVector m_elements_nodes_idx; // element indexes
IntVector m_elements_ids; // element id's
IntVector m_elements_types; // Element types
IntVector m_elements_lengths; // Element lengths
IntField m_elements_tags; // Element tags, currently 2xtags per element
FloatField m_node_fields; // Float field defined at each node
IntVector m_node_fields_components; // Number of components for node field
FieldNames m_node_fields_names; // Node field name
FloatField m_element_fields; // Float field defined at each element
IntVector m_element_fields_components; // Number of components for element field
FieldNames m_element_fields_names; // Element field name
StructIndex m_structure_index; // index tag ids
StructVector m_structures; // unique structures
StructIndex m_structure_length; // length of structures with consistent element type
};
} //igl
#ifndef IGL_STATIC_LIBRARY
# include "MshLoader.cpp"
#endif
#endif //IGL_MSH_LOADER_H
+347
View File
@@ -0,0 +1,347 @@
// based on MSH writer from PyMesh
// Copyright (c) 2015 Qingnan Zhou <qzhou@adobe.com>
// Copyright (C) 2020 Vladimir Fonov <vladimir.fonov@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "MshSaver.h"
#include <cassert>
#include <iostream>
#include <sstream>
#include <exception>
IGL_INLINE igl::MshSaver::MshSaver(const std::string& filename, bool binary) :
m_binary(binary), m_num_nodes(0), m_num_elements(0) {
if (!m_binary) {
fout.open(filename.c_str(), std::fstream::out);
} else {
fout.open(filename.c_str(), std::fstream::binary);
}
if (!fout) {
std::stringstream err_msg;
err_msg << "Error opening " << filename << " to write msh file." << std::endl;
throw std::ios_base::failure(err_msg.str());
}
}
IGL_INLINE igl::MshSaver::~MshSaver() {
fout.close();
}
IGL_INLINE void igl::MshSaver::save_mesh(
const FloatVector& nodes,
const IndexVector& elements,
const IntVector& element_lengths,
const IntVector& element_types,
const IntVector& element_tags
) {
save_header();
save_nodes(nodes);
save_elements(elements, element_lengths, element_types, element_tags );
}
IGL_INLINE void igl::MshSaver::save_header() {
if (!m_binary) {
fout << "$MeshFormat" << std::endl;
fout << "2.2 0 " << sizeof(double) << std::endl;
fout << "$EndMeshFormat" << std::endl;
fout.precision(17);
} else {
fout << "$MeshFormat" << std::endl;
fout << "2.2 1 " << sizeof(double) << std::endl;
int one = 1;
fout.write((char*)&one, sizeof(int));
fout << "\n$EndMeshFormat" << std::endl;
}
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_nodes(const FloatVector& nodes) {
// Save nodes.
// 3D hadrcoded
m_num_nodes = nodes.size() / 3;
fout << "$Nodes" << std::endl;
fout << m_num_nodes << std::endl;
if (!m_binary) {
for (size_t i=0; i<nodes.size(); i+=3) {
//const VectorF& v = nodes.segment(i,m_dim);
int node_idx = i/3 + 1;
fout << node_idx << " " << nodes[i] << " " << nodes[i+1] << " " << nodes[i+2] << std::endl;
}
} else {
for (size_t i=0; i<nodes.size(); i+=3) {
//const VectorF& v = nodes.segment(i,m_dim);
int node_idx = i/3 + 1;
fout.write((const char*)&node_idx, sizeof(int));
fout.write((const char*)&nodes[i], sizeof(Float)*3);
}
}
fout << "$EndNodes" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_elements(const IndexVector& elements,
const IntVector& element_lengths,
const IntVector& element_types,
const IntVector& element_tags)
{
m_num_elements = element_tags.size();
assert(element_lengths.size() == element_types.size() );
assert(element_lengths.size() == element_tags.size() );
// TODO: sum up all lengths
// Save elements.
// node inxes are 1-based
fout << "$Elements" << std::endl;
fout << m_num_elements << std::endl;
if (m_num_elements > 0) {
//int elem_type = el_type;
int num_elems = m_num_elements;
//int tags = 0;
if (!m_binary) {
size_t el_ptr=0;
for (size_t i=0;i<m_num_elements;++i) {
int elem_num = (int) i + 1;
///VectorI elem = elements.segment(i, nodes_per_element) + VectorI::Ones(nodes_per_element);
// hardcoded: duplicate tags (I don't know why)
fout << elem_num << " " << element_types[i] << " " << 2 << " "<< element_tags[i] << " "<< element_tags[i] << " ";
for (size_t j=0; j<element_lengths[i]; j++) {
fout << elements[el_ptr + j] + 1 << " ";
}
fout << std::endl;
el_ptr+=element_lengths[i];
}
} else {
size_t el_ptr=0,i=0;
while(i<m_num_elements) {
// write elements in consistent chunks
// TODO: refactor this code to be able to specify different elements
// more effeciently
int elem_type=-1;
int elem_len=-1;
size_t j=i;
for(;j<m_num_elements;++j)
{
if( elem_type==-1 )
{
elem_type=element_types[j];
elem_len=element_lengths[j];
} else if( elem_type!=element_types[j] ||
elem_len!=element_lengths[j]) {
break; // found the edge of the segment
}
}
//hardcoded: 2 tags
int num_elems=j-i, num_tags=2;
fout.write((const char*)& elem_type, sizeof(int));
fout.write((const char*)& num_elems, sizeof(int));
fout.write((const char*)& num_tags, sizeof(int));
for(int k=0;k<num_elems; ++k,++i){
int elem_num = (int )i + 1;
fout.write((const char*)&elem_num, sizeof(int));
// HACK: hardcoded 2 tags
fout.write((const char*)& element_tags[i], sizeof(int));
fout.write((const char*)& element_tags[i], sizeof(int));
for (size_t e=0; e<elem_len; e++) {
int _elem = static_cast<int>( elements[el_ptr + e] )+1;
fout.write((const char*)&_elem, sizeof(int));
}
el_ptr+=elem_len;
}
}
}
}
fout << "$EndElements" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_scalar_field(const std::string& fieldname, const FloatVector& field) {
assert(field.size() == m_num_nodes);
fout << "$NodeData" << std::endl;
fout << "1" << std::endl; // num string tags.
fout << "\"" << fieldname << "\"" << std::endl;
fout << "1" << std::endl; // num real tags.
fout << "0.0" << std::endl; // time value.
fout << "3" << std::endl; // num int tags.
fout << "0" << std::endl; // the time step
fout << "1" << std::endl; // 1-component scalar field.
fout << m_num_nodes << std::endl; // number of nodes
if (m_binary) {
for (size_t i=0; i<m_num_nodes; i++) {
int node_idx = i+1;
fout.write((char*)&node_idx, sizeof(int));
fout.write((char*)&field[i], sizeof(Float));
}
} else {
for (size_t i=0; i<m_num_nodes; i++) {
int node_idx = i+1;
fout << node_idx << " " << field[i] << std::endl;
}
}
fout << "$EndNodeData" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_vector_field(const std::string& fieldname, const FloatVector& field) {
assert(field.size() == 3 * m_num_nodes);
fout << "$NodeData" << std::endl;
fout << "1" << std::endl; // num string tags.
fout << "\"" << fieldname << "\"" << std::endl;
fout << "1" << std::endl; // num real tags.
fout << "0.0" << std::endl; // time value.
fout << "3" << std::endl; // num int tags.
fout << "0" << std::endl; // the time step
fout << "3" << std::endl; // 3-component vector field.
fout << m_num_nodes << std::endl; // number of nodes
const Float zero = 0.0;
if (m_binary) {
for (size_t i=0; i<m_num_nodes; i++) {
int node_idx = i+1;
fout.write((const char*)&node_idx, sizeof(int));
fout.write((const char*)&field[i*3], sizeof(Float)*3);
}
} else {
for (size_t i=0; i<m_num_nodes; i++) {
int node_idx = i+1;
fout << node_idx
<< " " << field[i*3]
<< " " << field[i*3+1]
<< " " << field[i*3+2]
<< std::endl;
}
}
fout << "$EndNodeData" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_elem_scalar_field(const std::string& fieldname, const FloatVector& field) {
assert(field.size() == m_num_elements);
fout << "$ElementData" << std::endl;
fout << 1 << std::endl; // num string tags.
fout << "\"" << fieldname << "\"" << std::endl;
fout << "1" << std::endl; // num real tags.
fout << "0.0" << std::endl; // time value.
fout << "3" << std::endl; // num int tags.
fout << "0" << std::endl; // the time step
fout << "1" << std::endl; // 1-component scalar field.
fout << m_num_elements << std::endl; // number of elements
if (m_binary) {
for (size_t i=0; i<m_num_elements; i++) {
int elem_idx = i+1;
fout.write((const char*)&elem_idx, sizeof(int));
fout.write((const char*)&field[i], sizeof(Float));
}
} else {
for (size_t i=0; i<m_num_elements; i++) {
int elem_idx = i+1;
fout << elem_idx << " " << field[i] << std::endl;
}
}
fout << "$EndElementData" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_elem_vector_field(const std::string& fieldname, const FloatVector& field) {
assert(field.size() == m_num_elements * 3);
fout << "$ElementData" << std::endl;
fout << 1 << std::endl; // num string tags.
fout << "\"" << fieldname << "\"" << std::endl;
fout << "1" << std::endl; // num real tags.
fout << "0.0" << std::endl; // time value.
fout << "3" << std::endl; // num int tags.
fout << "0" << std::endl; // the time step
fout << "3" << std::endl; // 3-component vector field.
fout << m_num_elements << std::endl; // number of elements
const Float zero = 0.0;
if (m_binary) {
for (size_t i=0; i<m_num_elements; ++i) {
int elem_idx = i+1;
fout.write((const char*)&elem_idx, sizeof(int));
fout.write((const char*)&field[i*3], sizeof(Float) * 3);
}
} else {
for (size_t i=0; i<m_num_elements; ++i) {
int elem_idx = i+1;
fout << elem_idx
<< " " << field[i*3]
<< " " << field[i*3+1]
<< " " << field[i*3+2]
<< std::endl;
}
}
fout << "$EndElementData" << std::endl;
fout.flush();
}
IGL_INLINE void igl::MshSaver::save_elem_tensor_field(const std::string& fieldname, const FloatVector& field) {
assert(field.size() == m_num_elements * 3 * (3 + 1) / 2);
fout << "$ElementData" << std::endl;
fout << 1 << std::endl; // num string tags.
fout << "\"" << fieldname << "\"" << std::endl;
fout << "1" << std::endl; // num real tags.
fout << "0.0" << std::endl; // time value.
fout << "3" << std::endl; // num int tags.
fout << "0" << std::endl; // the time step
fout << "9" << std::endl; // 9-component tensor field.
fout << m_num_elements << std::endl; // number of elements
const Float zero = 0.0;
if (m_binary) {
for (size_t i=0; i<m_num_elements; i++) {
int elem_idx = i+1;
fout.write((char*)&elem_idx, sizeof(int));
//const VectorF& val = field.segment(i*6, 6);
const Float* val = &field[i*6];
Float tensor[9] = {
val[0], val[5], val[4],
val[5], val[1], val[3],
val[4], val[3], val[2] };
fout.write((char*)tensor, sizeof(Float) * 9);
}
} else {
for (size_t i=0; i<m_num_elements; i++) {
int elem_idx = i+1;
const Float* val = &field[i*6];
fout << elem_idx
<< " " << val[0]
<< " " << val[5]
<< " " << val[4]
<< " " << val[5]
<< " " << val[1]
<< " " << val[3]
<< " " << val[4]
<< " " << val[3]
<< " " << val[2]
<< std::endl;
}
}
fout << "$EndElementData" << std::endl;
fout.flush();
}
+84
View File
@@ -0,0 +1,84 @@
// based on MSH writer from PyMesh
// Copyright (c) 2015 Qingnan Zhou <qzhou@adobe.com>
// Copyright (C) 2020 Vladimir Fonov <vladimir.fonov@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_MSH_SAVER_H
#define IGL_MSH_SAVER_H
#include "igl_inline.h"
#include <fstream>
#include <string>
#include <vector>
namespace igl {
// Class for dumping information to .msh file
// depends only on c++stl library
// current implementation works only with 3D information
class MshSaver {
public:
typedef double Float;
typedef std::vector<int> IndexVector;
typedef std::vector<int> IntVector;
typedef std::vector<Float> FloatVector;
typedef std::vector<FloatVector> FloatField;
typedef std::vector<IntVector> IntField;
typedef std::vector<std::string> FieldNames;
MshSaver(const std::string& filename, bool binary=true);
~MshSaver();
public:
// Only these element types are supported right now
enum {ELEMENT_LINE=1, ELEMENT_TRI=2, ELEMENT_QUAD=3,
ELEMENT_TET=4, ELEMENT_HEX=5, ELEMENT_PRISM=6 };
public:
// save mesh geometry
void save_mesh(
const FloatVector& nodes,
const IndexVector& elements,
const IntVector& element_lengths,
const IntVector& element_type,
const IntVector& element_tags );
// save additional fields associated with the mesh
// add node scalar field
void save_scalar_field(const std::string& fieldname, const FloatVector& field);
// add node vectot field
void save_vector_field(const std::string& fieldname, const FloatVector& field);
// add element scalar field
void save_elem_scalar_field(const std::string& fieldname, const FloatVector& field);
// add element vector field
void save_elem_vector_field(const std::string& fieldname, const FloatVector& field);
// add element tensor field
void save_elem_tensor_field(const std::string& fieldname, const FloatVector& field);
protected:
void save_header();
void save_nodes(const FloatVector& nodes);
void save_elements(const IndexVector& elements,
const IntVector& element_lengths,
const IntVector& element_type,
const IntVector& element_tags);
private:
bool m_binary;
size_t m_num_nodes;
size_t m_num_elements;
std::ofstream fout;
};
} //igl
#ifndef IGL_STATIC_LIBRARY
# include "MshSaver.cpp"
#endif
#endif //MSH_SAVER_H
+2 -2
View File
@@ -11,9 +11,9 @@ namespace igl
{
// Use standard mathematical constants' M_PI if available
#ifdef M_PI
const double PI = M_PI;
constexpr double PI = M_PI;
#else
const double PI = 3.1415926535897932384626433832795;
constexpr double PI = 3.1415926535897932384626433832795;
#endif
}
#endif
File diff suppressed because it is too large Load Diff
@@ -1 +0,0 @@
e8898a8aa8e920ab7c2cd0bfaac5acc2e4991daf
+9 -13
View File
@@ -1,5 +1,5 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
@@ -26,34 +26,30 @@ namespace igl
SortableRow(const T & data):data(data){};
bool operator<(const SortableRow & that) const
{
// Get reference so that I can use parenthesis
const SortableRow<T> & THIS = *this;
// Lexicographical
int minc = (THIS.data.size() < that.data.size()?
THIS.data.size() : that.data.size());
int minc = (this->data.size() < that.data.size()?
this->data.size() : that.data.size());
// loop over columns
for(int i = 0;i<minc;i++)
{
if(THIS.data(i) == that.data(i))
if(this->data(i) == that.data(i))
{
continue;
}
return THIS.data(i) < that.data(i);
return this->data(i) < that.data(i);
}
// All characters the same, comes done to length
return THIS.data.size()<that.data.size();
return this->data.size()<that.data.size();
};
bool operator==(const SortableRow & that) const
{
// Get reference so that I can use parenthesis
const SortableRow<T> & THIS = *this;
if(THIS.data.size() != that.data.size())
if(this->data.size() != that.data.size())
{
return false;
}
for(int i = 0;i<THIS.data.size();i++)
for(int i = 0;i<this->data.size();i++)
{
if(THIS.data(i) != that.data(i))
if(this->data(i) != that.data(i))
{
return false;
}
+12
View File
@@ -374,4 +374,16 @@ inline typename DerivedV::Scalar
return igl::winding_number(BV,PBF,p);
}
// This is a bullshit template because AABB annoyingly needs templates for bad
// combinations of 3D V with DIM=2 AABB
//
// _Define_ as a no-op rather than monkeying around with the proper code above
namespace igl
{
template <> inline igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::WindingNumberAABB(const Eigen::MatrixBase<Eigen::Matrix<double, -1, 2, 0, -1, 2>> & V, const Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2>> & F){};
template <> inline void igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::grow(){};
template <> inline void igl::WindingNumberAABB<Eigen::Matrix<double, 1, 3, 1, 1, 3>,Eigen::Matrix<double, -1, 2, 0, -1, 2>,Eigen::Matrix<int, -1, 2, 0, -1, 2>>::init(){};
}
#endif
-2
View File
@@ -164,7 +164,6 @@ inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::WindingNumberTree():
V(dummyV),
SV(),
F(),
//boundary(igl::boundary_facets<Eigen::MatrixXi,Eigen::MatrixXi>(F))
cap(),
radius(std::numeric_limits<typename DerivedV::Scalar>::infinity()),
center(0,0,0)
@@ -180,7 +179,6 @@ inline igl::WindingNumberTree<Point,DerivedV,DerivedF>::WindingNumberTree(
V(dummyV),
SV(),
F(),
//boundary(igl::boundary_facets<Eigen::MatrixXi,Eigen::MatrixXi>(F))
cap(),
radius(std::numeric_limits<typename DerivedV::Scalar>::infinity()),
center(0,0,0)
+52
View File
@@ -0,0 +1,52 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2018 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "accumarray.h"
#include <cassert>
template <
typename DerivedS,
typename DerivedV,
typename DerivedA
>
void igl::accumarray(
const Eigen::MatrixBase<DerivedS> & S,
const Eigen::MatrixBase<DerivedV> & V,
Eigen::PlainObjectBase<DerivedA> & A)
{
assert(V.size() == S.size() && "S and V should be same size");
if(S.size() == 0) { A.resize(0,1); return; }
A.setZero(S.maxCoeff()+1,1);
for(int s = 0;s<S.size();s++)
{
A(S(s)) += V(s);
}
}
template <
typename DerivedS,
typename DerivedA
>
void igl::accumarray(
const Eigen::MatrixBase<DerivedS> & S,
const typename DerivedA::Scalar V,
Eigen::PlainObjectBase<DerivedA> & A)
{
if(S.size() == 0) { A.resize(0,1); return; }
A.setZero(S.maxCoeff()+1,1);
for(int s = 0;s<S.size();s++)
{
A(S(s)) += V;
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::accumarray<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::accumarray<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
#endif
+50
View File
@@ -0,0 +1,50 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2018 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef ACCUMARRY_H
#define ACCUMARRY_H
#include "igl_inline.h"
#include <Eigen/Core>
namespace igl
{
// ACCUMARRY Like Matlab's accumarray. Accumulate values in V using subscripts
// in S.
//
// Inputs:
// S #S list of subscripts
// V #V list of values
// Outputs:
// A max(subs)+1 list of accumulated values
template <
typename DerivedS,
typename DerivedV,
typename DerivedA
>
void accumarray(
const Eigen::MatrixBase<DerivedS> & S,
const Eigen::MatrixBase<DerivedV> & V,
Eigen::PlainObjectBase<DerivedA> & A);
// Inputs:
// S #S list of subscripts
// V single value used for all
// Outputs:
// A max(subs)+1 list of accumulated values
template <
typename DerivedS,
typename DerivedA
>
void accumarray(
const Eigen::MatrixBase<DerivedS> & S,
const typename DerivedA::Scalar V,
Eigen::PlainObjectBase<DerivedA> & A);
}
#ifndef IGL_STATIC_LIBRARY
# include "accumarray.cpp"
#endif
#endif
+2 -2
View File
@@ -223,7 +223,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
}
//cout<<matlab_format((known_i.array()+1).eval(),"known_i")<<endl;
// PREPARE EQUALITY CONSTRAINTS
VectorXi as_ieq_list(as_ieq_count,1);
Eigen::Matrix<typename DerivedY::Scalar, Eigen::Dynamic, 1> as_ieq_list(as_ieq_count,1);
// Gather active constraints and resp. rhss
DerivedBeq Beq_i;
Beq_i.resize(Beq.rows()+as_ieq_count,1);
@@ -345,7 +345,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
{
if(Lambda_Aieq_i(a) < params.inactive_threshold)
{
as_ieq(as_ieq_list(a)) = FALSE;
as_ieq(int(as_ieq_list(a))) = FALSE;
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace igl
struct active_set_params;
// Known Bugs: rows of [Aeq;Aieq] **must** be linearly independent. Should be
// using QR decomposition otherwise:
// http://www.okstate.edu/sas/v8/sashtml/ormp/chap5/sect32.htm
// https://v8doc.sas.com/sashtml/ormp/chap5/sect32.htm
//
// ACTIVE_SET Minimize quadratic energy
//
+20 -8
View File
@@ -12,7 +12,7 @@
template <typename Index, typename IndexVector>
IGL_INLINE void igl::adjacency_list(
const Eigen::PlainObjectBase<Index> & F,
const Eigen::MatrixBase<Index> & F,
std::vector<std::vector<IndexVector> >& A,
bool sorted)
{
@@ -132,8 +132,18 @@ IGL_INLINE void igl::adjacency_list(
const std::vector<std::vector<Index> > & F,
std::vector<std::vector<Index> >& A)
{
A.clear();
A.resize(F.maxCoeff()+1);
A.clear();
// Find maxCoeff
Index maxCoeff = 0;
for(const auto &vec : F)
{
for(int coeff : vec)
{
maxCoeff = std::max(coeff, maxCoeff);
}
}
A.resize(maxCoeff + 1);
// Loop over faces
for(int i = 0;i<F.size();i++)
@@ -142,8 +152,8 @@ IGL_INLINE void igl::adjacency_list(
for(int j = 0;j<F[i].size();j++)
{
// Get indices of edge: s --> d
int s = F(i,j);
int d = F(i,(j+1)%F[i].size());
int s = F[i][j];
int d = F[i][(j+1)%F[i].size()];
A.at(s).push_back(d);
A.at(d).push_back(s);
}
@@ -161,8 +171,10 @@ IGL_INLINE void igl::adjacency_list(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::adjacency_list<Eigen::Matrix<int, -1, 2, 0, -1, 2>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
template void igl::adjacency_list<Eigen::Matrix<int, -1, 2, 0, -1, 2>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
// generated by autoexplicit.sh
template void igl::adjacency_list<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
template void igl::adjacency_list<Eigen::Matrix<int, -1, 3, 0, -1, 3>, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
template void igl::adjacency_list<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
template void igl::adjacency_list<Eigen::Matrix<int, -1, 3, 0, -1, 3>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, bool);
template void igl::adjacency_list<class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned int>(class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1> > const &, class std::vector<class std::vector<unsigned int, class std::allocator<unsigned int> >, class std::allocator<class std::vector<unsigned int, class std::allocator<unsigned int> > > > &, bool);
template void igl::adjacency_list<int>(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
#endif
+1 -1
View File
@@ -31,7 +31,7 @@ namespace igl
// See also: edges, cotmatrix, diag
template <typename Index, typename IndexVector>
IGL_INLINE void adjacency_list(
const Eigen::PlainObjectBase<Index> & F,
const Eigen::MatrixBase<Index> & F,
std::vector<std::vector<IndexVector> >& A,
bool sorted = false);
+56 -5
View File
@@ -1,9 +1,9 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "adjacency_matrix.h"
@@ -13,7 +13,7 @@
template <typename DerivedF, typename T>
IGL_INLINE void igl::adjacency_matrix(
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::SparseMatrix<T>& A)
{
using namespace std;
@@ -65,10 +65,61 @@ IGL_INLINE void igl::adjacency_matrix(
}
}
template <typename DerivedI, typename DerivedC, typename T>
IGL_INLINE void igl::adjacency_matrix(
const Eigen::MatrixBase<DerivedI> & I,
const Eigen::MatrixBase<DerivedC> & C,
Eigen::SparseMatrix<T>& A)
{
using namespace std;
using namespace Eigen;
typedef Triplet<T> IJV;
vector<IJV > ijv;
ijv.reserve(C(C.size()-1)*2);
typedef typename DerivedI::Scalar Index;
const Index n = I.maxCoeff()+1;
{
// loop over polygons
for(Index p = 0;p<C.size()-1;p++)
{
// number of edges
const Index np = C(p+1)-C(p);
// loop over edges
for(Index c = 0;c<np;c++)
{
const Index i = I(C(p)+c);
const Index j = I(C(p)+((c+1)%np));
ijv.emplace_back(i,j,1);
ijv.emplace_back(j,i,1);
}
}
}
A.resize(n,n);
A.reserve(6*n);
A.setFromTriplets(ijv.begin(),ijv.end());
// Force all non-zeros to be one
// Iterate over outside
for(int k=0; k<A.outerSize(); ++k)
{
// Iterate over inside
for(typename Eigen::SparseMatrix<T>::InnerIterator it (A,k); it; ++it)
{
assert(it.value() != 0);
A.coeffRef(it.row(),it.col()) = 1;
}
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::adjacency_matrix<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<int, 0, int>& );
// generated by autoexplicit.sh
template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, bool>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<bool, 0, int>&);
template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
template void igl::adjacency_matrix<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<int, 0, int>&);
template void igl::adjacency_matrix<Eigen::Matrix<int, -1, 3, 0, -1, 3>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::SparseMatrix<int, 0, int>&);
#endif
+16 -1
View File
@@ -21,7 +21,7 @@ namespace igl
// Inputs:
// F #F by dim list of mesh simplices
// Outputs:
// A max(F) by max(F) cotangent matrix, each row i corresponding to V(i,:)
// A max(F)+1 by max(F)+1 adjacency matrix, each row i corresponding to V(i,:)
//
// Example:
// // Mesh in (V,F)
@@ -42,6 +42,21 @@ namespace igl
IGL_INLINE void adjacency_matrix(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::SparseMatrix<T>& A);
// Constructs an vertex adjacency for a polygon mesh.
//
// Inputs:
// I #I vectorized list of polygon corner indices into rows of some matrix V
// C #polygons+1 list of cumulative polygon sizes so that C(i+1)-C(i) =
// size of the ith polygon, and so I(C(i)) through I(C(i+1)-1) are the
// indices of the ith polygon
// Outputs:
// A max(I)+1 by max(I)+1 adjacency matrix, each row i corresponding to V(i,:)
//
template <typename DerivedI, typename DerivedC, typename T>
IGL_INLINE void adjacency_matrix(
const Eigen::MatrixBase<DerivedI> & I,
const Eigen::MatrixBase<DerivedC> & C,
Eigen::SparseMatrix<T>& A);
}
#ifndef IGL_STATIC_LIBRARY
-26
View File
@@ -1,26 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "all_edges.h"
#include "oriented_facets.h"
template <typename DerivedF, typename DerivedE>
IGL_INLINE void igl::all_edges(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedE> & E)
{
return oriented_facets(F,E);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::all_edges<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::all_edges<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
template void igl::all_edges<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
template void igl::all_edges<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::all_edges<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&);
#endif
-38
View File
@@ -1,38 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_ALL_EDGES_H
#define IGL_ALL_EDGES_H
#include "igl_inline.h"
#include <Eigen/Dense>
namespace igl
{
// Deprecated: call oriented_facets instead.
//
// ALL_EDGES Determines all "directed edges" of a given set of simplices. For
// a manifold mesh, this computes all of the half-edges
//
// Inputs:
// F #F by simplex_size list of "faces"
// Outputs:
// E #E by simplex_size-1 list of edges
//
// Note: this is not the same as igl::edges because this includes every
// directed edge including repeats (meaning interior edges on a surface will
// show up once for each direction and non-manifold edges may appear more than
// once for each direction).
template <typename DerivedF, typename DerivedE>
IGL_INLINE void all_edges(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedE> & E);
}
#ifndef IGL_STATIC_LIBRARY
# include "all_edges.cpp"
#endif
#endif
+16 -14
View File
@@ -25,8 +25,8 @@ IGL_INLINE void igl::ambient_occlusion(
const Eigen::Vector3f&,
const Eigen::Vector3f&)
> & shoot_ray,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S)
{
@@ -69,10 +69,10 @@ template <
typename DerivedS >
IGL_INLINE void igl::ambient_occlusion(
const igl::AABB<DerivedV,DIM> & aabb,
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S)
{
@@ -100,10 +100,10 @@ template <
typename DerivedN,
typename DerivedS >
IGL_INLINE void igl::ambient_occlusion(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S)
{
@@ -128,10 +128,12 @@ IGL_INLINE void igl::ambient_occlusion(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
// generated by autoexplicit.sh
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
// generated by autoexplicit.sh
template void igl::ambient_occlusion<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
// generated by autoexplicit.sh
template void igl::ambient_occlusion<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
template void igl::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::function<bool (Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 3, 1, 0, 3, 1> const&)> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
#endif
+10 -10
View File
@@ -34,8 +34,8 @@ namespace igl
const Eigen::Vector3f&,
const Eigen::Vector3f&)
> & shoot_ray,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S);
// Inputs:
@@ -49,10 +49,10 @@ namespace igl
typename DerivedS >
IGL_INLINE void ambient_occlusion(
const igl::AABB<DerivedV,DIM> & aabb,
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S);
// Inputs:
@@ -65,10 +65,10 @@ namespace igl
typename DerivedN,
typename DerivedS >
IGL_INLINE void ambient_occlusion(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<DerivedP> & P,
const Eigen::PlainObjectBase<DerivedN> & N,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
const int num_samples,
Eigen::PlainObjectBase<DerivedS> & S);
-934
View File
@@ -1,934 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "ReAntTweakBar.h"
#include <cstdio>
#include <cstring>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
// GLOBAL WRAPPERS
namespace
{
std::map<
TwType,std::pair<const char *,std::vector<TwEnumVal> >
> ReTw_custom_types;
}
IGL_INLINE TwType igl::anttweakbar::ReTwDefineEnum(
const char *name,
const TwEnumVal *enumValues,
unsigned int nbValues)
{
using namespace std;
// copy enum valus into vector
std::vector<TwEnumVal> enum_vals;
enum_vals.resize(nbValues);
for(unsigned int j = 0; j<nbValues;j++)
{
enum_vals[j] = enumValues[j];
}
TwType type = TwDefineEnum(name,enumValues,nbValues);
ReTw_custom_types[type] =
std::pair<const char *,std::vector<TwEnumVal> >(name,enum_vals);
return type;
}
IGL_INLINE TwType igl::anttweakbar::ReTwDefineEnumFromString(
const char * _Name,
const char * _EnumString)
{
// Taken directly from TwMgr.cpp, just replace TwDefineEnum with
// ReTwDefineEnum
using namespace std;
{
if (_EnumString == NULL)
return ReTwDefineEnum(_Name, NULL, 0);
// split enumString
stringstream EnumStream(_EnumString);
string Label;
vector<string> Labels;
while( getline(EnumStream, Label, ',') ) {
// trim Label
size_t Start = Label.find_first_not_of(" \n\r\t");
size_t End = Label.find_last_not_of(" \n\r\t");
if( Start==string::npos || End==string::npos )
Label = "";
else
Label = Label.substr(Start, (End-Start)+1);
// store Label
Labels.push_back(Label);
}
// create TwEnumVal array
vector<TwEnumVal> Vals(Labels.size());
for( int i=0; i<(int)Labels.size(); i++ )
{
Vals[i].Value = i;
// Wrong:
//Vals[i].Label = Labels[i].c_str();
// Allocate char on heap
// http://stackoverflow.com/a/10050258/148668
char * c_label = new char[Labels[i].length()+1];
std::strcpy(c_label, Labels[i].c_str());
Vals[i].Label = c_label;
}
const TwType type =
ReTwDefineEnum(_Name, Vals.empty() ?
NULL :
&(Vals[0]), (unsigned int)Vals.size());
return type;
}
}
namespace
{
struct ReTwTypeString
{
TwType type;
const char * type_str;
};
#define RETW_NUM_DEFAULT_TYPE_STRINGS 23
ReTwTypeString ReTwDefaultTypeStrings[RETW_NUM_DEFAULT_TYPE_STRINGS] =
{
{TW_TYPE_UNDEF,"TW_TYPE_UNDEF"},
{TW_TYPE_BOOLCPP,"TW_TYPE_BOOLCPP"},
{TW_TYPE_BOOL8,"TW_TYPE_BOOL8"},
{TW_TYPE_BOOL16,"TW_TYPE_BOOL16"},
{TW_TYPE_BOOL32,"TW_TYPE_BOOL32"},
{TW_TYPE_CHAR,"TW_TYPE_CHAR"},
{TW_TYPE_INT8,"TW_TYPE_INT8"},
{TW_TYPE_UINT8,"TW_TYPE_UINT8"},
{TW_TYPE_INT16,"TW_TYPE_INT16"},
{TW_TYPE_UINT16,"TW_TYPE_UINT16"},
{TW_TYPE_INT32,"TW_TYPE_INT32"},
{TW_TYPE_UINT32,"TW_TYPE_UINT32"},
{TW_TYPE_FLOAT,"TW_TYPE_FLOAT"},
{TW_TYPE_DOUBLE,"TW_TYPE_DOUBLE"},
{TW_TYPE_COLOR32,"TW_TYPE_COLOR32"},
{TW_TYPE_COLOR3F,"TW_TYPE_COLOR3F"},
{TW_TYPE_COLOR4F,"TW_TYPE_COLOR4F"},
{TW_TYPE_CDSTRING,"TW_TYPE_CDSTRING"},
{TW_TYPE_STDSTRING,"TW_TYPE_STDSTRING"},
{TW_TYPE_QUAT4F,"TW_TYPE_QUAT4F"},
{TW_TYPE_QUAT4D,"TW_TYPE_QUAT4D"},
{TW_TYPE_DIR3F,"TW_TYPE_DIR3F"},
{TW_TYPE_DIR3D,"TW_TYPE_DIR3D"}
};
}
IGL_INLINE igl::anttweakbar::ReTwBar::ReTwBar():
bar(NULL),
name(),
rw_items(),cb_items()
{
}
IGL_INLINE igl::anttweakbar::ReTwBar::ReTwBar(
const igl::anttweakbar::ReTwBar & that):
bar(that.bar),
name(that.name),
rw_items(that.rw_items),
cb_items(that.cb_items)
{
}
IGL_INLINE igl::anttweakbar::ReTwBar &
igl::anttweakbar::ReTwBar::operator=(const igl::anttweakbar::ReTwBar & that)
{
// check for self assignment
if(this != &that)
{
bar = that.bar;
rw_items = that.rw_items;
cb_items = that.cb_items;
}
return *this;
}
// BAR WRAPPERS
IGL_INLINE void igl::anttweakbar::ReTwBar::TwNewBar(const char * _name)
{
this->bar = ::TwNewBar(_name);
// Alec: This causes trouble (not sure why) in multiple applications
// (medit, puppet) Probably there is some sort of memory corrpution.
// this->name = _name;
// Suspiciously this also fails:
//this->name = "foobar";
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarRW(
const char *name,
TwType type,
void *var,
const char *def,
const bool record)
{
int ret = ::TwAddVarRW(this->bar,name,type,var,def);
if(ret && record)
{
rw_items.push_back(ReTwRWItem(name,type,var));
}
return ret;
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarCB(
const char *name,
TwType type,
TwSetVarCallback setCallback,
TwGetVarCallback getCallback,
void *clientData,
const char *def,
const bool record)
{
int ret =
::TwAddVarCB(this->bar,name,type,setCallback,getCallback,clientData,def);
if(ret && record)
{
cb_items.push_back(ReTwCBItem(name,type,setCallback,getCallback,clientData));
}
return ret;
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarRO(
const char *name,
TwType type,
void *var,
const char *def)
{
int ret = ::TwAddVarRO(this->bar,name,type,var,def);
// Read only variables are not recorded
//if(ret)
//{
// rw_items.push_back(ReTwRWItem(name,type,var));
//}
return ret;
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddButton(
const char *name,
TwButtonCallback buttonCallback,
void *clientData,
const char *def)
{
int ret =
::TwAddButton(this->bar,name,buttonCallback,clientData,def);
// buttons are not recorded
//if(ret)
//{
// cb_items.push_back(ReTwCBItem(name,type,setCallback,getCallback,clientData));
//}
return ret;
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwSetParam(
const char *varName,
const char *paramName,
TwParamValueType paramValueType,
unsigned int inValueCount,
const void *inValues)
{
// For now just pass these along
return
::TwSetParam(
this->bar,
varName,
paramName,
paramValueType,
inValueCount,
inValues);
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwGetParam(
const char *varName,
const char *paramName,
TwParamValueType paramValueType,
unsigned int outValueMaxCount,
void *outValues)
{
return
::TwGetParam(
this->bar,
varName,
paramName,
paramValueType,
outValueMaxCount,
outValues);
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwRefreshBar()
{
return ::TwRefreshBar(this->bar);
}
IGL_INLINE int igl::anttweakbar::ReTwBar::TwTerminate()
{
//std::cout<<"TwTerminate"<<std::endl;
int r = ::TwTerminate();
//std::cout<<" "<<r<<std::endl;
return r;
}
IGL_INLINE bool igl::anttweakbar::ReTwBar::save(const char *file_name)
{
FILE * fp;
if(file_name == NULL)
{
fp = stdout;
}else
{
fp = fopen(file_name,"w");
}
if(fp == NULL)
{
printf("ERROR: not able to open %s for writing...\n",file_name);
return false;
}
// Print all RW variables
for(
std::vector<ReTwRWItem>::iterator it = rw_items.begin();
it != rw_items.end();
it++)
{
std::string s = (*it).name;
const char * name = s.c_str();
TwType type = (*it).type;
void * var = (*it).var;
fprintf(fp,"%s: %s\n",
name,
get_value_as_string(var,type).c_str());
}
char var[REANTTWEAKBAR_MAX_CB_VAR_SIZE];
// Print all CB variables
for(
std::vector<ReTwCBItem>::iterator it = cb_items.begin();
it != cb_items.end();
it++)
{
const char * name = it->name.c_str();
TwType type = it->type;
//TwSetVarCallback setCallback = it->setCallback;
TwGetVarCallback getCallback = it->getCallback;
void * clientData = it->clientData;
// I'm not sure how to do what I want to do. getCallback needs to be sure
// that it can write to var. So var needs to point to a valid and big
// enough chunk of memory
getCallback(var,clientData);
fprintf(fp,"%s: %s\n",
name,
get_value_as_string(var,type).c_str());
}
fprintf(fp,"\n");
if(file_name != NULL)
{
fclose(fp);
}
// everything succeeded
return true;
}
IGL_INLINE std::string igl::anttweakbar::ReTwBar::get_value_as_string(
void * var,
TwType type)
{
std::stringstream sstr;
switch(type)
{
case TW_TYPE_BOOLCPP:
{
sstr << "TW_TYPE_BOOLCPP" << " ";
sstr << *(static_cast<bool*>(var));
break;
}
case TW_TYPE_QUAT4D:
{
sstr << "TW_TYPE_QUAT4D" << " ";
// Q: Why does casting to double* work? shouldn't I have to cast to
// double**?
double * q = static_cast<double*>(var);
sstr << std::setprecision(15) << q[0] << " " << q[1] << " " << q[2] << " " << q[3];
break;
}
case TW_TYPE_QUAT4F:
{
sstr << "TW_TYPE_QUAT4F" << " ";
// Q: Why does casting to float* work? shouldn't I have to cast to
// float**?
float * q = static_cast<float*>(var);
sstr << q[0] << " " << q[1] << " " << q[2] << " " << q[3];
break;
}
case TW_TYPE_COLOR4F:
{
sstr << "TW_TYPE_COLOR4F" << " ";
float * c = static_cast<float*>(var);
sstr << c[0] << " " << c[1] << " " << c[2] << " " << c[3];
break;
}
case TW_TYPE_COLOR3F:
{
sstr << "TW_TYPE_COLOR3F" << " ";
float * c = static_cast<float*>(var);
sstr << c[0] << " " << c[1] << " " << c[2];
break;
}
case TW_TYPE_DIR3D:
{
sstr << "TW_TYPE_DIR3D" << " ";
double * d = static_cast<double*>(var);
sstr << std::setprecision(15) << d[0] << " " << d[1] << " " << d[2];
break;
}
case TW_TYPE_DIR3F:
{
sstr << "TW_TYPE_DIR3F" << " ";
float * d = static_cast<float*>(var);
sstr << d[0] << " " << d[1] << " " << d[2];
break;
}
case TW_TYPE_BOOL32:
{
sstr << "TW_TYPE_BOOL32" << " ";
sstr << *(static_cast<int*>(var));
break;
}
case TW_TYPE_UINT8:
{
sstr << "TW_TYPE_UINT8" << " ";
// Cast to int so that it's human readable
sstr << (int)*(static_cast<unsigned char*>(var));
break;
}
case TW_TYPE_INT32:
{
sstr << "TW_TYPE_INT32" << " ";
sstr << *(static_cast<int*>(var));
break;
}
case TW_TYPE_UINT32:
{
sstr << "TW_TYPE_UINT32" << " ";
sstr << *(static_cast<unsigned int*>(var));
break;
}
case TW_TYPE_FLOAT:
{
sstr << "TW_TYPE_FLOAT" << " ";
sstr << *(static_cast<float*>(var));
break;
}
case TW_TYPE_DOUBLE:
{
sstr << "TW_TYPE_DOUBLE" << " ";
sstr << std::setprecision(15) << *(static_cast<double*>(var));
break;
}
case TW_TYPE_STDSTRING:
{
sstr << "TW_TYPE_STDSTRING" << " ";
std::string *destPtr = static_cast<std::string *>(var);
sstr << destPtr->c_str();
break;
}
default:
{
using namespace std;
std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::const_iterator iter =
ReTw_custom_types.find(type);
if(iter != ReTw_custom_types.end())
{
sstr << (*iter).second.first << " ";
int enum_val = *(static_cast<int*>(var));
// try find display name for enum value
std::vector<TwEnumVal>::const_iterator eit = (*iter).second.second.begin();
bool found = false;
for(;eit<(*iter).second.second.end();eit++)
{
if(enum_val == eit->Value)
{
sstr << eit->Label;
found = true;
break;
}
}
if(!found)
{
sstr << "ERROR_ENUM_VALUE_NOT_DEFINED";
}
}else
{
sstr << "ERROR_TYPE_NOT_SUPPORTED";
}
break;
}
}
return sstr.str();
}
IGL_INLINE bool igl::anttweakbar::ReTwBar::load(const char *file_name)
{
FILE * fp;
fp = fopen(file_name,"r");
if(fp == NULL)
{
printf("ERROR: not able to open %s for reading...\n",file_name);
return false;
}
// go through file line by line
char line[REANTTWEAKBAR_MAX_LINE];
bool still_comments;
char name[REANTTWEAKBAR_MAX_WORD];
char type_str[REANTTWEAKBAR_MAX_WORD];
char value_str[REANTTWEAKBAR_MAX_WORD];
// line number
int j = 0;
bool finished = false;
while(true)
{
// Eat comments
still_comments = true;
while(still_comments)
{
if(fgets(line,REANTTWEAKBAR_MAX_LINE,fp) == NULL)
{
finished = true;
break;
}
// Blank lines and lines that begin with # are comments
still_comments = (line[0] == '#' || line[0] == '\n');
j++;
}
if(finished)
{
break;
}
sscanf(line,"%[^:]: %s %[^\n]",name,type_str,value_str);
//printf("%s: %s %s\n",name, type_str,value_str);
TwType type;
if(!type_from_string(type_str,type))
{
printf("ERROR: %s type not found... Skipping...\n",type_str);
continue;
}
set_value_from_string(name,type,value_str);
}
fclose(fp);
// everything succeeded
return true;
}
IGL_INLINE bool igl::anttweakbar::ReTwBar::type_from_string(
const char *type_str, TwType & type)
{
// first check default types
for(int j = 0; j < RETW_NUM_DEFAULT_TYPE_STRINGS; j++)
{
if(strcmp(type_str,ReTwDefaultTypeStrings[j].type_str) == 0)
{
type = ReTwDefaultTypeStrings[j].type;
return true;
break;
}
}
// then check custom types
std::map<
TwType,std::pair<const char *,std::vector<TwEnumVal> >
>::const_iterator iter =
ReTw_custom_types.begin();
for(;iter != ReTw_custom_types.end(); iter++)
{
if(strcmp((*iter).second.first,type_str)==0)
{
type = (*iter).first;
return true;
}
}
return false;
}
bool igl::anttweakbar::ReTwBar::set_value_from_string(
const char * name,
TwType type,
const char * value_str)
{
void * value = NULL;
// possible value slots
int i;
float v;
double dv;
float f[4];
double d[4];
bool b;
unsigned int u;
unsigned char uc;
std::string s;
// First try to get value from default types
switch(type)
{
case TW_TYPE_BOOLCPP:
{
int ib;
if(sscanf(value_str," %d",&ib) == 1)
{
b = ib!=0;
value = &b;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_QUAT4D:
//case TW_TYPE_COLOR4D:
{
if(sscanf(value_str," %lf %lf %lf %lf",&d[0],&d[1],&d[2],&d[3]) == 4)
{
value = &d;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_QUAT4F:
case TW_TYPE_COLOR4F:
{
if(sscanf(value_str," %f %f %f %f",&f[0],&f[1],&f[2],&f[3]) == 4)
{
value = &f;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
//case TW_TYPE_COLOR3D:
case TW_TYPE_DIR3D:
{
if(sscanf(value_str," %lf %lf %lf",&d[0],&d[1],&d[2]) == 3)
{
value = &d;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_COLOR3F:
case TW_TYPE_DIR3F:
{
if(sscanf(value_str," %f %f %f",&f[0],&f[1],&f[2]) == 3)
{
value = &f;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_UINT8:
{
if(sscanf(value_str," %d",&i) == 1)
{
// Cast to unsigned char
uc = (unsigned char) i;
value = &uc;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_BOOL32:
case TW_TYPE_INT32:
{
if(sscanf(value_str," %d",&i) == 1)
{
value = &i;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_UINT32:
{
if(sscanf(value_str," %u",&u) == 1)
{
value = &u;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_FLOAT:
{
if(sscanf(value_str," %f",&v) == 1)
{
value = &v;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_DOUBLE:
{
if(sscanf(value_str," %lf",&dv) == 1)
{
value = &dv;
}else
{
printf("ERROR: Bad value format...\n");
return false;
}
break;
}
case TW_TYPE_STDSTRING:
{
s = value_str;
value = &s;
break;
}
default:
// Try to find type in custom enum types
std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::const_iterator iter =
ReTw_custom_types.find(type);
if(iter != ReTw_custom_types.end())
{
std::vector<TwEnumVal>::const_iterator eit = (*iter).second.second.begin();
bool found = false;
for(;eit<(*iter).second.second.end();eit++)
{
if(strcmp(value_str,eit->Label) == 0)
{
i = eit->Value;
value = &i;
found = true;
break;
}
}
if(!found)
{
printf("ERROR_ENUM_VALUE_NOT_DEFINED");
}
}else
{
printf("ERROR_TYPE_NOT_SUPPORTED\n");
}
break;
}
// Find variable based on name
// First look in RW items
bool item_found = false;
for(
std::vector<ReTwRWItem>::iterator it = rw_items.begin();
it != rw_items.end();
it++)
{
if(it->name == name)
{
void * var = it->var;
switch(type)
{
case TW_TYPE_BOOLCPP:
{
bool * bvar = static_cast<bool*>(var);
bool * bvalue = static_cast<bool*>(value);
*bvar = *bvalue;
break;
}
case TW_TYPE_QUAT4D:
//case TW_TYPE_COLOR4D:
{
double * dvar = static_cast<double*>(var);
double * dvalue = static_cast<double*>(value);
dvar[0] = dvalue[0];
dvar[1] = dvalue[1];
dvar[2] = dvalue[2];
dvar[3] = dvalue[3];
break;
}
case TW_TYPE_QUAT4F:
case TW_TYPE_COLOR4F:
{
float * fvar = static_cast<float*>(var);
float * fvalue = static_cast<float*>(value);
fvar[0] = fvalue[0];
fvar[1] = fvalue[1];
fvar[2] = fvalue[2];
fvar[3] = fvalue[3];
break;
}
//case TW_TYPE_COLOR3D:
case TW_TYPE_DIR3D:
{
double * dvar = static_cast<double*>(var);
double * dvalue = static_cast<double*>(value);
dvar[0] = dvalue[0];
dvar[1] = dvalue[1];
dvar[2] = dvalue[2];
break;
}
case TW_TYPE_COLOR3F:
case TW_TYPE_DIR3F:
{
float * fvar = static_cast<float*>(var);
float * fvalue = static_cast<float*>(value);
fvar[0] = fvalue[0];
fvar[1] = fvalue[1];
fvar[2] = fvalue[2];
break;
}
case TW_TYPE_UINT8:
{
unsigned char * ucvar = static_cast<unsigned char*>(var);
unsigned char * ucvalue = static_cast<unsigned char*>(value);
*ucvar = *ucvalue;
break;
}
case TW_TYPE_BOOL32:
case TW_TYPE_INT32:
{
int * ivar = static_cast<int*>(var);
int * ivalue = static_cast<int*>(value);
*ivar = *ivalue;
break;
}
case TW_TYPE_UINT32:
{
unsigned int * uvar = static_cast<unsigned int*>(var);
unsigned int * uvalue = static_cast<unsigned int*>(value);
*uvar = *uvalue;
break;
}
case TW_TYPE_FLOAT:
{
float * fvar = static_cast<float*>(var);
float * fvalue = static_cast<float*>(value);
*fvar = *fvalue;
break;
}
case TW_TYPE_DOUBLE:
{
double * dvar = static_cast<double*>(var);
double * fvalue = static_cast<double*>(value);
*dvar = *fvalue;
break;
}
case TW_TYPE_STDSTRING:
{
std::string * svar = static_cast<std::string*>(var);
std::string * svalue = static_cast<std::string*>(value);
*svar = *svalue;
break;
}
default:
// Try to find type in custom enum types
std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::iterator iter =
ReTw_custom_types.find(type);
if(iter != ReTw_custom_types.end())
{
int * ivar = static_cast<int*>(var);
std::vector<TwEnumVal>::iterator eit = (*iter).second.second.begin();
bool found = false;
for(;eit<(*iter).second.second.end();eit++)
{
if(strcmp(value_str,eit->Label) == 0)
{
*ivar = eit->Value;
found = true;
break;
}
}
if(!found)
{
printf("ERROR_ENUM_VALUE_NOT_DEFINED");
}
}else
{
printf("ERROR_TYPE_NOT_SUPPORTED\n");
}
break;
}
item_found = true;
break;
}
}
// Try looking in CB items
if(!item_found)
{
for(
std::vector<ReTwCBItem>::iterator it = cb_items.begin();
it != cb_items.end();
it++)
{
if(it->name==name)
{
it->setCallback(value,it->clientData);
item_found = true;
break;
}
}
}
if(!item_found)
{
printf("ERROR: item '%s' not found\n",name);
}
return true;
}
IGL_INLINE const std::vector<igl::anttweakbar::ReTwRWItem> &
igl::anttweakbar::ReTwBar::get_rw_items()
{
return rw_items;
}
IGL_INLINE const std::vector<igl::anttweakbar::ReTwCBItem> &
igl::anttweakbar::ReTwBar::get_cb_items()
{
return cb_items;
}
-286
View File
@@ -1,286 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_ANTTWEAKBAR_REANTTWEAKBAR_H
#define IGL_ANTTWEAKBAR_REANTTWEAKBAR_H
#include "../igl_inline.h"
// ReAntTweakBar is a minimal wrapper for the AntTweakBar library that allows
// "bars" to be saved and load from disk. Changing your existing app that uses
// AntTweakBar to use ReAntTweakBar is trivial.
//
// Many (but not all) variable types are supported. I'll try to keep track them
// here:
// TW_TYPE_BOOLCPP
// TW_TYPE_QUAT4F
// TW_TYPE_QUAT4D
// TW_TYPE_COLOR4F
// TW_TYPE_COLOR4D
// TW_TYPE_COLOR3F
// TW_TYPE_DIR3F
// TW_TYPE_DIR3D
// TW_TYPE_BOOL32
// TW_TYPE_INT32
// TW_TYPE_UINT32
// TW_TYPE_FLOAT
// TW_TYPE_DOUBLE
// TW_TYPE_UINT8
// and
// custom TwTypes made with TwDefineEnum
//
// I'm working on adding the rest on an as-needed basis. Adding a new type only
// requires changes in a few places...
//
//
//
// This allows the user to have a non-global, static installation of
// AntTweakBar
#include <AntTweakBar.h>
// Instead of including AntTweakBar.h, just define the necessary types
// Types used:
// - TwType
// - TwEnumVal
// - TwSetVarCallback
// - TwGetVarCallback
// - TwBar
// - TwButtonCallback
#include <vector>
#include <string>
#define REANTTWEAKBAR_MAX_CB_VAR_SIZE 1000
// Max line size for reading files
#define REANTTWEAKBAR_MAX_LINE 1000
#define REANTTWEAKBAR_MAX_WORD 100
namespace igl
{
namespace anttweakbar
{
TwType ReTwDefineEnum(
const char *name,
const TwEnumVal *enumValues,
unsigned int nbValues);
TwType ReTwDefineEnumFromString(const char * name,const char * enumString);
struct ReTwRWItem
{
//const char * name;
std::string name;
TwType type;
void * var;
// Default constructor
IGL_INLINE ReTwRWItem(
const std::string _name,
TwType _type,
void *_var):
name(_name),
type(_type),
var(_var)
{
}
// Shallow copy constructor
// I solemnly swear it's OK to copy var this way
// Q: Is it really?
IGL_INLINE ReTwRWItem(const ReTwRWItem & that):
name(that.name),
type(that.type),
var(that.var)
{
}
// Shallow assignment
// I solemnly swear it's OK to copy var this way
IGL_INLINE ReTwRWItem & operator=(const ReTwRWItem & that)
{
if(this != &that)
{
this->name = that.name;
this->type = that.type;
this->var = that.var;
}
return *this;
}
};
struct ReTwCBItem
{
//const char * name;
std::string name;
TwType type;
TwSetVarCallback setCallback;
TwGetVarCallback getCallback;
void * clientData;
// Default constructor
IGL_INLINE ReTwCBItem(
const std::string _name,
TwType _type,
TwSetVarCallback _setCallback,
TwGetVarCallback _getCallback,
void * _clientData):
name(_name),
type(_type),
setCallback(_setCallback),
getCallback(_getCallback),
clientData(_clientData)
{
}
// Shallow copy
// I solemnly swear it's OK to copy clientData this way
IGL_INLINE ReTwCBItem(const ReTwCBItem & that):
name(that.name),
type(that.type),
setCallback(that.setCallback),
getCallback(that.getCallback),
clientData(that.clientData)
{
}
// Shallow assignment
// I solemnly swear it's OK to copy clientData this way
IGL_INLINE ReTwCBItem & operator=(const ReTwCBItem & that)
{
if(this != &that)
{
name = that.name;
type = that.type;
setCallback = that.setCallback;
getCallback = that.getCallback;
clientData = that.clientData;
}
return *this;
}
};
class ReTwBar
{
// VARIABLES
// Should be private, but seeing as I'm not going to implement all of the
// AntTweakBar public functions right away, I'll expose this so that at
// anytime AntTweakBar functions can be called directly on the bar
public:
TwBar * bar;
std::string name;
protected:
std::vector<ReTwRWItem> rw_items;
std::vector<ReTwCBItem> cb_items;
public:
// Default constructor with explicit initialization
IGL_INLINE ReTwBar();
private:
// Copy constructor does shallow copy
IGL_INLINE ReTwBar(const ReTwBar & that);
// Assignment operator does shallow assignment
IGL_INLINE ReTwBar &operator=(const ReTwBar & that);
// WRAPPERS FOR ANTTWEAKBAR FUNCTIONS
public:
IGL_INLINE void TwNewBar(const char *_name);
IGL_INLINE int TwAddVarRW(
const char *name,
TwType type,
void *var,
const char *def,
const bool record=true);
IGL_INLINE int TwAddVarCB(
const char *name,
TwType type,
TwSetVarCallback setCallback,
TwGetVarCallback getCallback,
void *clientData,
const char *def,
const bool record=true);
// Wrappers for convenience (not recorded, just passed on)
IGL_INLINE int TwAddVarRO(const char *name, TwType type, void *var, const char *def);
IGL_INLINE int TwAddButton(
const char *name,
TwButtonCallback buttonCallback,
void *clientData,
const char *def);
IGL_INLINE int TwSetParam(
const char *varName,
const char *paramName,
TwParamValueType paramValueType,
unsigned int inValueCount,
const void *inValues);
IGL_INLINE int TwGetParam(
const char *varName,
const char *paramName,
TwParamValueType paramValueType,
unsigned int outValueMaxCount,
void *outValues);
IGL_INLINE int TwRefreshBar();
IGL_INLINE int TwTerminate();
// IO FUNCTIONS
public:
// Save current items to file
// Input:
// file_name name of file to save data to, can be null which means print
// to stdout
// Return:
// true only if there were no (fatal) errors
IGL_INLINE bool save(const char *file_name);
std::string get_value_as_string(
void * var,
TwType type);
// Load into current items from file
// Input:
// file_name name of input file to load
// Return:
// true only if there were no (fatal) errors
IGL_INLINE bool load(const char *file_name);
// Get TwType from string
// Input
// type_str string of type
// Output
// type TwType converted from string
// Returns
// true only if string matched a valid type
IGL_INLINE bool type_from_string(const char *type_str, TwType & type);
// I realize that I mix std::string and const char * all over the place.
// What can you do...
IGL_INLINE bool set_value_from_string(
const char * name,
TwType type,
const char * value_str);
IGL_INLINE const std::vector<ReTwRWItem> & get_rw_items();
IGL_INLINE const std::vector<ReTwCBItem> & get_cb_items();
};
}
}
// List of TwBar functions
//TW_API TwBar * TW_CALL TwNewBar(const char *barName);
//TW_API int TW_CALL TwDeleteBar(TwBar *bar);
//TW_API int TW_CALL TwDeleteAllBars();
//TW_API int TW_CALL TwSetTopBar(const TwBar *bar);
//TW_API TwBar * TW_CALL TwGetTopBar();
//TW_API int TW_CALL TwSetBottomBar(const TwBar *bar);
//TW_API TwBar * TW_CALL TwGetBottomBar();
//TW_API const char * TW_CALL TwGetBarName(TwBar *bar);
//TW_API int TW_CALL TwGetBarCount();
//TW_API TwBar * TW_CALL TwGetBarByIndex(int barIndex);
//TW_API TwBar * TW_CALL TwGetBarByName(const char *barName);
//TW_API int TW_CALL TwRefreshBar(TwBar *bar);
//TW_API int TW_CALL TwTerminate();
//
//TW_API int TW_CALL TwAddVarRW(TwBar *bar, const char *name, TwType type, void *var, const char *def);
//TW_API int TW_CALL TwAddVarRO(TwBar *bar, const char *name, TwType type, const void *var, const char *def);
//TW_API int TW_CALL TwAddVarCB(TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def);
//TW_API int TW_CALL TwAddButton(TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def);
//TW_API int TW_CALL TwAddSeparator(TwBar *bar, const char *name, const char *def);
//TW_API int TW_CALL TwRemoveVar(TwBar *bar, const char *name);
//TW_API int TW_CALL TwRemoveAllVars(TwBar *bar);
// Until AntTweakBar dependency folder exists, this is header-only
#ifndef IGL_STATIC_LIBRARY
# include "ReAntTweakBar.cpp"
#endif
#endif
@@ -1,81 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "cocoa_key_to_anttweakbar_key.h"
#include <AntTweakBar.h>
IGL_INLINE int igl::anttweakbar::cocoa_key_to_anttweakbar_key(int key)
{
// I've left commented the AntTweakBar key codes that correspond to keys I
// don't have on my keyboard. Please fill this in if you have those keys
switch(key)
{
case 127:
return TW_KEY_BACKSPACE;
case 9:
return TW_KEY_TAB;
//TW_KEY_CLEAR = 0x0c,
case 3://ENTER
case 13:
return TW_KEY_RETURN;
case 27:
return TW_KEY_ESCAPE;
case 32:
return TW_KEY_SPACE;
// IN A GLUT APP 40 is (
//case 40:
case 63272:
return TW_KEY_DELETE;
case 63232:
return TW_KEY_UP;
case 63233:
return TW_KEY_DOWN;
case 63235:
return TW_KEY_RIGHT;
case 63234:
return TW_KEY_LEFT;
//TW_KEY_INSERT,
//TW_KEY_HOME,
//TW_KEY_END,
//TW_KEY_PAGE_UP,
//TW_KEY_PAGE_DOWN,
case 63236:
return TW_KEY_F1;
case 63237:
return TW_KEY_F2;
case 63238:
return TW_KEY_F3;
case 63239:
return TW_KEY_F4;
case 63240:
return TW_KEY_F5;
case 63241:
return TW_KEY_F6;
case 63242:
return TW_KEY_F7;
case 63243:
return TW_KEY_F8;
case 63244:
return TW_KEY_F9;
case 63245:
return TW_KEY_F10;
case 63246:
return TW_KEY_F11;
case 63247:
return TW_KEY_F12;
case 63248:
return TW_KEY_F13;
case 63249:
return TW_KEY_F14;
case 63250:
return TW_KEY_F15;
default:
break;
}
return key;
}
@@ -1,31 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_ANTTWEAKBAR_COCOA_KEY_TO_ANTTWEAKBAR_KEY_H
#define IGL_ANTTWEAKBAR_COCOA_KEY_TO_ANTTWEAKBAR_KEY_H
#include "../igl_inline.h"
namespace igl
{
namespace anttweakbar
{
// Convert an unsigned char (like that from Cocoa apps) to AntTweakBar key
// code.
// See also: TranslateKey() in TwMgr.cpp in AntTweakBar source
// Inputs:
// key unsigned char key from keyboard
// Returns int of new key code
IGL_INLINE int cocoa_key_to_anttweakbar_key(int key);
}
}
#ifndef IGL_STATIC_LIBRARY
# include "cocoa_key_to_anttweakbar_key.cpp"
#endif
#endif
+3 -3
View File
@@ -27,7 +27,7 @@
#include "get_seconds_hires.h"
//#include "MKLEigenInterface.h"
#include "min_quad_dense.h"
#include "kkt_inverse.h"
#include "get_seconds.h"
#include "columnize.h"
@@ -543,7 +543,7 @@ IGL_INLINE bool igl::arap_dof_recomputation(
#endif
// Compute dense solve matrix (alternative of matrix factorization)
//printf("min_quad_dense_precompute()\n");
//printf("kkt_inverse()\n");
MatrixXd Qfull(*Q);
MatrixXd A_eqfull(A_eq);
MatrixXd M_Solve;
@@ -552,7 +552,7 @@ IGL_INLINE bool igl::arap_dof_recomputation(
bool use_lu = data.effective_dim != 2;
//use_lu = false;
//printf("use_lu: %s\n",(use_lu?"TRUE":"FALSE"));
min_quad_dense_precompute(Qfull, A_eqfull, use_lu,M_Solve);
kkt_inverse(Qfull, A_eqfull, use_lu,M_Solve);
double timer0_end = get_seconds_hires();
verbose("Bob timing: %.20f\n", (timer0_end - timer0_start)*1000.0);
+15 -9
View File
@@ -10,13 +10,13 @@
#include "cotmatrix_entries.h"
#include <Eigen/Dense>
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void igl::arap_linear_block(
const MatV & V,
const MatF & F,
const int d,
const igl::ARAPEnergyType energy,
Eigen::SparseMatrix<Scalar> & Kd)
MatK & Kd)
{
switch(energy)
{
@@ -36,13 +36,15 @@ IGL_INLINE void igl::arap_linear_block(
}
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void igl::arap_linear_block_spokes(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd)
MatK & Kd)
{
typedef typename MatK::Scalar Scalar;
using namespace std;
using namespace Eigen;
// simplex size (3: triangles, 4: tetrahedra)
@@ -101,13 +103,15 @@ IGL_INLINE void igl::arap_linear_block_spokes(
Kd.makeCompressed();
}
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void igl::arap_linear_block_spokes_and_rims(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd)
MatK & Kd)
{
typedef typename MatK::Scalar Scalar;
using namespace std;
using namespace Eigen;
// simplex size (3: triangles, 4: tetrahedra)
@@ -183,13 +187,14 @@ IGL_INLINE void igl::arap_linear_block_spokes_and_rims(
Kd.makeCompressed();
}
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void igl::arap_linear_block_elements(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd)
MatK & Kd)
{
typedef typename MatK::Scalar Scalar;
using namespace std;
using namespace Eigen;
// simplex size (3: triangles, 4: tetrahedra)
@@ -249,5 +254,6 @@ IGL_INLINE void igl::arap_linear_block_elements(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template IGL_INLINE void igl::arap_linear_block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, int, igl::ARAPEnergyType, Eigen::SparseMatrix<double, 0, int>&);
template void igl::arap_linear_block<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, Eigen::SparseMatrix<double, 0, int> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, igl::ARAPEnergyType, Eigen::SparseMatrix<double, 0, int>&);
template void igl::arap_linear_block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::SparseMatrix<double, 0, int> >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, int, igl::ARAPEnergyType, Eigen::SparseMatrix<double, 0, int>&);
#endif
+8 -8
View File
@@ -43,32 +43,32 @@ namespace igl
// Kd #V by #V/#F block of the linear constructor matrix corresponding to
// coordinate d
//
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void arap_linear_block(
const MatV & V,
const MatF & F,
const int d,
const igl::ARAPEnergyType energy,
Eigen::SparseMatrix<Scalar> & Kd);
MatK & Kd);
// Helper functions for each energy type
template <typename MatV, typename MatF, typename Scalar>
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void arap_linear_block_spokes(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd);
template <typename MatV, typename MatF, typename Scalar>
MatK & Kd);
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void arap_linear_block_spokes_and_rims(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd);
template <typename MatV, typename MatF, typename Scalar>
MatK & Kd);
template <typename MatV, typename MatF, typename MatK>
IGL_INLINE void arap_linear_block_elements(
const MatV & V,
const MatF & F,
const int d,
Eigen::SparseMatrix<Scalar> & Kd);
MatK & Kd);
}
#ifndef IGL_STATIC_LIBRARY
+18 -12
View File
@@ -1,9 +1,9 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "arap_rhs.h"
#include "arap_linear_block.h"
@@ -12,12 +12,13 @@
#include "cat.h"
#include <iostream>
template<typename DerivedV, typename DerivedF, typename DerivedK>
IGL_INLINE void igl::arap_rhs(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const int dim,
const igl::ARAPEnergyType energy,
Eigen::SparseMatrix<double>& K)
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const int dim,
const igl::ARAPEnergyType energy,
Eigen::SparseCompressedBase<DerivedK>& K)
{
using namespace std;
using namespace Eigen;
@@ -48,7 +49,7 @@ IGL_INLINE void igl::arap_rhs(
return;
}
SparseMatrix<double> KX,KY,KZ;
DerivedK KX,KY,KZ;
arap_linear_block(V,F,0,energy,KX);
arap_linear_block(V,F,1,energy,KY);
if(Vdim == 2)
@@ -62,7 +63,7 @@ IGL_INLINE void igl::arap_rhs(
K = cat(2,cat(2,repdiag(KX,dim),repdiag(KY,dim)),repdiag(KZ,dim));
}else if(dim ==2)
{
SparseMatrix<double> ZZ(KX.rows()*2,KX.cols());
DerivedK ZZ(KX.rows()*2,KX.cols());
K = cat(2,cat(2,
cat(2,repdiag(KX,dim),ZZ),
cat(2,repdiag(KY,dim),ZZ)),
@@ -84,6 +85,11 @@ IGL_INLINE void igl::arap_rhs(
Vdim);
return;
}
}
#ifdef IGL_STATIC_LIBRARY
template void igl::arap_rhs(const Eigen::MatrixBase<Eigen::MatrixXd> & V, const Eigen::MatrixBase<Eigen::MatrixXi> & F,const int dim, const igl::ARAPEnergyType energy,Eigen::SparseCompressedBase<Eigen::SparseMatrix<double>>& K);
#endif
+10 -9
View File
@@ -1,9 +1,9 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_ARAP_RHS_H
#define IGL_ARAP_RHS_H
@@ -25,16 +25,17 @@ namespace igl
// energy igl::ARAPEnergyType enum value defining which energy is being
// used. See igl::ARAPEnergyType.h for valid options and explanations.
// Outputs:
// K #V*dim by #(F|V)*dim*dim matrix such that:
// K #V*dim by #(F|V)*dim*dim matrix such that:
// b = K * reshape(permute(R,[3 1 2]),size(V|F,1)*size(V,2)*size(V,2),1);
//
//
// See also: arap_linear_block
template<typename DerivedV, typename DerivedF, typename DerivedK>
IGL_INLINE void arap_rhs(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const int dim,
const igl::ARAPEnergyType energy,
Eigen::SparseMatrix<double>& K);
Eigen::SparseCompressedBase<DerivedK>& K);
}
#ifndef IGL_STATIC_LIBRARY
#include "arap_rhs.cpp"
@@ -0,0 +1,68 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Oded Stein <oded.stein@columbia.edu>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "average_from_edges_onto_vertices.h"
template<typename DerivedF,typename DerivedE,typename DerivedoE,
typename DeriveduE,typename DeriveduV>
IGL_INLINE void
igl::average_from_edges_onto_vertices(
const Eigen::MatrixBase<DerivedF> &F,
const Eigen::MatrixBase<DerivedE> &E,
const Eigen::MatrixBase<DerivedoE> &oE,
const Eigen::MatrixBase<DeriveduE> &uE,
Eigen::PlainObjectBase<DeriveduV> &uV)
{
using Scalar = typename DeriveduE::Scalar;
using VecX = Eigen::Matrix<Scalar, Eigen::Dynamic, 1>;
using Int = typename DerivedF::Scalar;
assert(E.rows()==F.rows() && "E does not match dimensions of F.");
assert(oE.rows()==F.rows() && "oE does not match dimensions of F.");
assert(E.cols()==3 && F.cols()==3 && oE.cols()==3 &&
"This method is for triangle meshes.");
const Int n = F.maxCoeff()+1;
VecX edgesPerVertex(n);
edgesPerVertex.setZero();
uV.resize(n,1);
uV.setZero();
for(Eigen::Index i=0; i<F.rows(); ++i) {
for(int j=0; j<3; ++j) {
if(oE(i,j)<0) {
continue;
}
const Int e = E(i,j);
const Int vi=F(i,(j+1)%3), vj=F(i,(j+2)%3);
//Count vertex valence
++edgesPerVertex(vi);
++edgesPerVertex(vj);
//Average uE value onto vertices
uV(vi) += uE(e);
uV(vj) += uE(e);
}
}
//Divide by valence
for(Int i=0; i<n; ++i) {
const Scalar valence = edgesPerVertex(i);
if(valence>0) {
uV(i) /= valence;
}
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::average_from_edges_onto_vertices<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::PartialReduxExpr<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::member_norm<double>, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::PartialReduxExpr<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::member_norm<double>, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::average_from_edges_onto_vertices<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::average_from_edges_onto_vertices<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
#endif
@@ -0,0 +1,39 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Oded Stein <oded.stein@columbia.edu>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_AVERAGE_FROM_EDGES_ONTO_VERTICES_H
#define IGL_AVERAGE_FROM_EDGES_ONTO_VERTICES_H
#include "igl_inline.h"
#include <Eigen/Dense>
namespace igl
{
// Move a scalar field defined on edges to vertices by averaging
//
// Input:
// F: triangle mesh connectivity
// E, oE: mapping from halfedges to edges and orientation as generated by
// orient_halfedges
// uE: scalar field defined on edges, one per edge
//
// Output:
// uV: scalar field defined on vertices
template<typename DerivedF,typename DerivedE,typename DerivedoE,
typename DeriveduE,typename DeriveduV>
IGL_INLINE void average_from_edges_onto_vertices(
const Eigen::MatrixBase<DerivedF> &F,
const Eigen::MatrixBase<DerivedE> &E,
const Eigen::MatrixBase<DerivedoE> &oE,
const Eigen::MatrixBase<DeriveduE> &uE,
Eigen::PlainObjectBase<DeriveduV> &uV);
}
#ifndef IGL_STATIC_LIBRARY
# include "average_from_edges_onto_vertices.cpp"
#endif
#endif
+3 -1
View File
@@ -8,7 +8,7 @@
#include "average_onto_faces.h"
template <typename DerivedF, typename DerivedS, typename DerivedSF>
IGL_INLINE void average_onto_faces(
IGL_INLINE void igl::average_onto_faces(
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedS> & S,
Eigen::PlainObjectBase<DerivedSF> & SF)
@@ -22,4 +22,6 @@ IGL_INLINE void average_onto_faces(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::average_onto_faces<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
#endif
+2 -2
View File
@@ -7,11 +7,11 @@
// obtain one at http://mozilla.org/MPL/2.0/.
#include "average_onto_vertices.h"
template<typename DerivedV,typename DerivedF,typename DerivedS>
template<typename DerivedV,typename DerivedF,typename DerivedS,typename DerivedSV >
IGL_INLINE void igl::average_onto_vertices(const Eigen::MatrixBase<DerivedV> &V,
const Eigen::MatrixBase<DerivedF> &F,
const Eigen::MatrixBase<DerivedS> &S,
Eigen::MatrixBase<DerivedS> &SV)
Eigen::PlainObjectBase<DerivedSV> &SV)
{
SV = DerivedS::Zero(V.rows(),S.cols());
Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dynamic,1> COUNT(V.rows());
+9 -9
View File
@@ -1,31 +1,31 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_AVERAGE_ONTO_VERTICES_H
#define IGL_AVERAGE_ONTO_VERTICES_H
#include "igl_inline.h"
#include <Eigen/Dense>
namespace igl
namespace igl
{
// average_onto_vertices
// average_onto_vertices
// Move a scalar field defined on faces to vertices by averaging
//
// Input:
// V,F: mesh
// S: scalar field defined on faces, Fx1
//
//
// Output:
// SV: scalar field defined on vertices
template<typename DerivedV,typename DerivedF,typename DerivedS>
template<typename DerivedV,typename DerivedF,typename DerivedS,typename DerivedSV>
IGL_INLINE void average_onto_vertices(const Eigen::MatrixBase<DerivedV> &V,
const Eigen::MatrixBase<DerivedF> &F,
const Eigen::MatrixBase<DerivedS> &S,
Eigen::MatrixBase<DerivedS> &SV);
Eigen::PlainObjectBase<DerivedSV> &SV);
}
#ifndef IGL_STATIC_LIBRARY
+14 -14
View File
@@ -1,11 +1,12 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "avg_edge_length.h"
#include "edges.h"
#include <vector>
@@ -14,20 +15,19 @@ IGL_INLINE double igl::avg_edge_length(
const Eigen::MatrixBase<DerivedV>& V,
const Eigen::MatrixBase<DerivedF>& F)
{
double avg = 0;
long int count = 0;
typedef typename DerivedF::Scalar Index;
Eigen::Matrix<Index, Eigen::Dynamic, 2> E;
// Augh. Technically this is double counting interior edges...
for (unsigned i=0;i<F.rows();++i)
igl::edges(F, E);
double avg = 0;
for (unsigned i=0;i<E.rows();++i)
{
for (unsigned j=0;j<F.cols();++j)
{
++count;
avg += (V.row(F(i,j)) - V.row(F(i,(j+1)%F.cols()))).norm();
}
avg += (V.row(E(i,0)) - V.row(E(i,1))).norm();
}
return avg / (double) count;
return avg / (double) E.rows();
}
#ifdef IGL_STATIC_LIBRARY
+5 -5
View File
@@ -1,9 +1,9 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_AVERAGEEDGELENGTH_H
#define IGL_AVERAGEEDGELENGTH_H
@@ -13,7 +13,7 @@
#include <string>
#include <vector>
namespace igl
namespace igl
{
// Compute the average edge length for the given triangle mesh
// Templates:
+5 -6
View File
@@ -34,18 +34,13 @@ IGL_INLINE void igl::barycenter(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&);
// generated by autoexplicit.sh
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 4, 0, -1, 4> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&);
@@ -54,4 +49,8 @@ template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::M
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 2, 3, 0, 2, 3>, Eigen::Matrix<double, 2, 3, 0, 2, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 2, 3, 0, 2, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 3, 0, 2, 3> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, 2, 3, 0, 2, 3>, Eigen::Matrix<double, 2, 3, 0, 2, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, 2, 3, 0, 2, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 3, 0, 2, 3> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 2, 0, -1, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&);
template void igl::barycenter<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
#endif
+42
View File
@@ -0,0 +1,42 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "barycentric_interpolation.h"
#include "parallel_for.h"
template <
typename DerivedD,
typename DerivedF,
typename DerivedB,
typename DerivedI,
typename DerivedX>
IGL_INLINE void igl::barycentric_interpolation(
const Eigen::MatrixBase<DerivedD> & D,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedB> & B,
const Eigen::MatrixBase<DerivedI> & I,
Eigen::PlainObjectBase<DerivedX> & X)
{
assert(B.rows() == I.size());
assert(F.cols() == B.cols());
X.setZero(B.rows(),D.cols());
// should use parallel_for
//for(int i = 0;i<X.rows();i++)
parallel_for(X.rows(),[&X,&B,&D,&F,&I](const int i)
{
for(int j = 0;j<F.cols();j++)
{
X.row(i) += B(i,j) * D.row(F(I(i),j));
}
},1000);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::barycentric_interpolation<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
#endif
+42
View File
@@ -0,0 +1,42 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_BARYCENTRIC_INTERPOLATION_H
#define IGL_BARYCENTRIC_INTERPOLATION_H
#include "igl_inline.h"
#include <Eigen/Core>
namespace igl
{
// Interpolate data on a triangle mesh using barycentric coordinates
//
// Inputs:
// D #D by dim list of per-vertex data
// F #F by 3 list of triangle indices
// B #X by 3 list of barycentric corodinates
// I #X list of triangle indices
// Outputs:
// X #X by dim list of interpolated data
template <
typename DerivedD,
typename DerivedF,
typename DerivedB,
typename DerivedI,
typename DerivedX>
IGL_INLINE void barycentric_interpolation(
const Eigen::MatrixBase<DerivedD> & D,
const Eigen::MatrixBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedB> & B,
const Eigen::MatrixBase<DerivedI> & I,
Eigen::PlainObjectBase<DerivedX> & X);
}
#ifndef IGL_STATIC_LIBRARY
# include "barycentric_interpolation.cpp"
#endif
#endif
-44
View File
@@ -1,44 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "barycentric_to_global.h"
// For error printing
#include <cstdio>
#include <vector>
namespace igl
{
template <typename Scalar, typename Index>
IGL_INLINE Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> barycentric_to_global(
const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & V,
const Eigen::Matrix<Index,Eigen::Dynamic,Eigen::Dynamic> & F,
const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & bc)
{
Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> R;
R.resize(bc.rows(),3);
for (unsigned i=0; i<R.rows(); ++i)
{
unsigned id = round(bc(i,0));
double u = bc(i,1);
double v = bc(i,2);
if (id != -1)
R.row(i) = V.row(F(id,0)) +
((V.row(F(id,1)) - V.row(F(id,0))) * u +
(V.row(F(id,2)) - V.row(F(id,0))) * v );
else
R.row(i) << 0,0,0;
}
return R;
}
}
#ifdef IGL_STATIC_LIBRARY
template Eigen::Matrix<double, -1, -1, 0, -1, -1> igl::barycentric_to_global<double, int>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&);
#endif
-42
View File
@@ -1,42 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_BARYCENTRIC2GLOBAL_H
#define IGL_BARYCENTRIC2GLOBAL_H
#include <igl/igl_inline.h>
#include <Eigen/Dense>
#include <Eigen/Sparse>
namespace igl
{
// Converts barycentric coordinates in the embree form to 3D coordinates
// Embree stores barycentric coordinates as triples: fid, bc1, bc2
// fid is the id of a face, bc1 is the displacement of the point wrt the
// first vertex v0 and the edge v1-v0. Similarly, bc2 is the displacement
// wrt v2-v0.
//
// Input:
// V: #Vx3 Vertices of the mesh
// F: #Fxe Faces of the mesh
// bc: #Xx3 Barycentric coordinates, one row per point
//
// Output:
// #X: #Xx3 3D coordinates of all points in bc
template <typename Scalar, typename Index>
IGL_INLINE Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic>
barycentric_to_global(
const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & V,
const Eigen::Matrix<Index,Eigen::Dynamic,Eigen::Dynamic> & F,
const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & bc);
}
#ifndef IGL_STATIC_LIBRARY
# include "barycentric_to_global.cpp"
#endif
#endif
+5
View File
@@ -118,7 +118,12 @@ IGL_INLINE bool igl::bbw(
}
W.col(i) = Wi;
};
#ifdef WIN32
for (int i = 0; i < m; ++i)
optimize_weight(i);
#else
parallel_for(m,optimize_weight,2);
#endif
if(error)
{
return false;
+74
View File
@@ -0,0 +1,74 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "bezier.h"
#include <cassert>
// Adapted from main.c accompanying
// An Algorithm for Automatically Fitting Digitized Curves
// by Philip J. Schneider
// from "Graphics Gems", Academic Press, 1990
template <typename DerivedV, typename DerivedP>
IGL_INLINE void igl::bezier(
const Eigen::MatrixBase<DerivedV> & V,
const typename DerivedV::Scalar t,
Eigen::PlainObjectBase<DerivedP> & P)
{
// working local copy
DerivedV Vtemp = V;
int degree = Vtemp.rows()-1;
/* Triangle computation */
for (int i = 1; i <= degree; i++)
{
for (int j = 0; j <= degree-i; j++)
{
Vtemp.row(j) = ((1.0 - t) * Vtemp.row(j) + t * Vtemp.row(j+1)).eval();
}
}
P = Vtemp.row(0);
}
template <typename DerivedV, typename DerivedT, typename DerivedP>
IGL_INLINE void igl::bezier(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
Eigen::PlainObjectBase<DerivedP> & P)
{
P.resize(T.size(),V.cols());
for(int i = 0;i<T.size();i++)
{
Eigen::Matrix<typename DerivedV::Scalar,1,DerivedV::ColsAtCompileTime> Pi;
bezier(V,T(i),Pi);
P.row(i) = Pi;
}
}
template <typename VMat, typename DerivedT, typename DerivedP>
IGL_INLINE void igl::bezier(
const std::vector<VMat> & spline,
const Eigen::MatrixBase<DerivedT> & T,
Eigen::PlainObjectBase<DerivedP> & P)
{
if(spline.size() == 0) return;
const int m = T.rows();
const int dim = spline[0].cols();
P.resize(m*spline.size(),dim);
for(int c = 0;c<spline.size();c++)
{
assert(dim == spline[c].cols() && "All curves must have same dimension");
DerivedP Pc;
bezier(spline[c],T,Pc);
P.block(m*c,0,m,dim) = Pc;
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::bezier<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::bezier<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::bezier<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> >&);
#endif
+51
View File
@@ -0,0 +1,51 @@
#ifndef BEZIER_H
#define BEZIER_H
#include "igl_inline.h"
#include <Eigen/Core>
#include <vector>
namespace igl
{
// Evaluate a polynomial Bezier Curve.
//
// Inputs:
// V #V by dim list of Bezier control points
// t evaluation parameter within [0,1]
// Outputs:
// P 1 by dim output point
template <typename DerivedV, typename DerivedP>
IGL_INLINE void bezier(
const Eigen::MatrixBase<DerivedV> & V,
const typename DerivedV::Scalar t,
Eigen::PlainObjectBase<DerivedP> & P);
// Evaluate a polynomial Bezier Curve.
//
// Inputs:
// V #V by dim list of Bezier control points
// T #T evaluation parameters within [0,1]
// Outputs:
// P #T by dim output points
template <typename DerivedV, typename DerivedT, typename DerivedP>
IGL_INLINE void bezier(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
Eigen::PlainObjectBase<DerivedP> & P);
// Evaluate a polynomial Bezier spline with a fixed parameter set for each
// sub-curve
//
// Inputs:
// spline #curves list of lists of Bezier control points
// T #T evaluation parameters within [0,1] to use for each spline
// Outputs:
// P #curves*#T by dim output points
template <typename VMat, typename DerivedT, typename DerivedP>
IGL_INLINE void bezier(
const std::vector<VMat> & spline,
const Eigen::MatrixBase<DerivedT> & T,
Eigen::PlainObjectBase<DerivedP> & P);
}
#ifndef IGL_STATIC_LIBRARY
# include "bezier.cpp"
#endif
#endif
+2 -2
View File
@@ -59,7 +59,7 @@ template <
typename DType,
typename PType>
IGL_INLINE void igl::bfs(
const Eigen::SparseMatrix<AType> & A,
const Eigen::SparseCompressedBase<AType> & A,
const size_t s,
std::vector<DType> & D,
std::vector<PType> & P)
@@ -83,7 +83,7 @@ IGL_INLINE void igl::bfs(
D.push_back(f);
P[f] = p;
seen[f] = true;
for(typename Eigen::SparseMatrix<AType>::InnerIterator it (A,f); it; ++it)
for(typename AType::InnerIterator it (A,f); it; ++it)
{
if(it.value()) Q.push({it.index(),f});
}
+1 -1
View File
@@ -42,7 +42,7 @@ namespace igl
typename DType,
typename PType>
IGL_INLINE void bfs(
const Eigen::SparseMatrix<AType> & A,
const Eigen::SparseCompressedBase<AType> & A,
const size_t s,
std::vector<DType> & D,
std::vector<PType> & P);
+7 -7
View File
@@ -12,13 +12,13 @@
template <typename DerivedF, typename DerivedFF, typename DerivedC>
IGL_INLINE void igl::bfs_orient(
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedFF> & FF,
Eigen::PlainObjectBase<DerivedC> & C)
{
using namespace Eigen;
using namespace std;
SparseMatrix<int> A;
SparseMatrix<typename DerivedF::Scalar> A;
orientable_patches(F,C,A);
// number of faces
@@ -30,7 +30,7 @@ IGL_INLINE void igl::bfs_orient(
// Edge sets
const int ES[3][2] = {{1,2},{2,0},{0,1}};
if(&FF != &F)
if(((void*)&FF) != ((void*)&F))
{
FF = F;
}
@@ -38,7 +38,7 @@ IGL_INLINE void igl::bfs_orient(
#pragma omp parallel for
for(int c = 0;c<num_cc;c++)
{
queue<int> Q;
queue<typename DerivedF::Scalar> Q;
// find first member of patch c
for(int f = 0;f<FF.rows();f++)
{
@@ -51,7 +51,7 @@ IGL_INLINE void igl::bfs_orient(
assert(!Q.empty());
while(!Q.empty())
{
const int f = Q.front();
const typename DerivedF::Scalar f = Q.front();
Q.pop();
if(seen(f) > 0)
{
@@ -59,7 +59,7 @@ IGL_INLINE void igl::bfs_orient(
}
seen(f)++;
// loop over neighbors of f
for(typename SparseMatrix<int>::InnerIterator it (A,f); it; ++it)
for(typename SparseMatrix<typename DerivedF::Scalar>::InnerIterator it (A,f); it; ++it)
{
// might be some lingering zeros, and skip self-adjacency
if(it.value() != 0 && it.row() != f)
@@ -96,5 +96,5 @@ IGL_INLINE void igl::bfs_orient(
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::bfs_orient<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::bfs_orient<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
#endif
+2 -2
View File
@@ -25,10 +25,10 @@ namespace igl
//
template <typename DerivedF, typename DerivedFF, typename DerivedC>
IGL_INLINE void bfs_orient(
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedFF> & FF,
Eigen::PlainObjectBase<DerivedC> & C);
};
}
#ifndef IGL_STATIC_LIBRARY
# include "bfs_orient.cpp"
#endif
+31 -27
View File
@@ -22,8 +22,8 @@ template <
typename SType,
typename DerivedW>
IGL_INLINE bool igl::biharmonic_coordinates(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedT> & T,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
const std::vector<std::vector<SType> > & S,
Eigen::PlainObjectBase<DerivedW> & W)
{
@@ -36,32 +36,36 @@ template <
typename SType,
typename DerivedW>
IGL_INLINE bool igl::biharmonic_coordinates(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedT> & T,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
const std::vector<std::vector<SType> > & S,
const int k,
Eigen::PlainObjectBase<DerivedW> & W)
{
using namespace Eigen;
using namespace std;
typedef typename DerivedV::Scalar Scalar;
typedef typename DerivedT::Scalar Integer;
// This is not the most efficient way to build A, but follows "Linear
// Subspace Design for Real-Time Shape Deformation" [Wang et al. 2015].
SparseMatrix<double> A;
SparseMatrix<Scalar> A;
{
DiagonalMatrix<double,Dynamic> Minv;
SparseMatrix<double> L,K;
DiagonalMatrix<Scalar, Dynamic> Minv;
SparseMatrix<Scalar> L, K;
Array<bool,Dynamic,Dynamic> C;
{
Array<bool,Dynamic,1> I;
on_boundary(T,I,C);
}
#ifdef false
#ifdef false
// Version described in paper is "wrong"
// http://www.cs.toronto.edu/~jacobson/images/error-in-linear-subspace-design-for-real-time-shape-deformation-2017-wang-et-al.pdf
SparseMatrix<double> N,Z,M;
SparseMatrix<Scalar> N, Z, M;
normal_derivative(V,T,N);
{
std::vector<Triplet<double> >ZIJV;
std::vector<Triplet<Scalar>> ZIJV;
for(int t =0;t<T.rows();t++)
{
for(int f =0;f<T.cols();f++)
@@ -84,37 +88,37 @@ IGL_INLINE bool igl::biharmonic_coordinates(
K = N+L;
massmatrix(V,T,MASSMATRIX_TYPE_DEFAULT,M);
// normalize
M /= ((VectorXd)M.diagonal()).array().abs().maxCoeff();
M /= ((Matrix<Scalar, Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
Minv =
((VectorXd)M.diagonal().array().inverse()).asDiagonal();
((Matrix<Scalar, Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
#else
Eigen::SparseMatrix<double> M;
Eigen::MatrixXi E;
Eigen::VectorXi EMAP;
Eigen::SparseMatrix<Scalar> M;
Eigen::Matrix<Integer, Dynamic, Dynamic> E;
Eigen::Matrix<Integer, Dynamic, 1> EMAP;
crouzeix_raviart_massmatrix(V,T,M,E,EMAP);
crouzeix_raviart_cotmatrix(V,T,E,EMAP,L);
// Ad #E by #V facet-vertex incidence matrix
Eigen::SparseMatrix<double> Ad(E.rows(),V.rows());
Eigen::SparseMatrix<Scalar> Ad(E.rows(),V.rows());
{
std::vector<Eigen::Triplet<double> > AIJV(E.size());
std::vector<Eigen::Triplet<Scalar>> AIJV(E.size());
for(int e = 0;e<E.rows();e++)
{
for(int c = 0;c<E.cols();c++)
{
AIJV[e+c*E.rows()] = Eigen::Triplet<double>(e,E(e,c),1);
AIJV[e + c * E.rows()] = Eigen::Triplet<Scalar>(e, E(e, c), 1);
}
}
Ad.setFromTriplets(AIJV.begin(),AIJV.end());
}
// Degrees
Eigen::VectorXd De;
Eigen::Matrix<Scalar, Dynamic, 1> De;
sum(Ad,2,De);
Eigen::DiagonalMatrix<double,Eigen::Dynamic> De_diag =
Eigen::DiagonalMatrix<Scalar,Eigen::Dynamic> De_diag =
De.array().inverse().matrix().asDiagonal();
K = L*(De_diag*Ad);
// normalize
M /= ((VectorXd)M.diagonal()).array().abs().maxCoeff();
Minv = ((VectorXd)M.diagonal().array().inverse()).asDiagonal();
M /= ((Matrix<Scalar, Dynamic, 1>)M.diagonal()).array().abs().maxCoeff();
Minv = ((Matrix<Scalar, Dynamic, 1>)M.diagonal().array().inverse()).asDiagonal();
// kill boundary edges
for(int f = 0;f<T.rows();f++)
{
@@ -159,9 +163,9 @@ IGL_INLINE bool igl::biharmonic_coordinates(
}
const size_t dim = T.cols()-1;
// Might as well be dense... I think...
MatrixXd J = MatrixXd::Zero(mp+mr,mp+r*(dim+1));
VectorXi b(mp+mr);
MatrixXd H(mp+r*(dim+1),dim);
Matrix<Scalar, Dynamic, Dynamic> J = Matrix<Scalar, Dynamic, Dynamic>::Zero(mp+mr,mp+r*(dim+1));
Matrix<Integer, Dynamic, 1> b(mp+mr);
Matrix<Scalar, Dynamic, Dynamic> H(mp+r*(dim+1),dim);
{
int v = 0;
int c = 0;
@@ -194,10 +198,10 @@ IGL_INLINE bool igl::biharmonic_coordinates(
// minimize ½ W' A W'
// subject to W(b,:) = J
return min_quad_with_fixed(
A,VectorXd::Zero(A.rows()).eval(),b,J,SparseMatrix<double>(),VectorXd(),true,W);
A,Matrix<Scalar, Dynamic, 1>::Zero(A.rows()).eval(),b,J,SparseMatrix<Scalar>(),Matrix<Scalar, Dynamic, 1>(),true,W);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template bool igl::biharmonic_coordinates<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template bool igl::biharmonic_coordinates<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
#endif
+4 -4
View File
@@ -66,8 +66,8 @@ namespace igl
typename SType,
typename DerivedW>
IGL_INLINE bool biharmonic_coordinates(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedT> & T,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
const std::vector<std::vector<SType> > & S,
Eigen::PlainObjectBase<DerivedW> & W);
// k 2-->biharmonic, 3-->triharmonic
@@ -77,8 +77,8 @@ namespace igl
typename SType,
typename DerivedW>
IGL_INLINE bool biharmonic_coordinates(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedT> & T,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedT> & T,
const std::vector<std::vector<SType> > & S,
const int k,
Eigen::PlainObjectBase<DerivedW> & W);
@@ -1,9 +1,9 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
//
// Copyright (C) 2017 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "bijective_composite_harmonic_mapping.h"
@@ -51,11 +51,11 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
assert(F.cols() == 3 && "F should contain triangles");
int tries = 0;
int nsteps = min_steps;
Derivedbc bc0;
Eigen::Matrix<typename Derivedbc::Scalar, Eigen::Dynamic, Eigen::Dynamic> bc0;
slice(V,b,1,bc0);
// It's difficult to check for flips "robustly" in the sense that the input
// mesh might not have positive/consistent sign to begin with.
// mesh might not have positive/consistent sign to begin with.
while(nsteps<=max_steps)
{
@@ -71,7 +71,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
// of the boundary conditions. Something like "Homotopic Morphing of
// Planar Curves" [Dym et al. 2015] but also handling multiple connected
// components.
Derivedbc bct = bc0 + t*(bc - bc0);
Eigen::Matrix<typename Derivedbc::Scalar, Eigen::Dynamic, Eigen::Dynamic> bct = bc0 + t * (bc - bc0);
// Compute dsicrete harmonic map using metric of previous step
for(int iter = 0;iter<num_inner_iters;iter++)
{
@@ -82,7 +82,7 @@ IGL_INLINE bool igl::bijective_composite_harmonic_mapping(
//mw.save_index(b,"b");
//mw.save(bct,"bct");
//mw.write("numerical.mat");
harmonic(DerivedU(U),F,b,bct,1,U);
harmonic(Eigen::Matrix<typename DerivedU::Scalar, Eigen::Dynamic, Eigen::Dynamic>(U), F, b, bct, 1, U);
igl::slice(U,b,1,bct);
nans = (U.array() != U.array()).count();
if(test_for_flips)
+71
View File
@@ -0,0 +1,71 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "blkdiag.h"
template <typename Scalar>
IGL_INLINE void igl::blkdiag(
const std::vector<Eigen::SparseMatrix<Scalar>> & L,
Eigen::SparseMatrix<Scalar> & Y)
{
int nr = 0;
int nc = 0;
int nnz = 0;
for(const auto & A : L)
{
nr += A.rows();
nc += A.cols();
}
Y.resize(nr,nc);
{
int i = 0;
int j = 0;
for(const auto & A : L)
{
for(int k = 0;k<A.outerSize();++k)
{
for(typename Eigen::SparseMatrix<Scalar>::InnerIterator it(A,k);it;++it)
{
Y.insert(i+it.row(),j+k) = it.value();
}
}
i += A.rows();
j += A.cols();
}
}
}
template <typename DerivedY>
IGL_INLINE void igl::blkdiag(
const std::vector<DerivedY> & L,
Eigen::PlainObjectBase<DerivedY> & Y)
{
int nr = 0;
int nc = 0;
for(const auto & A : L)
{
nr += A.rows();
nc += A.cols();
}
Y.setZero(nr,nc);
{
int i = 0;
int j = 0;
for(const auto & A : L)
{
Y.block(i,j,A.rows(),A.cols()) = A;
i += A.rows();
j += A.cols();
}
}
}
#ifdef IGL_STATIC_LIBRARY
// explicit template instantiations
template void igl::blkdiag<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::blkdiag<double>(std::vector<Eigen::SparseMatrix<double, 0, int>, std::allocator<Eigen::SparseMatrix<double, 0, int> > > const&, Eigen::SparseMatrix<double, 0, int>&);
#endif
+40
View File
@@ -0,0 +1,40 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_BLKDIAG_H
#define IGL_BLKDIAG_H
#include "igl_inline.h"
#include <Eigen/Core>
#include <Eigen/Sparse>
#include <vector>
namespace igl
{
// Given a list of matrices place them along the diagonal as blocks of the
// output matrix. Like matlab's blkdiag.
//
// Inputs:
// L list of matrices {A,B, ...}
// Outputs:
// Y A.rows()+B.rows()+... by A.cols()+B.cols()+... block diagonal
//
// See also: cat, repdiag
template <typename Scalar>
IGL_INLINE void blkdiag(
const std::vector<Eigen::SparseMatrix<Scalar>> & L,
Eigen::SparseMatrix<Scalar> & Y);
template <typename DerivedY>
IGL_INLINE void blkdiag(
const std::vector<DerivedY> & L,
Eigen::PlainObjectBase<DerivedY> & Y);
}
#ifndef IGL_STATIC_LIBRARY
# include "blkdiag.cpp"
#endif
#endif
+372
View File
@@ -0,0 +1,372 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "blue_noise.h"
#include "doublearea.h"
#include "random_points_on_mesh.h"
#include "slice.h"
#include "sortrows.h"
#include "PI.h"
#include "get_seconds.h"
#include <unordered_map>
#include <algorithm>
#include <vector>
namespace igl
{
// It is very important that we use 64bit keys to avoid out of bounds (easy to
// get to happen with dense samplings (e.g., r = 0.0005*bbd)
typedef int64_t BlueNoiseKeyType;
}
// Helper functions
namespace igl
{
// Should probably find and replace with less generic name
//
// Map 3D subscripts (x,y,z) to unique index (return value)
//
// Inputs:
// w side length of w×w×w integer cube lattice
// x subscript along x direction
// y subscript along y direction
// z subscript along z direction
// Returns index value
//
inline BlueNoiseKeyType blue_noise_key(
const BlueNoiseKeyType w, // pass by copy --> int64_t so that multiplication is OK
const BlueNoiseKeyType x, // pass by copy --> int64_t so that multiplication is OK
const BlueNoiseKeyType y, // pass by copy --> int64_t so that multiplication is OK
const BlueNoiseKeyType z) // pass by copy --> int64_t so that multiplication is OK
{
return x+w*(y+w*z);
}
// Determine if a query candidate at position X.row(i) is too close to already
// selected sites (stored in S).
//
// Inputs:
// X #X by 3 list of raw candidate positions
// Xs #Xs by 3 list of corresponding integer cell subscripts
// i index of candidate in question
// S map from cell index to index into X of selected candidate (or -1 if
// cell is currently empty)
// rr Poisson disk radius squared
// w side length of w×w×w integer cube lattice (into which Xs subscripts)
template <
typename DerivedX,
typename DerivedXs>
inline bool blue_noise_far_enough(
const Eigen::MatrixBase<DerivedX> & X,
const Eigen::MatrixBase<DerivedXs> & Xs,
const std::unordered_map<BlueNoiseKeyType,int> & S,
const double & rr,
const int & w,
const int i)
{
const int xi = Xs(i,0);
const int yi = Xs(i,1);
const int zi = Xs(i,2);
BlueNoiseKeyType k = blue_noise_key(w,xi,yi,zi);
int g = 2; // ceil(r/s)
for(int x = std::max(xi-g,0);x<=std::min(xi+g,w-1);x++)
for(int y = std::max(yi-g,0);y<=std::min(yi+g,w-1);y++)
for(int z = std::max(zi-g,0);z<=std::min(zi+g,w-1);z++)
{
if(x!=xi || y!=yi || z!=zi)
{
const BlueNoiseKeyType nk = blue_noise_key(w,x,y,z);
// have already selected from this cell
const auto Siter = S.find(nk);
if(Siter !=S.end() && Siter->second >= 0)
{
const int ni = Siter->second;
// too close
if( (X.row(i)-X.row(ni)).squaredNorm() < rr)
{
return false;
}
}
}
}
return true;
}
// Try to activate a candidate in a given cell
//
// Inputs:
// X #X by 3 list of raw candidate positions
// Xs #Xs by 3 list of corresponding integer cell subscripts
// rr Poisson disk radius squared
// w side length of w×w×w integer cube lattice (into which Xs subscripts)
// nk index of cell in which we'd like to activate a candidate
// M map from cell index to list of candidates
// S map from cell index to index into X of selected candidate (or -1 if
// cell is currently empty)
// active list of indices into X of active candidates
// Outputs:
// M visited candidates deemed too close to already selected points are
// removed
// S updated to reflect activated point (if successful)
// active updated to reflect activated point (if successful)
// Returns true iff activation was successful
template <
typename DerivedX,
typename DerivedXs>
inline bool activate(
const Eigen::MatrixBase<DerivedX> & X,
const Eigen::MatrixBase<DerivedXs> & Xs,
const double & rr,
const int & i,
const int & w,
const BlueNoiseKeyType & nk,
std::unordered_map<BlueNoiseKeyType,std::vector<int> > & M,
std::unordered_map<BlueNoiseKeyType,int> & S,
std::vector<int> & active)
{
assert(M.count(nk));
auto & Mvec = M.find(nk)->second;
auto miter = Mvec.begin();
while(miter != Mvec.end())
{
const int mi = *miter;
// mi is our candidate sample. Is it far enough from all existing
// samples?
if(i>=0 && (X.row(i)-X.row(mi)).squaredNorm() > 4.*rr)
{
// too far skip (reject)
miter++;
} else if(blue_noise_far_enough(X,Xs,S,rr,w,mi))
{
active.push_back(mi);
S.find(nk)->second = mi;
//printf(" found %d\n",mi);
return true;
}else
{
// remove forever (instead of incrementing we swap and eat from the
// back)
//std::swap(*miter,Mvec.back());
*miter = Mvec.back();
bool was_last = (std::next(miter) == Mvec.end());
Mvec.pop_back();
if (was_last) {
// popping from the vector can invalidate the iterator, if it was
// pointing to the last element that was popped. Alternatively,
// one could use indices directly...
miter = Mvec.end();
}
}
}
return false;
}
template <
typename DerivedX,
typename DerivedXs>
inline bool step(
const Eigen::MatrixBase<DerivedX> & X,
const Eigen::MatrixBase<DerivedXs> & Xs,
const double & rr,
const int & w,
std::unordered_map<BlueNoiseKeyType,std::vector<int> > & M,
std::unordered_map<BlueNoiseKeyType,int> & S,
std::vector<int> & active,
std::vector<int> & collected
)
{
//considered.clear();
if(active.size() == 0) return false;
// random entry
const int e = rand() % active.size();
const int i = active[e];
//printf("%d\n",i);
const int xi = Xs(i,0);
const int yi = Xs(i,1);
const int zi = Xs(i,2);
//printf("%d %d %d - %g %g %g\n",xi,yi,zi,X(i,0),X(i,1),X(i,2));
// cell indices of neighbors
int g = 4;
std::vector<BlueNoiseKeyType> N;N.reserve((1+g*1)^3-1);
for(int x = std::max(xi-g,0);x<=std::min(xi+g,w-1);x++)
for(int y = std::max(yi-g,0);y<=std::min(yi+g,w-1);y++)
for(int z = std::max(zi-g,0);z<=std::min(zi+g,w-1);z++)
{
if(x!=xi || y!=yi || z!=zi)
{
//printf(" %d %d %d\n",x,y,z);
const BlueNoiseKeyType nk = blue_noise_key(w,x,y,z);
// haven't yet selected from this cell?
const auto Siter = S.find(nk);
if(Siter !=S.end() && Siter->second < 0)
{
assert(M.find(nk) != M.end());
N.emplace_back(nk);
}
}
}
//printf(" --------\n");
// randomize order: this might be a little paranoid...
std::random_shuffle(std::begin(N), std::end(N));
bool found = false;
for(const BlueNoiseKeyType & nk : N)
{
assert(M.find(nk) != M.end());
if(activate(X,Xs,rr,i,w,nk,M,S,active))
{
found = true;
break;
}
}
if(!found)
{
// remove i from active list
// https://stackoverflow.com/a/60765833/148668
collected.push_back(i);
//printf(" before: "); for(const int j : active) { printf("%d ",j); } printf("\n");
std::swap(active[e], active.back());
//printf(" after : "); for(const int j : active) { printf("%d ",j); } printf("\n");
active.pop_back();
//printf(" removed %d\n",i);
}
//printf(" active: "); for(const int j : active) { printf("%d ",j); } printf("\n");
return true;
}
}
template <
typename DerivedV,
typename DerivedF,
typename DerivedB,
typename DerivedFI,
typename DerivedP>
IGL_INLINE void igl::blue_noise(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const typename DerivedV::Scalar r,
Eigen::PlainObjectBase<DerivedB> & B,
Eigen::PlainObjectBase<DerivedFI> & FI,
Eigen::PlainObjectBase<DerivedP> & P)
{
typedef typename DerivedV::Scalar Scalar;
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1> VectorXS;
// float+RowMajor is faster...
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,3,Eigen::RowMajor> MatrixX3S;
assert(V.cols() == 3 && "Only 3D embeddings allowed");
// minimum radius
const Scalar min_r = r;
// cell size based on 3D distance
// It works reasonably well (but is probably biased to use s=2*r/√3 here and
// g=1 in the outer loop below.
//
// One thing to try would be to store a list in S (rather than a single point)
// or equivalently a mask over M and just use M as a generic spatial hash
// (with arbitrary size) and then tune its size (being careful to make g a
// function of r and s; and removing the `if S=-1 checks`)
const Scalar s = r/sqrt(3.0);
const double area =
[&](){Eigen::VectorXd A;igl::doublearea(V,F,A);return A.array().sum()/2;}();
// Circle packing in the plane has igl::PI*sqrt(3)/6 efficiency
const double expected_number_of_points =
area * (igl::PI * sqrt(3.0) / 6.0) / (igl::PI * min_r * min_r / 4.0);
// Make a uniform random sampling with 30*expected_number_of_points.
const int nx = 30.0*expected_number_of_points;
MatrixX3S X,XB;
Eigen::VectorXi XFI;
igl::random_points_on_mesh(nx,V,F,XB,XFI,X);
// Rescale so that s = 1
Eigen::Matrix<int,Eigen::Dynamic,3,Eigen::RowMajor> Xs =
((X.rowwise()-X.colwise().minCoeff())/s).template cast<int>();
const int w = Xs.maxCoeff()+1;
{
Eigen::VectorXi I;
igl::sortrows(decltype(Xs)(Xs),true,Xs,I);
igl::slice(decltype(X)(X),I,1,X);
// These two could be spun off in their own thread.
igl::slice(decltype(XB)(XB),I,1,XB);
igl::slice(decltype(XFI)(XFI),I,1,XFI);
}
// Initialization
std::unordered_map<BlueNoiseKeyType,std::vector<int> > M;
std::unordered_map<BlueNoiseKeyType, int > S;
// attempted to seed
std::unordered_map<BlueNoiseKeyType, int > A;
// Q: Too many?
// A: Seems to help though.
M.reserve(Xs.rows());
S.reserve(Xs.rows());
for(int i = 0;i<Xs.rows();i++)
{
BlueNoiseKeyType k = blue_noise_key(w,Xs(i,0),Xs(i,1),Xs(i,2));
const auto Miter = M.find(k);
if(Miter == M.end())
{
M.insert({k,{i}});
}else
{
Miter->second.push_back(i);
}
S.emplace(k,-1);
A.emplace(k,false);
}
std::vector<int> active;
// precompute r²
// Q: is this necessary?
const double rr = r*r;
std::vector<int> collected;
collected.reserve(2.0*expected_number_of_points);
auto Mouter = M.begin();
// Just take the first point as the initial seed
const auto initialize = [&]()->bool
{
while(true)
{
if(Mouter == M.end())
{
return false;
}
const BlueNoiseKeyType k = Mouter->first;
// Haven't placed in this cell yet
if(S[k]<0)
{
if(activate(X,Xs,rr,-1,w,k,M,S,active)) return true;
}
Mouter++;
}
assert(false && "should not be reachable.");
};
// important if mesh contains many connected components
while(initialize())
{
while(active.size()>0)
{
step(X,Xs,rr,w,M,S,active,collected);
}
}
{
const int n = collected.size();
P.resize(n,3);
B.resize(n,3);
FI.resize(n);
for(int i = 0;i<n;i++)
{
const int c = collected[i];
P.row(i) = X.row(c).template cast<typename DerivedP::Scalar>();
B.row(i) = XB.row(c).template cast<typename DerivedB::Scalar>();
FI(i) = XFI(c);
}
}
}
#ifdef IGL_STATIC_LIBRARY
template void igl::blue_noise<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<float, -1, 3, 1, -1, 3>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
template void igl::blue_noise<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
#endif
+49
View File
@@ -0,0 +1,49 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2020 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_BLUE_NOISE_H
#define IGL_BLUE_NOISE_H
#include "igl_inline.h"
#include <Eigen/Core>
namespace igl
{
// "Fast Poisson Disk Sampling in Arbitrary Dimensions" [Bridson 2007]
//
// For very dense samplings this is faster than (up to 2x) cyCodeBase's
// implementation of "Sample Elimination for Generating Poisson Disk Sample
// Sets" [Yuksel 2015]. YMMV
//
// Inputs:
// V #V by dim list of mesh vertex positions
// F #F by 3 list of mesh triangle indices into rows of V
// r Poisson disk radius (evaluated according to Euclidean distance on V)
// Outputs:
// B #P by 3 list of barycentric coordinates, ith row are coordinates of
// ith sampled point in face FI(i)
// FI #P list of indices into F
// P #P by dim list of sample positions.
// See also: random_points_on_mesh
template <
typename DerivedV,
typename DerivedF,
typename DerivedB,
typename DerivedFI,
typename DerivedP>
IGL_INLINE void blue_noise(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
const typename DerivedV::Scalar r,
Eigen::PlainObjectBase<DerivedB> & B,
Eigen::PlainObjectBase<DerivedFI> & FI,
Eigen::PlainObjectBase<DerivedP> & P);
}
#ifndef IGL_STATIC_LIBRARY
# include "blue_noise.cpp"
#endif
#endif
+2 -2
View File
@@ -9,7 +9,7 @@
template <typename DerivedBE, typename DerivedP>
IGL_INLINE void igl::bone_parents(
const Eigen::PlainObjectBase<DerivedBE>& BE,
const Eigen::MatrixBase<DerivedBE>& BE,
Eigen::PlainObjectBase<DerivedP>& P)
{
P.resize(BE.rows(),1);
@@ -28,5 +28,5 @@ IGL_INLINE void igl::bone_parents(
}
#ifdef IGL_STATIC_LIBRARY
template void igl::bone_parents<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::bone_parents<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
#endif
+1 -1
View File
@@ -20,7 +20,7 @@ namespace igl
//
template <typename DerivedBE, typename DerivedP>
IGL_INLINE void bone_parents(
const Eigen::PlainObjectBase<DerivedBE>& BE,
const Eigen::MatrixBase<DerivedBE>& BE,
Eigen::PlainObjectBase<DerivedP>& P);
}
+118 -37
View File
@@ -7,19 +7,127 @@
// obtain one at http://mozilla.org/MPL/2.0/.
#include "boundary_facets.h"
#include "face_occurrences.h"
// IGL includes
#include "list_to_matrix.h"
#include "matrix_to_list.h"
#include "sort.h"
#include "unique_rows.h"
#include "accumarray.h"
#include "slice_mask.h"
#include <Eigen/Core>
// STL includes
#include <map>
#include <iostream>
template <
typename DerivedT,
typename DerivedF,
typename DerivedJ,
typename DerivedK>
IGL_INLINE void igl::boundary_facets(
const Eigen::MatrixBase<DerivedT>& T,
Eigen::PlainObjectBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedJ>& J,
Eigen::PlainObjectBase<DerivedK>& K)
{
const int simplex_size = T.cols();
// Handle boring base case
if(T.rows() == 0)
{
F.resize(0,simplex_size-1);
J.resize(0,1);
K.resize(0,1);
return;
}
// Get a list of all facets
DerivedF allF(T.rows()*simplex_size,simplex_size-1);
// Gather faces (e.g., loop over tets)
for(int i = 0; i< (int)T.rows();i++)
{
switch(simplex_size)
{
case 4:
// get face in correct order
allF(i*simplex_size+0,0) = T(i,1);
allF(i*simplex_size+0,1) = T(i,3);
allF(i*simplex_size+0,2) = T(i,2);
// get face in correct order
allF(i*simplex_size+1,0) = T(i,0);
allF(i*simplex_size+1,1) = T(i,2);
allF(i*simplex_size+1,2) = T(i,3);
// get face in correct order
allF(i*simplex_size+2,0) = T(i,0);
allF(i*simplex_size+2,1) = T(i,3);
allF(i*simplex_size+2,2) = T(i,1);
// get face in correct order
allF(i*simplex_size+3,0) = T(i,0);
allF(i*simplex_size+3,1) = T(i,1);
allF(i*simplex_size+3,2) = T(i,2);
break;
case 3:
allF(i*simplex_size+0,0) = T(i,1);
allF(i*simplex_size+0,1) = T(i,2);
allF(i*simplex_size+1,0) = T(i,2);
allF(i*simplex_size+1,1) = T(i,0);
allF(i*simplex_size+2,0) = T(i,0);
allF(i*simplex_size+2,1) = T(i,1);
break;
}
}
DerivedF sortedF;
igl::sort(allF,2,true,sortedF);
Eigen::VectorXi m,n;
{
DerivedF _1;
igl::unique_rows(sortedF,_1,m,n);
}
Eigen::VectorXi C;
igl::accumarray(n,1,C);
const int ones = (C.array()==1).count();
// Resize output to fit number of non-twos
F.resize(ones, allF.cols());
J.resize(F.rows(),1);
K.resize(F.rows(),1);
int k = 0;
for(int c = 0;c< (int)C.size();c++)
{
if(C(c) == 1)
{
const int i = m(c);
assert(k<(int)F.rows());
F.row(k) = allF.row(i);
J(k) = i/simplex_size;
K(k) = i%simplex_size;
k++;
}
}
assert(k==(int)F.rows());
}
template <typename DerivedT, typename DerivedF>
IGL_INLINE void igl::boundary_facets(
const Eigen::MatrixBase<DerivedT>& T,
Eigen::PlainObjectBase<DerivedF>& F)
{
Eigen::VectorXi J,K;
return boundary_facets(T,F,J,K);
}
template <typename DerivedT, typename Ret>
Ret igl::boundary_facets(
const Eigen::MatrixBase<DerivedT>& T)
{
Ret F;
igl::boundary_facets(T,F);
return F;
}
template <typename IntegerT, typename IntegerF>
IGL_INLINE void igl::boundary_facets(
const std::vector<std::vector<IntegerT> > & T,
std::vector<std::vector<IntegerF> > & F)
{
// Kept for legacy reasons. Could probably just delete.
using namespace std;
if(T.size() == 0)
@@ -98,44 +206,17 @@ IGL_INLINE void igl::boundary_facets(
}
#include "list_to_matrix.h"
#include "matrix_to_list.h"
template <typename DerivedT, typename DerivedF>
IGL_INLINE void igl::boundary_facets(
const Eigen::PlainObjectBase<DerivedT>& T,
Eigen::PlainObjectBase<DerivedF>& F)
{
assert(T.cols() == 0 || T.cols() == 4 || T.cols() == 3);
using namespace std;
using namespace Eigen;
// Cop out: use vector of vectors version
vector<vector<typename DerivedT::Scalar> > vT;
matrix_to_list(T,vT);
vector<vector<typename DerivedF::Scalar> > vF;
boundary_facets(vT,vF);
list_to_matrix(vF,F);
}
template <typename DerivedT, typename Ret>
Ret igl::boundary_facets(
const Eigen::PlainObjectBase<DerivedT>& T)
{
Ret F;
igl::boundary_facets(T,F);
return F;
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >&);
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
// generated by autoexplicit.sh
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >&);
// generated by autoexplicit.sh
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
template void igl::boundary_facets<int, int>(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
//template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > igl::boundary_facets(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
//template Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > igl::boundary_facets(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
template void igl::boundary_facets<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
#endif
+17 -12
View File
@@ -18,31 +18,36 @@ namespace igl
// BOUNDARY_FACETS Determine boundary faces (edges) of tetrahedra (triangles)
// stored in T (analogous to qptoolbox's `outline` and `boundary_faces`).
//
// Templates:
// IntegerT integer-value: e.g. int
// IntegerF integer-value: e.g. int
// Input:
// T tetrahedron (triangle) index list, m by 4 (3), where m is the number of tetrahedra
// Output:
// F list of boundary faces, n by 3 (2), where n is the number of boundary faces
// J list of indices into T, n by 1
// K list of indices revealing across from which vertex is this facet
//
//
template <typename IntegerT, typename IntegerF>
template <
typename DerivedT,
typename DerivedF,
typename DerivedJ,
typename DerivedK>
IGL_INLINE void boundary_facets(
const std::vector<std::vector<IntegerT> > & T,
std::vector<std::vector<IntegerF> > & F);
// Templates:
// DerivedT integer-value: i.e. from MatrixXi
// DerivedF integer-value: i.e. from MatrixXi
const Eigen::MatrixBase<DerivedT>& T,
Eigen::PlainObjectBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedJ>& J,
Eigen::PlainObjectBase<DerivedK>& K);
template <typename DerivedT, typename DerivedF>
IGL_INLINE void boundary_facets(
const Eigen::PlainObjectBase<DerivedT>& T,
const Eigen::MatrixBase<DerivedT>& T,
Eigen::PlainObjectBase<DerivedF>& F);
// Same as above but returns F
template <typename DerivedT, typename Ret>
Ret boundary_facets(
const Eigen::PlainObjectBase<DerivedT>& T);
const Eigen::MatrixBase<DerivedT>& T);
template <typename IntegerT, typename IntegerF>
IGL_INLINE void boundary_facets(
const std::vector<std::vector<IntegerT> > & T,
std::vector<std::vector<IntegerF> > & F);
}
#ifndef IGL_STATIC_LIBRARY
+8 -7
View File
@@ -14,7 +14,7 @@
template <typename DerivedF, typename Index>
IGL_INLINE void igl::boundary_loop(
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::MatrixBase<DerivedF> & F,
std::vector<std::vector<Index> >& L)
{
using namespace std;
@@ -24,12 +24,12 @@ IGL_INLINE void igl::boundary_loop(
return;
VectorXd Vdummy(F.maxCoeff()+1,1);
DerivedF TT,TTi;
Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> TT,TTi;
vector<std::vector<int> > VF, VFi;
triangle_triangle_adjacency(F,TT,TTi);
vertex_triangle_adjacency(Vdummy,F,VF,VFi);
vector<bool> unvisited = is_border_vertex(Vdummy,F);
vector<bool> unvisited = is_border_vertex(F);
set<int> unseen;
for (size_t i = 0; i < unvisited.size(); ++i)
{
@@ -91,7 +91,7 @@ IGL_INLINE void igl::boundary_loop(
template <typename DerivedF, typename Index>
IGL_INLINE void igl::boundary_loop(
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::MatrixBase<DerivedF>& F,
std::vector<Index>& L)
{
using namespace Eigen;
@@ -130,7 +130,7 @@ IGL_INLINE void igl::boundary_loop(
template <typename DerivedF, typename DerivedL>
IGL_INLINE void igl::boundary_loop(
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::MatrixBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedL>& L)
{
using namespace Eigen;
@@ -142,12 +142,13 @@ IGL_INLINE void igl::boundary_loop(
vector<int> Lvec;
boundary_loop(F,Lvec);
L.resize(Lvec.size());
L.resize(Lvec.size(), 1);
for (size_t i = 0; i < Lvec.size(); ++i)
L(i) = Lvec[i];
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::boundary_loop<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::boundary_loop<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
template void igl::boundary_loop<Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
#endif
+3 -3
View File
@@ -25,7 +25,7 @@ namespace igl
//
template <typename DerivedF, typename Index>
IGL_INLINE void boundary_loop(
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::MatrixBase<DerivedF>& F,
std::vector<std::vector<Index> >& L);
@@ -41,7 +41,7 @@ namespace igl
//
template <typename DerivedF, typename Index>
IGL_INLINE void boundary_loop(
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::MatrixBase<DerivedF>& F,
std::vector<Index>& L);
// Compute ordered boundary loops for a manifold mesh and return the
@@ -56,7 +56,7 @@ namespace igl
//
template <typename DerivedF, typename DerivedL>
IGL_INLINE void boundary_loop(
const Eigen::PlainObjectBase<DerivedF>& F,
const Eigen::MatrixBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedL>& L);
}

Some files were not shown because too many files have changed in this diff Show More