Пример #1
0
void difference( const GeometrySet<Dim>& a, const GeometrySet<Dim>& b, GeometrySet<Dim>& output )
{
    typename SFCGAL::detail::HandleCollection<Dim>::Type ahandles, bhandles;
    typename SFCGAL::detail::BoxCollection<Dim>::Type aboxes, bboxes;
    a.computeBoundingBoxes( ahandles, aboxes );
    b.computeBoundingBoxes( bhandles, bboxes );

    for ( size_t i = 0; i < aboxes.size(); ++i ) {
        bool intersectsA = false;
        GeometrySet<Dim> tempOut;

        for ( size_t j = 0; j < bboxes.size(); ++j ) {
            if ( CGAL::do_overlap( aboxes[i].bbox(), bboxes[j].bbox() ) ) {
                const PrimitiveHandle<Dim>* pa = aboxes[i].handle();
                const PrimitiveHandle<Dim>* pb = bboxes[j].handle();

                if ( algorithm::intersects( *pa, *pb ) ) {
                    intersectsA = true;

                    difference_primitive( *pa, *pb, tempOut );
                }
            }
        }

        if ( ! intersectsA ) {
            tempOut.addPrimitive( *aboxes[i].handle() );
        }

        filter_self_intersection( tempOut, output );
    }
}
Пример #2
0
	void intersection( const GeometrySet<Dim>& a, const GeometrySet<Dim>& b, GeometrySet<Dim>& output )
	{
		typename SFCGAL::HandleCollection<Dim>::Type ahandles, bhandles;
		typename SFCGAL::BoxCollection<Dim>::Type aboxes, bboxes;
		a.computeBoundingBoxes( ahandles, aboxes );
		b.computeBoundingBoxes( bhandles, bboxes );

		intersection_cb<Dim> cb( output );
		CGAL::box_intersection_d( aboxes.begin(), aboxes.end(),
					  bboxes.begin(), bboxes.end(),
					  cb );
	}
Пример #3
0
void intersection( const GeometrySet<Dim>& a, const GeometrySet<Dim>& b, GeometrySet<Dim>& output )
{
    typename SFCGAL::detail::HandleCollection<Dim>::Type ahandles, bhandles;
    typename SFCGAL::detail::BoxCollection<Dim>::Type aboxes, bboxes;
    a.computeBoundingBoxes( ahandles, aboxes );
    b.computeBoundingBoxes( bhandles, bboxes );

    GeometrySet<Dim> temp, temp2;
    intersection_cb<Dim> cb( temp );
    CGAL::box_intersection_d( aboxes.begin(), aboxes.end(),
                              bboxes.begin(), bboxes.end(),
                              cb );

    post_intersection( temp, temp2 );
    output.merge( temp2 );
}