order_facets_around_edges.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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. #ifndef IGL_CGAL_ORDER_FACETS_AROUND_EDGES_H
  9. #define IGL_CGAL_ORDER_FACETS_AROUND_EDGES_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
  13. namespace igl
  14. {
  15. namespace cgal
  16. {
  17. // For each undirected edge, sort its adjacent faces.
  18. //
  19. // Inputs:
  20. // V #V by 3 list of vertices.
  21. // F #F by 3 list of faces
  22. // N #F by 3 list of face normals.
  23. // E #F*3 by 2 list vertex indices, represents directed edges.
  24. // uE #uE by 2 list of vertex_indices, represents undirected edges.
  25. // EMAP #F*3 list of indices that maps E to uE. (a many-to-one map)
  26. // uE2E #uE list of lists that maps uE to E. (a one-to-many map)
  27. //
  28. // Outputs:
  29. // uE2oE #uE list of lists that maps uE to an ordered list of E. (a
  30. // one-to-many map)
  31. // uE2C #uE list of lists of bools indicates whether each face in
  32. // uE2oE[i] is consistently orientated as the ordering.
  33. //
  34. template<
  35. typename DerivedV,
  36. typename DerivedF,
  37. typename DerivedN,
  38. typename DerivedE,
  39. typename DeriveduE,
  40. typename DerivedEMAP,
  41. typename uE2EType,
  42. typename uE2oEType,
  43. typename uE2CType >
  44. IGL_INLINE
  45. typename std::enable_if<!std::is_same<typename DerivedV::Scalar,
  46. typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
  47. order_facets_around_edges(
  48. const Eigen::PlainObjectBase<DerivedV>& V,
  49. const Eigen::PlainObjectBase<DerivedF>& F,
  50. const Eigen::PlainObjectBase<DerivedN>& N,
  51. const Eigen::PlainObjectBase<DerivedE>& E,
  52. const Eigen::PlainObjectBase<DeriveduE>& uE,
  53. const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
  54. const std::vector<std::vector<uE2EType> >& uE2E,
  55. std::vector<std::vector<uE2oEType> >& uE2oE,
  56. std::vector<std::vector<uE2CType > >& uE2C );
  57. template<
  58. typename DerivedV,
  59. typename DerivedF,
  60. typename DerivedN,
  61. typename DerivedE,
  62. typename DeriveduE,
  63. typename DerivedEMAP,
  64. typename uE2EType,
  65. typename uE2oEType,
  66. typename uE2CType >
  67. IGL_INLINE
  68. typename std::enable_if<std::is_same<typename DerivedV::Scalar,
  69. typename CGAL::Exact_predicates_exact_constructions_kernel::FT>::value, void>::type
  70. order_facets_around_edges(
  71. const Eigen::PlainObjectBase<DerivedV>& V,
  72. const Eigen::PlainObjectBase<DerivedF>& F,
  73. const Eigen::PlainObjectBase<DerivedN>& N,
  74. const Eigen::PlainObjectBase<DerivedE>& E,
  75. const Eigen::PlainObjectBase<DeriveduE>& uE,
  76. const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
  77. const std::vector<std::vector<uE2EType> >& uE2E,
  78. std::vector<std::vector<uE2oEType> >& uE2oE,
  79. std::vector<std::vector<uE2CType > >& uE2C );
  80. }
  81. }
  82. #ifndef IGL_STATIC_LIBRARY
  83. #include "order_facets_around_edges.cpp"
  84. #endif
  85. #endif