Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels
Chronological Thread
- From: Frankie Li <>
- To:
- Subject: Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels
- Date: Thu, 22 Sep 2011 12:38:15 -0400
Hi Sebastien,
I was just using the example file provided by CGAL-3.5 to test this, which is "examples/AABB_tree/AABB_triangle_3_example.cpp". Below is the exact code with the modification that results in the compilation error. By moving the line "#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>" down below the AABB_traits.h include, the compilation completes without any problem.
Thanks once again!
Frankie
------------------------------------------------------------
#include <CGAL/basic.h>
#include <iostream>
#include <list>
#include <CGAL/AABB_tree.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Simple_cartesian.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Ray_3 Ray;
typedef K::Line_3 Line;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef std::list<Triangle>::iterator Iterator;
typedef CGAL::AABB_triangle_primitive<K,Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
int main()
{
Point a(1.0, 0.0, 0.0);
Point b(0.0, 1.0, 0.0);
Point c(0.0, 0.0, 1.0);
Point d(0.0, 0.0, 0.0);
std::list<Triangle> triangles;
triangles.push_back(Triangle(a,b,c));
triangles.push_back(Triangle(a,b,d));
triangles.push_back(Triangle(a,d,c));
// constructs AABB tree
Tree tree(triangles.begin(),triangles.end());
// counts #intersections
Ray ray_query(a,b);
std::cout << tree.number_of_intersected_primitives(ray_query)
<< " intersections(s) with ray query" << std::endl;
// compute closest point and squared distance
Point point_query(2.0, 2.0, 2.0);
Point closest_point = tree.closest_point(point_query);
FT sqd = tree.squared_distance(point_query);
std::cout << "squared distance: " << sqd << std::endl;
return EXIT_SUCCESS;
}
------------------------------------------------------------
On 09/22/2011 12:28 PM, Sebastien Loriot (GeometryFactory) wrote:
Hi Frankie,
actually this should not append and we should include basic.h in each
of our files to avoid user to take care of this.
For your problem, I cannot reproduce it with the code provided.
Can you provide a minimal example showing the problem you have?
Sebastien.
On 09/22/2011 06:09 PM, Frankie Li wrote:
Hi Sebastien,
Unfortunately, that doesn't seem to solve the problem for me...
I apologize ahead for being ignorant of this kind of problems, but is
this due to namespace conflict? I am in the process of moving toward
CGAL 3.7 or later, but admittedly, the migration process is a bit slow,
and I would like to have a temporary fix (if possible) for the current
version.
Thanks again!
Frankie
On 09/22/2011 03:58 AM, Sebastien Loriot (GeometryFactory) wrote:
A golden rule in CGAL is that CGAL/basic.h should be included before
any other CGAL header (or a CGAL kernel that include CGAL/basic.h)
See 2.4
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Preliminaries/Chapter_main.html
Sebastien.
On 09/21/2011 10:32 PM, Frankie Li wrote:
Hi all,
I was wondering if anyone has seen the following problem. The
version of
CGAL I have been using primarily are 3.5.1 and 3.6.
In the AABB_tree example ("AABB_triangle_3_example.cpp"), if we add an
include for "exact predicates inexact constructions kernel in front of
the <CGAL/AABB_traits.h> include:
-----------------------------------------------------------------
#include <iostream>
#include <list>
#include <CGAL/AABB_tree.h> // must be inserted before kernel
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ line added
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Simple_cartesian.h>
-----------------------------------------------------------------
I would end up with the following error:
function_objects.h:1869: error: no matching function for call to
'do_intersect(const CGAL::Sphere_3<CGAL::Simple_cartesian<double> >&,
const CGAL::Bbox_3&, CGAL::Simple_cartesian<double>)'
If I were to move the new line to *after* <CGAL/AABB_traits.h>
-----------------------------------------------------------------
#include <iostream>
#include <list>
#include <CGAL/AABB_tree.h> // must be inserted before kernel
#include <CGAL/AABB_traits.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ line added
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Simple_cartesian.h>
-----------------------------------------------------------------
The problem goes away. Am I not supposed to have the two files included
at the same time? The version of gcc I'm using is gcc 4.4.5.
Thanks,
Frankie
- [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/21/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Frankie Li, 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
- Re: [cgal-discuss] do_intersect name lookup problem when using multiple kernels, Sebastien Loriot (GeometryFactory), 09/22/2011
Archive powered by MHonArc 2.6.16.