Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Intersection of surfaces
  • Date: Mon, 30 May 2011 12:22:13 +0200
  • Organization: GeometryFactory


Roger,

did you have a look at the user manual with the examples?

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Box_intersection_d/Chapter_main.html#Section_61.5

You put a face iterator in your box, so the face iterator
allows you to use ->vertex(i) for the three vertices.

andreas


On 30/05/2011 12:11, Roger Mason wrote:
Hello Sebastien,

"Sebastien Loriot (GeometryFactory) [via cgal-discuss]"
<[hidden email] </user/SendEmail.jtp?type=node&node=3560357&i=0>> 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
<http://cgal-discuss.949826.n4.nabble.com/Intersection-of-surfaces-tp3549940p3560357.html>
Sent from the cgal-discuss mailing list archive
<http://cgal-discuss.949826.n4.nabble.com/> at Nabble.com.


--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912 skype: andreas.fabri



Archive powered by MHonArc 2.6.16.

Top of Page