#include "wire_mesh.h" #include "../../list_to_matrix.h" #include "../../slice.h" #include "../../PI.h" #include "convex_hull.h" #include "mesh_boolean.h" #include #include template < typename DerivedWV, typename DerivedWE, typename DerivedV, typename DerivedF, typename DerivedJ> IGL_INLINE void igl::copyleft::cgal::wire_mesh( const Eigen::MatrixBase & WV, const Eigen::MatrixBase & WE, const double th, const int poly_size, const bool solid, Eigen::PlainObjectBase & V, Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & J) { typedef typename DerivedWV::Scalar Scalar; // Canonical polygon to place at each endpoint typedef Eigen::Matrix MatrixX3S; MatrixX3S PV(poly_size,3); for(int p =0;p > > A(WV.rows()); // Inputs: // e index of edge // c index of endpoint [0,1] // p index of polygon vertex // Returns index of corresponding vertex in V const auto index = [&PV,&WV](const int e, const int c, const int p)->int { return WV.rows() + e*2*PV.rows() + PV.rows()*c + p; }; const auto unindex = [&PV,&WV](int v, int & e, int & c, int & p) { assert(v>=WV.rows()); v = v-WV.rows(); e = v/(2*PV.rows()); v = v-e*(2*PV.rows()); c = v/(PV.rows()); v = v-c*(PV.rows()); p = v; }; // loop over all edges for(int e = 0;e RowVector3S; const RowVector3S ev = WV.row(WE(e,1))-WV.row(WE(e,0)); const Scalar len = ev.norm(); // Unit edge vector const RowVector3S uv = ev.normalized(); Eigen::Quaternion q; q = q.FromTwoVectors(RowVector3S(0,0,1),uv); // loop over polygon vertices for(int p = 0;p > vF; std::vector vJ; const auto append_hull = [&V,&vF,&vJ,&unindex,&WV](const Eigen::VectorXi & I, const int j) { MatrixX3S Vv; igl::slice(V,I,1,Vv); Eigen::MatrixXi Fv; convex_hull(Vv,Fv); for(int f = 0;f face(I(Fv(f,0)), I(Fv(f,1)), I(Fv(f,2))); //const bool on_vertex = (face IGL_INLINE void igl::copyleft::cgal::wire_mesh( const Eigen::MatrixBase & WV, const Eigen::MatrixBase & WE, const double th, const int poly_size, Eigen::PlainObjectBase & V, Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & J) { return wire_mesh(WV,WE,th,poly_size,true,V,F,J); } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation template void igl::copyleft::cgal::wire_mesh, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, double, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif