コード例 #1
0
ファイル: difference.cpp プロジェクト: HEShuang/SFCGAL
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
ファイル: intersection.cpp プロジェクト: amutu/SFCGAL
	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
ファイル: intersection.cpp プロジェクト: hjanetzek/SFCGAL
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 );
}