#include #include #include #include #include Eigen::MatrixXd V1,V2; Eigen::MatrixXi F1,F2; igl::AABB tree; double min_z,max_z; double slice_z; void update_visualization(igl::opengl::glfw::Viewer & viewer) { Eigen::MatrixXi I; Eigen::MatrixXd edges; //shifted intersection object Eigen::MatrixXd V2_(V2.rows(),V2.cols()); V2_<< V2.col(0), V2.col(1), V2.col(2).array()+slice_z; igl::fast_find_intersections(tree, V1,F1, V2_,F2, I,edges); Eigen::MatrixXi edges_link=Eigen::MatrixXi::NullaryExpr(edges.rows()/2,2, [](int i,int j) { return i*2+j;}); // Plot the edges of the intersects viewer.data().set_edges ( edges, edges_link, Eigen::RowVector3d(1,0,0)); // show faces which are intersected Eigen::VectorXd face_data=Eigen::VectorXd::Zero(F1.rows()); for(int i=0; i