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

hexa_poly_intersect.C

00001 #include "poly_cut.h"
00002 #include <list>
00003 
00004 
00005 template <typename Facet_out_iterator>
00006 inline int
00007 slice_poly_with_hexa( Polyhedron& poly,
00008                       Polyhedron::Facet& facet,
00009                       const Hexahedron_3& hexa,
00010                       Facet_out_iterator facets_out )
00011 {
00012     Hexahedron_3::Plane planes[6];
00013 
00014     for( int i = 0; i < 6; ++i )
00015         planes[i] = hexa.plane(i);
00016 
00017     return cut( poly, facet,
00018                 planes, planes + 6,
00019                 facets_out );
00020 }
00021 
00022 
00023 
00031 template <typename Hexahedron_input_iterator,
00032           typename Facet_output_iterator>
00033 int
00034 slice_poly_with_hexa( Polyhedron& poly,
00035                       Polyhedron::Facet& facet,
00036                       Hexahedron_input_iterator hexa_begin,
00037                       Hexahedron_input_iterator hexa_end,
00038                       Facet_output_iterator facets_out )
00039 {
00040     typedef typename Hexahedron_3::Plane Plane;
00041 
00042     std::list<Plane> p_list;
00043     while ( hexa_begin != hexa_end ) {
00044         for( int i = 0; i < 6; ++i )
00045             p_list.push_back( (**hexa_begin).plane(i) );
00046         ++hexa_begin;
00047     }
00048 
00049     return cut( poly, facet,
00050                 p_list.begin(), p_list.end(),
00051                 facets_out );
00052 }
00053 
00054 
00060 template <class Facet_input_iterator>
00061 inline int
00062 slice_poly_with_hexa( Polyhedron& poly,
00063                       Facet_input_iterator begin,
00064                       Facet_input_iterator end,
00065                       const Hexahedron_3& hexa )
00066 {
00067     std::list<Polyhedron::Facet*> f_list;
00068     
00069     while( begin != end ) {
00070         f_list.push_back( &(*begin++) );
00071     }
00072 
00073     int facet_sum = 0;
00074     for( std::list<Polyhedron::Facet*>::iterator it = f_list.begin();
00075          it != f_list.end(); ++it )
00076     {
00077         facet_sum += slice_poly_with_hexa( poly, **it, hexa );
00078     }
00079     return facet_sum;
00080 }
00081 
00082 
00083 template <typename Facet_input_iterator, 
00084           typename Facet_output_iterator>
00085 int
00086 slice_poly_with_hexa( Polyhedron& poly,
00087                       Facet_input_iterator begin,
00088                       Facet_input_iterator end,
00089                       const Hexahedron_3& hexa,
00090                       Facet_output_iterator facets_out )
00091 {
00092     std::list<Polyhedron::Facet*> f_list;
00093 
00094     while( begin != end ) {
00095         f_list.push_back( &(*begin++) );
00096     }
00097 
00098     int facet_sum = 0;
00099     for( std::list<Polyhedron::Facet*>::iterator it = f_list.begin();
00100          it != f_list.end(); ++it )
00101     {
00102         facet_sum += slice_poly_with_hexa( poly, **it, hexa, facets_out );
00103     }
00104     return facet_sum;
00105 }
00106 
00107 
00108 inline void
00109 slice_poly_with_hexa( Polyhedron& poly,
00110                       const Hexahedron_3& hexa )
00111 {
00112     slice_poly_with_hexa( poly, poly.facets_begin(), poly.facets_end(), 
00113                           hexa );
00114 }

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