Subject: CGAL users discussion list
List archive
- From: Andre Massing <>
- To:
- Subject: [cgal-discuss] converting Polyhedron to Nef_polyhedron with strange result
- Date: Tue, 23 Mar 2010 13:53:05 +0100
- Organization: Simula Research Laboratory
Hi all!
I guess it is probably just a matter of my lacking comprehension, but I have
difficulties to interpret the outcome of a Polyhedron to Nef_polyhedron
conversion. I startet with the four points of the "unit" or standard
tetrahedron, built up a tetrahedron via the make_tetrahedron member function
of the Polyhedron class and after that created a Nef_polyhedron. When I
iterate over the points by the attached code, it gives me output like
Source point -0 -1 1
Target point -0 -1 -0
which confuses me because the tetrahedron was defined by (0,0,0), (1,0,0),
(0,1,0) and (0,0,1) as the iteration over the vertices of the polyhedron also
shows (beside the strange minus in front of 0) How to I have to intepret
this?
Demostrating code is attached.
Any enlightment are highly appreciated!
Andre
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Nef_polyhedron_3.h> #include <CGAL/Polyhedron_3.h> typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3; typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron_3; typedef Nef_polyhedron_3::Point_3 Point_3; int main() { Point_3 a(1.0, 0.0, 0.0); Point_3 b(0.0, 1.0, 0.0); Point_3 c(0.0, 0.0, 1.0); Point_3 d(0.0, 0.0, 0.0); //Build a tetrahedron Polyhedron_3 P; P.make_tetrahedron(a,b,c,d); for (Polyhedron_3::Vertex_iterator vi = P.vertices_begin(); vi != P.vertices_end(); ++vi) { std::cout <<"Point in Polyhedron: " << vi->point() <<std::endl; } std::cout << std::endl; Nef_polyhedron_3 NP(P); std::cout << "Iteration along face ...\n"; int face_counter = 0; for(Nef_polyhedron_3::Halffacet_const_iterator f = NP.halffacets_begin (), end = NP.halffacets_end(); f != end; ++f) { if(f->is_twin()) continue; std::cout <<"########################################" << std::endl; std::cout << "Face number " << face_counter++ << std::endl; for(Nef_polyhedron_3::Halffacet_cycle_const_iterator fc = f->facet_cycles_begin(), cycles_end = f->facet_cycles_end(); fc != cycles_end; ++fc) { int edge_counter = 0; if ( fc.is_shalfedge() ) { std::cout <<"++++++++++++++++++++++++++++++++++++++++" << std::endl; std::cout << "Edge number " << edge_counter++ << std::endl; Nef_polyhedron_3::SHalfedge_const_handle se = fc; Nef_polyhedron_3::SHalfedge_around_facet_const_circulator hc(se); Nef_polyhedron_3::SHalfedge_around_facet_const_circulator he(hc); std::cout <<"Edge consist of points: " << std::endl; CGAL_For_all(hc,he) { Point_3 source_point(hc->source()->point()); Point_3 target_point(hc->target()->point()); std::cout <<"----------------------------------------" << std::endl; std::cout <<"Source point " << source_point << std::endl; std::cout <<"Target point " << target_point <<std::endl; } } } } return 0; }
- [cgal-discuss] converting Polyhedron to Nef_polyhedron with strange result, Andre Massing, 03/23/2010
Archive powered by MHonArc 2.6.16.