/* Test method The goal is to show the qt widget with the polyhedron. TODO: Move it out of this class once stable. */ void show(Nef_polyhedron_3 N){ char *args[]={"Nef_Polyhedron_3 Viewer"}; int argc=1; QApplication a(argc, args); CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>* w = new CGAL::Qt_widget_Nef_3<Nef_polyhedron_3>(N); a.setMainWidget(w); w->show(); a.exec(); }
int main(int argc, char* argv[]) { // We've put the typedefs here as VC7 gives us an ICE if they are global typedefs typedef Nef_polyhedron::SNC_structure SNC_structure; typedef CGAL::visual_hull_creator<SNC_structure> VHC; if(argc!=2) { std::cerr << "Usage: visual_hull file" << std::endl; std::cerr << "For more information read the README file" << std::endl; return 1; } std::ifstream in(argv[1]); NaryInt ni; CGAL::Timer t; Point_3 room_min = read_point(in); Point_3 room_max = read_point(in); int ncameras; in >> ncameras; for(int cam=0; cam<ncameras; ++cam) { Point_3 camera(read_point(in)); int npolygons; in >> npolygons; std::list<std::list<Point_3> > polygon_list; for(int poly=0; poly<npolygons; ++poly) { int npoints; in >> npoints; std::list<Point_3> input_points; for(int pnt=0; pnt<npoints; ++pnt) input_points.push_back(read_point(in)); polygon_list.push_back(input_points); } std::list<std::list<Point_3> >::iterator li; for(li=polygon_list.begin(); li!=polygon_list.end(); ++li) { std::list<Point_3>::iterator pi(li->begin()), pimin(pi), pi_next,pi_prev; for(; pi!=li->end(); ++pi) { if(CGAL::lexicographically_xyz_smaller(*pi,*pimin)) pimin=pi; } pi_next=pi_prev=pimin; ++pi_next; if(pi_next==li->end()) pi_next=li->begin(); if(pi_prev==li->begin()) pi_prev=li->end(); --pi_prev; if(CGAL::orientation(*pi_prev,*pimin,*pi_next,camera) == CGAL::POSITIVE) li->reverse(); } t.start(); Nef_polyhedron N; VHC vhc(room_min, room_max, camera, polygon_list); N.delegate(vhc,true); CGAL_assertion(N.is_valid()); t.stop(); std::cerr << "create view " << t.time() << std::endl; t.reset(); ni.add_polyhedron(N); } Nef_polyhedron result = ni.get_intersection(); QApplication a(argc,argv); CGAL::Qt_widget_Nef_3<Nef_polyhedron>* w = new CGAL::Qt_widget_Nef_3<Nef_polyhedron>(result); a.setMainWidget(w); w->show(); a.exec(); }