This commit is contained in:
Laurent Rineau 2024-03-22 10:53:18 +01:00
parent 3d14707b0c
commit de34b83d26
1 changed files with 0 additions and 86 deletions

View File

@ -385,92 +385,6 @@ does_first_triangle_intersect_second_triangle_interior(const typename K::Triangl
orientation(*s_max1, *t_max1, *t_max2, *s_max2) == NEGATIVE;
}
// template <typename Kernel>
// bool
// does_first_triangle_intersect_second_triangle_interior_V1(Triangle_3<Kernel> t1, Triangle_3<Kernel> t2)
// {
// if(!do_intersect(t1, t2)) return false;
// // Here we know the two triangles intersect.
// // -> Question: is that intersection strictly included in the interior of t2?
// // Let's answer that question by computing the exact intersection...
// using EK = CGAL::Exact_predicates_exact_constructions_kernel;
// const auto to_exact = CGAL::Cartesian_converter<Kernel, EK>();
// const auto t1_exact = to_exact(t1);
// const auto t2_exact = to_exact(t2);
// const auto intersection_opt = CGAL::intersection(t1_exact, t2_exact);
// CGAL_assume(intersection_opt.has_value());
// const auto& intersection = intersection_opt.value();
// const auto* point = std::get_if<EK::Point_3> (&intersection);
// const auto* segment = std::get_if<EK::Segment_3>(&intersection);
// if(!point && !segment) {
// // then the intersection is a polygon with at least 3 vertices,
// // cannot be strictly included in the boundary of t2
// return true;
// }
// const auto s01 = EK::Segment_3(t1_exact.vertex(0), t1_exact.vertex(1));
// const auto s12 = EK::Segment_3(t1_exact.vertex(1), t1_exact.vertex(2));
// const auto s20 = EK::Segment_3(t1_exact.vertex(2), t1_exact.vertex(0));
// if(point) {
// if(s01.has_on(*point)) return false;
// if(s12.has_on(*point)) return false;
// if(s20.has_on(*point)) return false;
// } else if(segment) {
// if(s01.has_on(segment->source()) && s01.has_on(segment->target())) return false;
// if(s12.has_on(segment->source()) && s12.has_on(segment->target())) return false;
// if(s20.has_on(segment->source()) && s20.has_on(segment->target())) return false;
// }
// return true;
// }
// template <typename Kernel>
// bool
// does_first_triangle_intersect_second_triangle_interior_WRAPPER(Triangle_3<Kernel> t1, Triangle_3<Kernel> t2, Kernel k)
// {
// bool result_v1 = does_first_triangle_intersect_second_triangle_interior_V1(t1, t2);
// bool result_v2 = does_first_triangle_intersect_second_triangle_interior(t1, t2, k);
// CGAL_warning_msg(result_v1 == result_v2, std::invoke([&]() {
// static auto counter = 0;
// std::stringstream ss;
// ss.precision(std::cerr.precision());
// ss << "does_first_triangle_intersect_second_triangle_interior_V1(t1, t2) = " << result_v1 << std::endl;
// ss << "does_first_triangle_intersect_second_triangle_interior(t1, t2, k) = " << result_v2 << std::endl;
// ss << "t1 = " << t1 << std::endl;
// ss << "t2 = " << t2 << std::endl;
// if(counter < 10) {
// std::ofstream out(std::format("dump-bug_triangles_{}.off", counter++));
// // Write the OFF header. There are 6 vertices and 2 faces.
// out << "OFF\n6 2 0\n";
// // Write the vertices of t1.
// for(int i = 0; i < 3; ++i) {
// out << t1.vertex(i).x() << " " << t1.vertex(i).y() << " " << t1.vertex(i).z() << "\n";
// }
// // Write the vertices of t2.
// for(int i = 0; i < 3; ++i) {
// out << t2.vertex(i).x() << " " << t2.vertex(i).y() << " " << t2.vertex(i).z() << "\n";
// }
// // Write the faces. Each face is a triangle made up of 3 vertices.
// // The vertices are 0-indexed and the order in which they were written to the file matters.
// out << "3 0 1 2\n"; // The first face is made up of the first, second, and third vertices.
// out << "3 3 4 5\n"; // The second face is made up of the fourth, fifth, and sixth vertices.
// out.close();
// }
// return ss.str();
// }).c_str());
// return result_v2;
// }
template <typename Kernel>
bool does_tetrahedron_intersect_triangle_interior(typename Kernel::Tetrahedron_3 tet,
typename Kernel::Triangle_3 tr,