From 46c2727ea9dc05deef6dbae7833a683cadb5f346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 15 May 2015 10:15:26 +0200 Subject: [PATCH] add assertions to ensure the origin is on the negative side of the input planes --- .../CGAL/Convex_hull_3/dual/halfspace_intersection_3.h | 4 ++++ .../dual/halfspace_intersection_with_constructions_3.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h index 7ea9e73a8ad..4720d337470 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h @@ -270,6 +270,10 @@ namespace CGAL origin = boost::make_optional(interior.inside_point()); } + // make sure the origin is on the negative side of all the planes + CGAL_assertion_code(for(PlaneIterator pit=begin;pit!=end;++pit)) + CGAL_assertion(pit->has_on_negative_side(*origin)); + // compute the intersection of the half-space using the dual formulation Hull_traits_dual_3 dual_traits(*origin); Polyhedron_dual_3 dual_convex_hull; diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h index 8fbd6384f50..99b72c759a1 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h @@ -146,6 +146,9 @@ namespace CGAL // construct dual points to apply the convex hull std::vector dual_points; for (PlaneIterator p = pbegin; p != pend; ++p) { + // make sure the origin is on the negative side of all the planes + CGAL_assertion(p->has_on_negative_side(p_origin)); + // translate plane Plane translated_p(p->a(), p->b(),