wire_mesh.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef IGL_COPYLEFT_CGAL_WIRE_MESH_H
  2. #define IGL_COPYLEFT_CGAL_WIRE_MESH_H
  3. #include "../../igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. namespace copyleft
  8. {
  9. namespace cgal
  10. {
  11. /// Construct a "wire" or "wireframe" or "strut" surface mesh, given a
  12. /// one-dimensional network of straight edges.
  13. ///
  14. /// @param[in] WV #WV by 3 list of vertex positions
  15. /// @param[in] WE #WE by 2 list of edge indices into WV
  16. /// @param[in] th #WE diameter thicknesses of wire edges
  17. /// @param[in] poly_size number of sides on each wire (e.g., 4 would produce wires by
  18. /// connecting rectangular prisms).
  19. /// @param[in] solid whether to resolve self-intersections to
  20. /// create a "solid" output mesh (cf., [Zhou et al. 2016]
  21. /// @param[out] V #V by 3 list of output vertices
  22. /// @param[out] F #F by 3 list of output triangle indices into V
  23. /// @param[out] J #F list of indices into [0,#WV+#WE) revealing "birth simplex" of
  24. /// output faces J(j) < #WV means the face corresponds to the J(j)th
  25. /// vertex in WV. J(j) >= #WV means the face corresponds to the
  26. /// (J(j)-#WV)th edge in WE.
  27. template <
  28. typename DerivedWV,
  29. typename DerivedWE,
  30. typename Derivedth,
  31. typename DerivedV,
  32. typename DerivedF,
  33. typename DerivedJ>
  34. IGL_INLINE void wire_mesh(
  35. const Eigen::MatrixBase<DerivedWV> & WV,
  36. const Eigen::MatrixBase<DerivedWE> & WE,
  37. const Eigen::MatrixBase<Derivedth> & th,
  38. const int poly_size,
  39. const bool solid,
  40. Eigen::PlainObjectBase<DerivedV> & V,
  41. Eigen::PlainObjectBase<DerivedF> & F,
  42. Eigen::PlainObjectBase<DerivedJ> & J);
  43. /// \overload
  44. /// \brief uniform th
  45. template <
  46. typename DerivedWV,
  47. typename DerivedWE,
  48. typename DerivedV,
  49. typename DerivedF,
  50. typename DerivedJ>
  51. IGL_INLINE void wire_mesh(
  52. const Eigen::MatrixBase<DerivedWV> & WV,
  53. const Eigen::MatrixBase<DerivedWE> & WE,
  54. const double th,
  55. const int poly_size,
  56. const bool solid,
  57. Eigen::PlainObjectBase<DerivedV> & V,
  58. Eigen::PlainObjectBase<DerivedF> & F,
  59. Eigen::PlainObjectBase<DerivedJ> & J);
  60. /// \overload
  61. /// \brief Solid == true
  62. template <
  63. typename DerivedWV,
  64. typename DerivedWE,
  65. typename DerivedV,
  66. typename DerivedF,
  67. typename DerivedJ>
  68. IGL_INLINE void wire_mesh(
  69. const Eigen::MatrixBase<DerivedWV> & WV,
  70. const Eigen::MatrixBase<DerivedWE> & WE,
  71. const double th,
  72. const int poly_size,
  73. Eigen::PlainObjectBase<DerivedV> & V,
  74. Eigen::PlainObjectBase<DerivedF> & F,
  75. Eigen::PlainObjectBase<DerivedJ> & J);
  76. }
  77. }
  78. }
  79. #ifndef IGL_STATIC_LIBRARY
  80. # include "wire_mesh.cpp"
  81. #endif
  82. #endif