order_facets_around_edges.h 3.3 KB

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