fix the orientation of the generated polyhedron in case of 4 non-coplanar points

This commit is contained in:
Sébastien Loriot 2017-07-31 10:36:42 +02:00
parent 594bed8350
commit 04ab1fd268
2 changed files with 26 additions and 2 deletions

View File

@ -690,8 +690,12 @@ ch_quickhull_polyhedron_3(std::list<typename Traits::Point_3>& points,
non_coplanar_quickhull_3(points, tds, traits); non_coplanar_quickhull_3(points, tds, traits);
copy_face_graph(tds,P); copy_face_graph(tds,P);
} }
else else{
make_tetrahedron(v0->point(),v1->point(),v2->point(),v3->point(),P); CGAL_assertion( traits.has_on_positive_side_3_object()(
construct_plane(v2->point(),v1->point(),v0->point()),
v3->point()) );
make_tetrahedron(v0->point(),v1->point(),v3->point(),v2->point(),P);
}
} }
} }

View File

@ -0,0 +1,20 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Polygon_mesh_processing/orientation.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point_3;
typedef CGAL::Polyhedron_3<K> Gm_polyhedron;
int main()
{
Point_3 points[] = { Point_3(1.0, 0.0, 0.0), Point_3(0.0, 1.0, 0.0), Point_3(0.0, 0.0, 1.0), Point_3(0.0, 0.0, 0.0) };
Gm_polyhedron P1;
CGAL::convex_hull_3(points, &points[4], P1);
CGAL_assertion( CGAL::Polygon_mesh_processing::is_outward_oriented(P1) );
Point_3 points_bis[] = { Point_3(0.0, 1.0, 0.0), Point_3(1.0, 0.0, 0.0), Point_3(0.0, 0.0, 1.0), Point_3(0.0, 0.0, 0.0) };
CGAL::convex_hull_3(points_bis, &points_bis[4], P1);
CGAL_assertion( CGAL::Polygon_mesh_processing::is_outward_oriented(P1) );
}