Files
igl/tutorial/903_FastFindSelfIntersections/main.cpp
T
Alec JacobsonandAlec Jacobson 112c1b8e48 Dynamic updates to AABB tree; intersection-blocking mesh decimation (#2301)
* working insertion and rotation b-b-b-but pointers aren't stuck to m_primitive

* insert now maintains primitive's pointers;+rotate is now getting heights in right ballpark

* sibling rotations working (and helping); dry run test working (and helping)

* working insertion, deletion (detach), and refit with padding.

* working; inexact

* working; inexact

* working; inexact

* note about poor assumptions

* working well after bug fixes. before refactor into functions

* simple self-intersection test function

* moved all functions to files

* docs

* blocking directly in qslim. better docs. aabb templates/tests;

* dont use size_t and fix namespace

* brute-force too fast on linux

* rm overloads in qslim/decimate; cgal template

* fix coplanar bug; factor out raytri.c

* fix and cgal debug

* refactor fast_find; fix bugs in fast_find; fix bugs in shared_vertex

* tutorials running again

* cleaned up aabb tutorials; templates

* format docs

* docs. arg names

* template name

* improve docs

* debugging test

* debugging test

* debugging test

* debugging test

* debugging test

* debugging test

* debugging test

* debugging test

* ebuggin test

* ebuggin test

* add epsilon to ray_triangle ifs

* erroneous includes

* rm leftover includes

* fix cmake bug

* uh actually fix cmake bug

* missing delete

* simple insert test

* don't pad all leaves F.rows() times

* fix pad bug

---------

Co-authored-by: Alec Jacobson <alecjacobson@adobe.com>
2023-10-14 07:32:50 -04:00

39 lines
1006 B
C++

#include <igl/read_triangle_mesh.h>
#include <igl/unique.h>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/fast_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;
if(igl::fast_find_self_intersections(V,F,false,false,IF,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,0,0));
}
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();
}