wire_mesh.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // Inputs:
  15. // WV #WV by 3 list of vertex positions
  16. // WE #WE by 2 list of edge indices into WV
  17. // th diameter thickness of wire
  18. // poly_size number of sides on each wire (e.g., 4 would produce wires by
  19. // connecting rectangular prisms).
  20. // solid whether to resolve self-intersections to
  21. // create a "solid" output mesh (cf., [Zhou et al. 2016]
  22. // Outputs:
  23. // V #V by 3 list of output vertices
  24. // F #F by 3 list of output triangle indices into V
  25. // J #F list of indices into [0,#WV+#WE) revealing "birth simplex" of
  26. // output faces J(j) < #WV means the face corresponds to the J(j)th
  27. // vertex in WV. J(j) >= #WV means the face corresponds to the
  28. // (J(j)-#WV)th edge in WE.
  29. template <
  30. typename DerivedWV,
  31. typename DerivedWE,
  32. typename DerivedV,
  33. typename DerivedF,
  34. typename DerivedJ>
  35. IGL_INLINE void wire_mesh(
  36. const Eigen::MatrixBase<DerivedWV> & WV,
  37. const Eigen::MatrixBase<DerivedWE> & WE,
  38. const double th,
  39. const int poly_size,
  40. const bool solid,
  41. Eigen::PlainObjectBase<DerivedV> & V,
  42. Eigen::PlainObjectBase<DerivedF> & F,
  43. Eigen::PlainObjectBase<DerivedJ> & J);
  44. // Default with solid=true
  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. Eigen::PlainObjectBase<DerivedV> & V,
  57. Eigen::PlainObjectBase<DerivedF> & F,
  58. Eigen::PlainObjectBase<DerivedJ> & J);
  59. }
  60. }
  61. }
  62. #ifndef IGL_STATIC_LIBRARY
  63. # include "wire_mesh.cpp"
  64. #endif
  65. #endif