bug-fix: fix the orientation of the convex polyhedron

This commit is contained in:
Sébastien Loriot 2015-05-11 22:37:29 +02:00
parent 274bdd6357
commit 06be9cf705
3 changed files with 13 additions and 4 deletions

View File

@ -142,7 +142,7 @@ namespace CGAL
B.begin_facet();
do {
B.add_vertex_to_facet(primal_vertices[hf->facet()]);
} while (++hf != h0);
} while (--hf != h0);
B.end_facet();
}
@ -269,7 +269,7 @@ namespace CGAL
P.delegate(build_primal);
// Posterior check if the origin is inside the computed polyhedron
CGAL_assertion_msg(!Convex_hull_3::internal::point_inside_convex_polyhedron(P, p_origin), "halfspace_intersection_3: origin not in the polyhedron");
CGAL_assertion_msg(Convex_hull_3::internal::point_inside_convex_polyhedron(P, p_origin), "halfspace_intersection_3: origin not in the polyhedron");
} else {
// choose exact integral type
#ifdef CGAL_USE_GMP
@ -293,7 +293,7 @@ namespace CGAL
P.delegate(build_primal);
// Posterior check if the origin is inside the computed polyhedron
CGAL_assertion_msg(!Convex_hull_3::internal::point_inside_convex_polyhedron(P, origin), "halfspace_intersection_3: origin not in the polyhedron");
CGAL_assertion_msg(Convex_hull_3::internal::point_inside_convex_polyhedron(P, origin), "halfspace_intersection_3: origin not in the polyhedron");
}
}

View File

@ -100,7 +100,7 @@ namespace CGAL
do
{
B.add_vertex_to_facet(extreme_points[hf->facet()]);
} while (++hf != h0);
} while (--hf != h0);
B.end_facet();
}

View File

@ -4,6 +4,8 @@
#include <CGAL/point_generators_3.h>
#include <vector>
#include <CGAL/IO/Polyhedron_iostream.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Plane_3 Plane;
@ -59,6 +61,13 @@ int main (void) {
assert(P4.size_of_vertices()==8 && P4.size_of_facets()==6);
assert(P5.size_of_vertices()==8 && P5.size_of_facets()==6);
using CGAL::Convex_hull_3::internal::point_inside_convex_polyhedron;
assert(point_inside_convex_polyhedron(P1, Point(0,0,0)));
assert(point_inside_convex_polyhedron(P2, Point(0,0,0)));
assert(point_inside_convex_polyhedron(P3, Point(0,0,0)));
assert(point_inside_convex_polyhedron(P4, Point(0,0,0)));
assert(point_inside_convex_polyhedron(P5, Point(0,0,0)));
return 0;
}