diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h index 071dbd012a0..6306d383ef3 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h @@ -46,25 +46,25 @@ bool do_intersect_circle_box_2(const typename K::Circle_2& circle, FT distance = FT(0); Point center = circle.center(); - if(center.x() < (FT)bbox.xmin()) + if(center.x() < FT(bbox.xmin())) { - d = (FT)bbox.xmin() - center.x(); + d = FT(bbox.xmin()) - center.x(); distance += d * d; } - else if(center.x() > (FT)bbox.xmax()) + else if(center.x() > FT(bbox.xmax())) { - d = center.x() - (FT)bbox.xmax(); + d = center.x() - FT(bbox.xmax()); distance += d * d; } - if(center.y() < (FT)bbox.ymin()) + if(center.y() < FT(bbox.ymin())) { - d = (FT)bbox.ymin() - center.y(); + d = FT(bbox.ymin()) - center.y(); distance += d * d; } - else if(center.y() > (FT)bbox.ymax()) + else if(center.y() > FT(bbox.ymax())) { - d = center.y() - (FT)bbox.ymax(); + d = center.y() - FT(bbox.ymax()); distance += d * d; } diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h index 0e5cc9f9053..bb057a3eb7a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h @@ -50,7 +50,7 @@ do_intersect(const typename K::Tetrahedron_3 &tetrahedron, const typename K::Point_3 &pt, const K&) { - return tetrahedron.has_on_unbounded_side(pt); + return ! tetrahedron.has_on_unbounded_side(pt); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h index c5057cda77d..8470ccd03c6 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h @@ -51,7 +51,7 @@ do_intersect(const typename K::Tetrahedron_3 &tet, typename K::Boolean do_intersect_tetrahedron_bounded(const Bounded &tr, const typename K::Tetrahedron_3 &tet, - const typename K::Point_3 p, + const typename K::Point_3 &p, const K & k) { typedef typename K::Triangle_3 Triangle; diff --git a/Intersections_3/test/Intersections_3/CMakeLists.txt b/Intersections_3/test/Intersections_3/CMakeLists.txt index 06c728fffe6..4ed3ff0c953 100644 --- a/Intersections_3/test/Intersections_3/CMakeLists.txt +++ b/Intersections_3/test/Intersections_3/CMakeLists.txt @@ -21,7 +21,6 @@ if ( CGAL_FOUND ) foreach(cppfile ${cppfiles}) create_single_source_cgal_program( "${cppfile}" ) endforeach() - else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp b/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp index 8dbfd3efe10..447d5c0907d 100644 --- a/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp +++ b/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp @@ -89,6 +89,25 @@ void test_P_Pl() assert(res == p); } +template +void test_P_Tet() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Tetrahedron_3 T; + P p(0,0,0), q(1,0,0), r(1,1,0), s(0,0,1); + T t(p,q,r,s); + P q0(0.1, 0.1, 0.1), q1(10,10,10); + + assert(CGAL::do_intersect(p,t)); + assert(CGAL::do_intersect(t,p)); + + assert(CGAL::do_intersect(q0,t)); + assert(CGAL::do_intersect(t,q0)); + + assert(! CGAL::do_intersect(q1,t)); + assert(! CGAL::do_intersect(t,q1)); +} + int main() { test_P_Cub(); @@ -99,7 +118,6 @@ int main() test_P_R(); test_P_R(); - test_P_S(); test_P_S(); @@ -108,6 +126,9 @@ int main() test_P_Pl(); test_P_Pl(); + + test_P_Tet(); + test_P_Tet(); } #include