| 6 | #include <iostream> |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | auto mesh = MR::makeTorusWithSelfIntersections(); // make torus with self-intersections |
| 11 | |
| 12 | auto selfCollidingParis = MR::findSelfCollidingTriangles( mesh ); // find self-intersecting faces pairs |
| 13 | if ( !selfCollidingParis.has_value() ) |
| 14 | { |
| 15 | // check error |
| 16 | std::cerr << selfCollidingParis.error(); |
| 17 | return 1; |
| 18 | } |
| 19 | for ( auto [fl, fr] : *selfCollidingParis ) |
| 20 | std::cout << int( fl ) << " " << int( fr ) << "\n"; // print each pair |
| 21 | |
| 22 | auto selfCollidingBitSet = MR::findSelfCollidingTrianglesBS( mesh ); // find bitset of self-intersecting faces |
| 23 | if ( !selfCollidingBitSet.has_value() ) |
| 24 | { |
| 25 | // check error |
| 26 | std::cerr << selfCollidingBitSet.error(); |
| 27 | return 1; |
| 28 | } |
| 29 | std::cout << selfCollidingBitSet->count() << "\n"; // print number of self-intersecting faces |
| 30 | |
| 31 | auto isSelfColliding = MR::findSelfCollidingTriangles( mesh, nullptr ); // fast check if mesh has self-intersections |
| 32 | if ( !isSelfColliding.has_value() ) |
| 33 | { |
| 34 | // check error |
| 35 | std::cerr << isSelfColliding.error(); |
| 36 | return 1; |
| 37 | } |
| 38 | std::cout << *isSelfColliding << "\n"; |
| 39 | return 0; |
| 40 | } |
nothing calls this directly
no test coverage detected