Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

process_box_pair.cc

00001 #include "poly.h"
00002 #include "Box_3.h"
00003 
00004 #include <CGAL/Gmpz.h>
00005 #include <CGAL/Homogeneous.h>
00006 #include <CGAL/Point_3.h>
00007 #include <CGAL/Segment_3.h>
00008 #include <CGAL/Triangle_3.h>
00009 
00010 #include "set_point.h"
00011 
00012 #include <CEP/intersection/Box_d_Box_d.h>
00013 #include <CEP/intersection/Triangle_3_Triangle_3.h>
00014 
00015 #include <vector>
00016 #include <ostream>
00017 
00018 #include "oogl.h"
00019 
00020 
00021 
00022 typedef CGAL::Homogeneous<CGAL::Gmpz>   H_rep;
00023 typedef CGAL::Point_3<H_rep>            Point;
00024 typedef CGAL::Point_3<H_rep>            Segment;
00025 typedef CGAL::Triangle_3<H_rep>         Triangle;
00026 
00027 //typedef CGAL::Point_3<R>                InputPoint;
00028 
00029 
00030 std::vector<CGAL::Object> obj_list;
00031 
00032 
00033 
00034 Triangle compute_facet_triangle( const Facet& f ) {
00035     Polyhedron::Halfedge_const_handle h = f.halfedge();
00036     
00037     // Make sure face is a triangle
00038     CGAL_assertion( h->next()->next()->next() == h );
00039 
00040     Point a,b,c;
00041 
00042     set_point( a, h->opposite()->vertex()->point() );
00043     set_point( b, h->vertex()->point() );
00044     set_point( c, h->next()->vertex()->point() );
00045 
00046     return Triangle(a,b,c);
00047 }
00048 
00049 
00050 void process_box_pair( const FacetBox_pair& bp )
00051 {
00052     CGAL_assertion( CEP::intersection::do_intersect( bp.first, bp.second ) );
00053     
00054     if ( are_incident( bp.first.get_facet(), bp.second.get_facet() ) )
00055         return;
00056 
00057     Triangle T1 = compute_facet_triangle( bp.first.get_facet() );
00058     Triangle T2 = compute_facet_triangle( bp.second.get_facet() );
00059     CGAL::Object i = CEP::intersection::intersection( T1, T2 );
00060 
00061     if ( i.is_empty() )
00062         return;
00063 
00064     obj_list.push_back(i);
00065 }
00066 
00067 
00068 void process_results( std::ostream& os )
00069 {
00070     typedef std::vector<CGAL::Object>::iterator iterator;
00071     write_oogl_vect<H_rep,iterator>( os,
00072                                      obj_list.begin(),
00073                                      obj_list.end() );
00074 }
00075 

Generated on Fri Oct 26 23:38:11 2001 for bicobj-intersection by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001