remesh_self_intersections.cpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "remesh_self_intersections.h"
  9. #include "SelfIntersectMesh.h"
  10. #include <igl/C_STR.h>
  11. #include <list>
  12. template <
  13. typename DerivedV,
  14. typename DerivedF,
  15. typename DerivedVV,
  16. typename DerivedFF,
  17. typename DerivedIF,
  18. typename DerivedJ,
  19. typename DerivedIM>
  20. IGL_INLINE void igl::remesh_self_intersections(
  21. const Eigen::PlainObjectBase<DerivedV> & V,
  22. const Eigen::PlainObjectBase<DerivedF> & F,
  23. const RemeshSelfIntersectionsParam & params,
  24. Eigen::PlainObjectBase<DerivedVV> & VV,
  25. Eigen::PlainObjectBase<DerivedFF> & FF,
  26. Eigen::PlainObjectBase<DerivedIF> & IF,
  27. Eigen::PlainObjectBase<DerivedJ> & J,
  28. Eigen::PlainObjectBase<DerivedIM> & IM)
  29. {
  30. using namespace std;
  31. if(params.detect_only)
  32. {
  33. //// This is probably a terrible idea, but CGAL is throwing floating point
  34. //// exceptions.
  35. //#ifdef __APPLE__
  36. //#define IGL_THROW_FPE 11
  37. // const auto & throw_fpe = [](int e)
  38. // {
  39. // throw "IGL_THROW_FPE";
  40. // };
  41. // signal(SIGFPE,throw_fpe);
  42. //#endif
  43. typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
  44. typedef
  45. SelfIntersectMesh<
  46. Kernel,
  47. DerivedV,
  48. DerivedF,
  49. DerivedVV,
  50. DerivedFF,
  51. DerivedIF,
  52. DerivedJ,
  53. DerivedIM>
  54. SelfIntersectMeshK;
  55. SelfIntersectMeshK SIM = SelfIntersectMeshK(V,F,params,VV,FF,IF,J,IM);
  56. //#ifdef __APPLE__
  57. // signal(SIGFPE,SIG_DFL);
  58. //#endif
  59. }else
  60. {
  61. typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
  62. typedef
  63. SelfIntersectMesh<
  64. Kernel,
  65. DerivedV,
  66. DerivedF,
  67. DerivedVV,
  68. DerivedFF,
  69. DerivedIF,
  70. DerivedJ,
  71. DerivedIM>
  72. SelfIntersectMeshK;
  73. SelfIntersectMeshK SIM = SelfIntersectMeshK(V,F,params,VV,FF,IF,J,IM);
  74. }
  75. }
  76. #ifdef IGL_STATIC_LIBRARY
  77. // Explicit template specialization
  78. template void igl::remesh_self_intersections<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<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<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::RemeshSelfIntersectionsParam 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<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  79. #endif