Subject: CGAL users discussion list
List archive
- From: BBB HHH <>
- To:
- Subject: Re : [cgal-discuss] A problem with iso oriented box intersection package
- Date: Thu, 11 Dec 2008 11:27:26 +0000 (GMT)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=R6wkQuPM0IC4cCoEgqv3nzFU5ZWhMEMQ7grpFbsNQA8Y1UArL1c5bSJYPfJiwofZFJ/UvQr+My74TQNsWxxOGA1/TIu/UbDnisgKcfR9E6gMVa1JIIpzHbMFqUsSDDQfnucrI1B+rURbaIxK4zq8OlUyGukEEFI++mcMTOhX7Zs=;
Hello,
I used the operator() which resolved the problem. But i have another problem. The operator() is given below:
void operator()(const& Box a, const Box& b)
{
Triangles::difference_type index = std::distance(triangles.begin(), box1.handle());
// Here i want to compute the index of the box a in the list of boxes by finding the distance between the box1.handle() (which is of type // std::list<Triangle_3>::iterator) and the trinagles.begin() (which is also of the same type). The index allows me to find corresponding //triangles in my list of triangles and do futher processing.
}
My program compiles successfully but it crashes when trying to execute the line inside the operator().
I am using Visual Studio 2005 with SP. The error is "list iterators incompatible".
My program is included below.
Thanks in advance
Hichem Barki
#include <iostream>
#include <vector>
#include <list>
#include <CGAL/intersections.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/box_intersection_d.h>
#include <CGAL/function_objects.h>
using std::cout;
using std::cin;
using std::endl;
template <class Kernel>
class My_class
{
public:
typedef typename Kernel::FT Number_type;
typedef typename Kernel::Point_2 Point_2;
typedef typename Kernel::Point_3 Point_3;
typedef typename std::list< Triangle_3> Triangles;
typedef typename Triangles::iterator tri_it;
typedef CGAL::Box_intersection_d::Box_with_handle_d<double,3,tri_it> Box;
// Member data
Triangles triangles; // List of the superset triangles
// Constructors
My_class(...)
{
// Fill the list of Triangles
.....
}
void operator()(const& Box a, const Box& b)
{
Triangles::difference_type index = std::distance(triangles.begin(), box1.handle());
}
void get_inters_bboxes()
{
// Create the corresponding vector of bounding boxes
std::vector<Box> boxes;
for (tri_it iter = triangles.begin(); iter != triangles.end(); ++iter)
boxes.push_back( Box( iter->bbox(), iter));
// Run the self intersection algorithm with all defaults
CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), callback, 10, CGAL::Box_intersection_d::HALF_OPEN);
}
};
I used the operator() which resolved the problem. But i have another problem. The operator() is given below:
void operator()(const& Box a, const Box& b)
{
Triangles::difference_type index = std::distance(triangles.begin(), box1.handle());
// Here i want to compute the index of the box a in the list of boxes by finding the distance between the box1.handle() (which is of type // std::list<Triangle_3>::iterator) and the trinagles.begin() (which is also of the same type). The index allows me to find corresponding //triangles in my list of triangles and do futher processing.
}
My program compiles successfully but it crashes when trying to execute the line inside the operator().
I am using Visual Studio 2005 with SP. The error is "list iterators incompatible".
My program is included below.
Thanks in advance
Hichem Barki
#include <iostream>
#include <vector>
#include <list>
#include <CGAL/intersections.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/box_intersection_d.h>
#include <CGAL/function_objects.h>
using std::cout;
using std::cin;
using std::endl;
template <class Kernel>
class My_class
{
public:
typedef typename Kernel::FT Number_type;
typedef typename Kernel::Point_2 Point_2;
typedef typename Kernel::Point_3 Point_3;
typedef typename std::list< Triangle_3> Triangles;
typedef typename Triangles::iterator tri_it;
typedef CGAL::Box_intersection_d::Box_with_handle_d<double,3,tri_it> Box;
// Member data
Triangles triangles; // List of the superset triangles
// Constructors
My_class(...)
{
// Fill the list of Triangles
.....
}
void operator()(const& Box a, const Box& b)
{
Triangles::difference_type index = std::distance(triangles.begin(), box1.handle());
}
void get_inters_bboxes()
{
// Create the corresponding vector of bounding boxes
std::vector<Box> boxes;
for (tri_it iter = triangles.begin(); iter != triangles.end(); ++iter)
boxes.push_back( Box( iter->bbox(), iter));
// Run the self intersection algorithm with all defaults
CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), callback, 10, CGAL::Box_intersection_d::HALF_OPEN);
}
};
De : Pierre Alliez <pierre.alliez@sophia..inria.fr>
À :
Envoyé le : Mercredi, 10 Décembre 2008, 12h14mn 29s
Objet : Re: [cgal-discuss] A problem with iso oriented box intersection package
hi Hichem,
that is tricky indeed - have already encountered this issue which was solved with the help of Andreas Fabri.
I send you my self_intersect global function, which takes as parameters a CGAL polyhedron, and an output iterator where I write all triangles which interesect. as you can see I can pass to the intersection engine a class Intersect_facets with a parameterized constructor.
the callback function is the operator () of that class.
good luck!
pierre
BBB HHH a écrit :
Hello,
I am working with the CGAL::box_self_intersection_d to detect interrsections in a list of bboxes of triangles. I want to do this in an object oriented manner (inside a class). Some parts of my code are listed below. I can not compile my program since there are several errors in the line using box_self_intersection_d.
I think the error is the use of the callback of box_self_intersection_d. In my program this callback is a class member function. In the examples provided by CGAL. The callback is a global function and the box_self_intersection_d function is called inside main(). Can someone help me to detect the problem (how to put a function object inside a class template and how to use it correctly). I tried a global function as a callback, the compile succeds but i can not acces the member data of my class.
Thanks in advance
Hichem BARKI
#include <iostream>
#include <vector>
#include <list>
#include <CGAL/intersections..h>
#include <CGAL/Bbox_3.h>
#include <CGAL/box_intersection_d.h>
#include <CGAL/function_objects.h>
using std::cout;
using std::cin;
using std::endl;
template <class Kernel>
class My_class
{
public:
typedef typename Kernel::FT Number_type;
typedef typename Kernel::Point_2 Point_2;
typedef typename Kernel::Point_3 Point_3;
typedef typename std::list< Triangle_3> Triangles;
typedef typename Triangles::iterator tri_it;
typedef CGAL::Box_intersection_d::Box_with_handle_d<double,3,tri_it> Box;
// Member data
Triangles triangles; // List of the superset triangles
// Constructors
My_class(...)
{
// Fill the list of Triangles
.....
}
void callback(const& Box a, const Box& b)
{
// DO some processing with the member data of My_class
}
void get_inters_bboxes()
{
// Create the corresponding vector of bounding boxes
std::vector<Box> boxes;
for (tri_it iter = triangles.begin(); iter != triangles.end(); ++iter)
boxes.push_back( Box( iter->bbox(), iter));
// Run the self intersection algorithm with all defaults
CGAL::box_self_intersection_d(boxes.begin(), boxes.end(), callback, 10, CGAL::Box_intersection_d::HALF_OPEN);
}
};
--
Pierre Alliez
INRIA Sophia Antipolis - Mediterranee
Project-team GEOMETRICA
http://www-sop.inria.fr/members/Pierre.Alliez/ Tel: +33 4 92 38 76 77 Fax: +33 4 97 15 53 95
- [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/09/2008
- RE: [cgal-discuss] Nef Polyhedron no simple to OFF, Fred Dorosh, 12/09/2008
- Re: [cgal-discuss] Nef Polyhedron no simple to OFF, Pierre Alliez, 12/09/2008
- Re: [cgal-discuss] Nef Polyhedron no simple to OFF, Peter Hachenberger, 12/10/2008
- [cgal-discuss] A problem with iso oriented box intersection package, BBB HHH, 12/10/2008
- Re: [cgal-discuss] A problem with iso oriented box intersection package, Pierre Alliez, 12/10/2008
- Re : [cgal-discuss] A problem with iso oriented box intersection package, BBB HHH, 12/11/2008
- Re: [cgal-discuss] A problem with iso oriented box intersection package, Andreas Fabri, 12/10/2008
- Re : [cgal-discuss] A problem with iso oriented box intersection package, BBB HHH, 12/10/2008
- Re: [cgal-discuss] A problem with iso oriented box intersection package, Pierre Alliez, 12/10/2008
- Re: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/10/2008
- RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, Fred Dorosh, 12/10/2008
- Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/11/2008
- Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, dekosser, 12/11/2008
- Re: Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/17/2008
- Re: Re: Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/18/2008
- Re: Re: Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, dekosser, 12/18/2008
- Re: [cgal-discuss] Nef Polyhedron no simple to OFF, Laurent Rineau (GeometryFactory), 12/18/2008
- Re: Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/17/2008
- Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, dekosser, 12/11/2008
- Re: RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, jona_100, 12/11/2008
- RE: Re: [cgal-discuss] Nef Polyhedron no simple to OFF, Fred Dorosh, 12/10/2008
- [cgal-discuss] A problem with iso oriented box intersection package, BBB HHH, 12/10/2008
- RE: [cgal-discuss] Nef Polyhedron no simple to OFF, Fred Dorosh, 12/09/2008
Archive powered by MHonArc 2.6.16.