* add test case * add coplanarity test * another failing test * use orient3d * no printing * reverting... That introduced lots of other failure cases * subdivided knight case * wip predicates * promising predicates version * tri_tri_overlap compiles, header guards, predicate find_* * tests for predicates::find_in... * parallel for * note * mv to predicates * remove old functions * tutorials; extracting segments is broken 904 * fix extraction bug * missing header * capture consts
40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
#include <igl/read_triangle_mesh.h>
|
|
#include <igl/unique.h>
|
|
#include <igl/opengl/glfw/Viewer.h>
|
|
#include <igl/predicates/find_self_intersections.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
|
|
Eigen::MatrixXd V;
|
|
Eigen::MatrixXi F;
|
|
igl::read_triangle_mesh(argc<=1?TUTORIAL_SHARED_PATH "/cow.off":argv[1], V, F);
|
|
|
|
|
|
// Plot the mesh
|
|
igl::opengl::glfw::Viewer viewer;
|
|
viewer.data().set_mesh(V, F);
|
|
|
|
Eigen::VectorXi EI;
|
|
Eigen::MatrixXd EV;
|
|
Eigen::MatrixXi IF,EE;
|
|
Eigen::Array<bool,Eigen::Dynamic,1> CP;
|
|
|
|
if(igl::predicates::find_self_intersections(V,F,IF,CP,EV,EE,EI))
|
|
{
|
|
std::cout<<"Found "<<IF.rows()<<" self intersecting pairs"<<std::endl;
|
|
// plot edge vertices
|
|
viewer.data().set_edges(EV,EE, Eigen::RowVector3d(1,1,1));
|
|
}
|
|
Eigen::VectorXi I;
|
|
igl::unique(IF,I);
|
|
Eigen::VectorXd D = Eigen::MatrixXd::Zero(F.rows(),1);
|
|
D(I).setConstant(1.0);
|
|
viewer.data().set_data(D,0,1,igl::COLOR_MAP_TYPE_PARULA);
|
|
viewer.data().set_face_based(true);
|
|
viewer.data().double_sided=true;
|
|
|
|
// Launch the viewer
|
|
viewer.launch();
|
|
}
|