Merge pull request #3226 from maxGimeno/Convex_hull_3-Make_minimal_hull-GF

Convex_hull_3: Make it minimal.
This commit is contained in:
Laurent Rineau 2018-07-18 18:48:26 +02:00 committed by GitHub
commit e8850746f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 6 deletions

View File

@ -355,11 +355,8 @@ find_visible_set(TDS_2& tds,
std::map<typename TDS_2::Vertex_handle, typename TDS_2::Edge>& outside, std::map<typename TDS_2::Vertex_handle, typename TDS_2::Edge>& outside,
const Traits& traits) const Traits& traits)
{ {
typedef typename Traits::Plane_3 Plane_3;
typedef typename TDS_2::Face_handle Face_handle; typedef typename TDS_2::Face_handle Face_handle;
typedef typename TDS_2::Vertex_handle Vertex_handle; typedef typename TDS_2::Vertex_handle Vertex_handle;
typename Traits::Has_on_positive_side_3 has_on_positive_side =
traits.has_on_positive_side_3_object();
std::vector<Vertex_handle> vertices; std::vector<Vertex_handle> vertices;
vertices.reserve(10); vertices.reserve(10);
@ -385,9 +382,10 @@ find_visible_set(TDS_2& tds,
// if haven't already seen this facet // if haven't already seen this facet
if (f->info() == 0) { if (f->info() == 0) {
f->info() = VISITED; f->info() = VISITED;
Plane_3 plane(f->vertex(0)->point(),f->vertex(1)->point(),f->vertex(2)->point()); Is_on_positive_side_of_plane_3<Traits> is_on_positive_side(
traits,f->vertex(0)->point(),f->vertex(2)->point(),f->vertex(1)->point());
int ind = f->index(*vis_it); int ind = f->index(*vis_it);
if ( has_on_positive_side(plane, point) ){ // is visible if ( !is_on_positive_side(point) ){ // is visible
visible.push_back(f); visible.push_back(f);
Vertex_handle vh = f->vertex(ind); Vertex_handle vh = f->vertex(ind);
if(vh->info() == 0){ vertices.push_back(vh); vh->info() = VISITED;} if(vh->info() == 0){ vertices.push_back(vh); vh->info() = VISITED;}

View File

@ -1,10 +1,14 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h> #include <CGAL/convex_hull_3.h>
#include <CGAL/Side_of_triangle_mesh.h>
#include <CGAL/convexity_check_3.h>
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
typedef CGAL::Epick K; typedef CGAL::Epick K;
typedef CGAL::Epeck EK;
int main() int main()
{ {
@ -18,8 +22,20 @@ int main()
CGAL::Polyhedron_3<K> r; CGAL::Polyhedron_3<K> r;
CGAL::convex_hull_3(pointset.begin(), pointset.end(), r); CGAL::convex_hull_3(pointset.begin(), pointset.end(), r);
assert(r.size_of_vertices()==82); assert(r.size_of_vertices()==82);
CGAL::Polyhedron_3<EK> s;
CGAL::copy_face_graph(r,s);
assert(CGAL::is_strongly_convex_3(s));
CGAL::Cartesian_converter<K, EK> to_EK;
CGAL::Side_of_triangle_mesh<CGAL::Polyhedron_3<EK>, EK> sotm(s);
BOOST_FOREACH(K::Point_3 p, pointset)
{
assert(sotm(to_EK(p)) != CGAL::ON_UNBOUNDED_SIDE);
}
return 0; return 0;
} }

View File

@ -49,6 +49,10 @@ Release date: September 2018
to reflect the real needs of the code (some types and operators were used to reflect the real needs of the code (some types and operators were used
in the code but did not appear in the concepts). in the code but did not appear in the concepts).
### Convex hull 3
- Fix a bug in the computation of the 3D convex hull that was leaving extra points
within subset of coplanar points that do not belong to the minimal convex hull.
### Point Set Processing ### Point Set Processing