Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: Intersection of surfaces

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: Intersection of surfaces


Chronological Thread 
  • From: Roger Mason <>
  • To:
  • Subject: [cgal-discuss] Re: Intersection of surfaces
  • Date: Mon, 30 May 2011 03:11:27 -0700 (PDT)

Hello Sebastien,

"Sebastien Loriot (GeometryFactory) [via cgal-discuss]"
<[hidden email]> writes:

> Something like this.
>
> typedef
> CGAL::Box_intersection_d::Box_with_handle_d<double,3,Terrain::Finite_faces_iterator>
> Box;
>
> std::vector<Box> boxes;
> boxes.reserve(t.number_of_faces);
> Terrain t;
> Terrain::Finite_faces_iterator fit=t.finite_faces_begin();
> for (;fit!=t.finite_faces_end();++it){
>    CGAL::Bbox_3 bbox=fit->vertex(0)->point().bbox()+
>                      fit->vertex(1)->point().bbox()+
>                      fit->vertex(2)->point().bbox();
>    boxes.push_back(Box(bbox,fit));
> }
>
> The triangles should be created only in the callback.
>

I now have:

....

  Terrain::Finite_faces_iterator fit=L.finite_faces_begin();
  for (;fit!=L.finite_faces_end();++fit){
    CGAL::Bbox_3 bbox=fit->vertex(0)->point().bbox()+
      fit->vertex(1)->point().bbox()+
      fit->vertex(2)->point().bbox();
    boxesL.push_back(Box(bbox,fit));
  }

  std::vector<Box> boxesS;
  boxesS.reserve( S.number_of_faces() );

  fit=S.finite_faces_begin();
  for (;fit!=S.finite_faces_end();++fit){
    CGAL::Bbox_3 bbox=fit->vertex(0)->point().bbox()+
      fit->vertex(1)->point().bbox()+
      fit->vertex(2)->point().bbox();
    boxesS.push_back(Box(bbox,fit));
  }

// See Help/CGAL/cgal_manual.pdf Chapter 61.7
 // run the intersection algorithm and store results in a vector
 std::vector<std::size_t> result;
 CGAL::box_intersection_d( boxesS.begin(), boxesS.end(), boxesL.begin(), boxesL.end(),
                           report( std::back_inserter( result)),
                           std::ptrdiff_t(1), CGAL::Box_intersection_d::HALF_OPEN);

 // sort and show results
 std::sort( result.begin(), result.end());
 std::cout << "There are " << result.size() << " potential intersections" << std::endl;
 std::copy( result.begin(), result.end(),
            std::ostream_iterator<std::size_t>( std::cout, " "));
 std::cout << std::endl;

The output is, I assume, a list of box id's.  How do I extract the
vertices of the triangles in these boxes?

Any help you give is most appreciated, but if you don't have time, I
understand.

Best wishes,
Roger


View this message in context: Re: Intersection of surfaces
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page