CGAL intersections.h conflicts with Boolean_set_operations_2.h

Alec Jacobson

November 15, 2012

weblog/

I was trying to transform the cgal 2d polygon intersection example into an example that computes 3d triangle intersections. This gave some typical pages of CGAL compiler errors:
In file included from /opt/local/include/CGAL/intersection_3.h:49:0,
                 from /opt/local/include/CGAL/Kernel/function_objects.h:34,
                 from /opt/local/include/CGAL/Cartesian/function_objects.h:28,
                 from /opt/local/include/CGAL/Cartesian/Cartesian_base.h:68,
                 from /opt/local/include/CGAL/Simple_cartesian.h:28,
                 from /opt/local/include/CGAL/Exact_predicates_exact_constructions_kernel.h:28,
                 from CGAL_includes.hpp:4:
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h: In instantiation of 'void CGAL::internal::intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3&, const typename Kernel::Point_3&, const typename Kernel::Point_3&, const Kernel&, std::list<typename Kernel::Point_3>&) [with Kernel = CGAL::Simple_cartesian<CGAL::Gmpq>; typename Kernel::Point_3 = CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; typename R_::Point_3 = CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >]':
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:98:3:   Error: required from 'CGAL::Object CGAL::internal::intersection_coplanar_triangles(const typename Kernel::Triangle_3&, const typename Kernel::Triangle_3&, const Kernel&) [with Kernel = CGAL::Simple_cartesian<CGAL::Gmpq>; typename Kernel::Triangle_3 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >]'
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:136:53:   Error: required from 'CGAL::Object CGAL::internal::intersection(const typename Kernel::Triangle_3&, const typename Kernel::Triangle_3&, const Kernel&) [with Kernel = CGAL::Simple_cartesian<CGAL::Gmpq>; typename Kernel::Triangle_3 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >]'
/opt/local/include/CGAL/Kernel/function_objects.h:2535:49:   Error: required from 'CGAL::CommonKernelFunctors::Intersect_3<K>::Object_3 CGAL::CommonKernelFunctors::Intersect_3<K>::operator()(const T1&, const T2&) const [with T1 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; T2 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; K = CGAL::Simple_cartesian<CGAL::Gmpq>; CGAL::CommonKernelFunctors::Intersect_3<K>::Object_3 = CGAL::Object]'
/opt/local/include/CGAL/Lazy.h:1756:51:   Error: required from 'CGAL::Lazy_construction_object<LK, AC, EC>::result_type CGAL::Lazy_construction_object<LK, AC, EC>::operator()(const L1&, const L2&) const [with L1 = CGAL::Triangle_3<CGAL::Epeck>; L2 = CGAL::Triangle_3<CGAL::Epeck>; LK = CGAL::Epeck; AC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; EC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; CGAL::Lazy_construction_object<LK, AC, EC>::result_type = CGAL::Object]'
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:180:42:   Error: required from 'CGAL::Object CGAL::intersection(const CGAL::Triangle_3<R>&, const CGAL::Triangle_3<R>&) [with K = CGAL::Epeck]'
main.cpp:41:49:   Error: required from here
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:62:64: Error: error: call of overloaded 'intersection(CGAL::CartesianKernelFunctors::Construct_line_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::Line_3, CGAL::CartesianKernelFunctors::Construct_line_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::Line_3, const CGAL::Simple_cartesian<CGAL::Gmpq>&)' is ambiguous
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:62:64: note: candidates are:
In file included from /opt/local/include/CGAL/intersection_3_1.h:427:0,
                 from /opt/local/include/CGAL/intersection_3.h:29,
                 from /opt/local/include/CGAL/Kernel/function_objects.h:34,
                 from /opt/local/include/CGAL/Cartesian/function_objects.h:28,
                 from /opt/local/include/CGAL/Cartesian/Cartesian_base.h:68,
                 from /opt/local/include/CGAL/Simple_cartesian.h:28,
                 from /opt/local/include/CGAL/Exact_predicates_exact_constructions_kernel.h:28,
                 from CGAL_includes.hpp:4:
/opt/local/include/CGAL/Intersections_3/intersection_3_1_impl.h:200:1: Error: note: CGAL::Object CGAL::internal::intersection(const typename K::Line_3&, const typename K::Line_3&, const K&) [with K = CGAL::Simple_cartesian<CGAL::Gmpq>; typename K::Line_3 = CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Gmpq> >]
In file included from CGAL_includes.hpp:11:0:
/opt/local/include/CGAL/Boolean_set_operations_2.h:904:23: Error: note: OutputIterator CGAL::intersection(InputIterator, InputIterator, OutputIterator, unsigned int) [with InputIterator = CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; OutputIterator = CGAL::Simple_cartesian<CGAL::Gmpq>]
In file included from /opt/local/include/CGAL/intersection_3.h:49:0,
                 from /opt/local/include/CGAL/Kernel/function_objects.h:34,
                 from /opt/local/include/CGAL/Cartesian/function_objects.h:28,
                 from /opt/local/include/CGAL/Cartesian/Cartesian_base.h:68,
                 from /opt/local/include/CGAL/Simple_cartesian.h:28,
                 from /opt/local/include/CGAL/Exact_predicates_exact_constructions_kernel.h:28,
                 from CGAL_includes.hpp:4:
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h: In instantiation of 'void CGAL::internal::intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3&, const typename Kernel::Point_3&, const typename Kernel::Point_3&, const Kernel&, std::list<typename Kernel::Point_3>&) [with Kernel = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >; typename Kernel::Point_3 = CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; typename R_::Point_3 = CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >]':
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:98:3:   Error: required from 'CGAL::Object CGAL::internal::intersection_coplanar_triangles(const typename Kernel::Triangle_3&, const typename Kernel::Triangle_3&, const Kernel&) [with Kernel = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >; typename Kernel::Triangle_3 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >]'
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:136:53:   Error: required from 'CGAL::Object CGAL::internal::intersection(const typename Kernel::Triangle_3&, const typename Kernel::Triangle_3&, const Kernel&) [with Kernel = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >; typename Kernel::Triangle_3 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >]'
/opt/local/include/CGAL/Kernel/function_objects.h:2535:49:   Error: required from 'CGAL::CommonKernelFunctors::Intersect_3<K>::Object_3 CGAL::CommonKernelFunctors::Intersect_3<K>::operator()(const T1&, const T2&) const [with T1 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; T2 = CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; K = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >; CGAL::CommonKernelFunctors::Intersect_3<K>::Object_3 = CGAL::Object]'
/opt/local/include/CGAL/Lazy.h:385:22:   Error: required from 'CGAL::Lazy_rep_2<AC, EC, E2A, L1, L2>::Lazy_rep_2(const AC&, const EC&, const L1&, const L2&) [with AC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; EC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; E2A = CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; L1 = CGAL::Triangle_3<CGAL::Epeck>; L2 = CGAL::Triangle_3<CGAL::Epeck>]'
/opt/local/include/CGAL/Lazy.h:1715:73:   Error: required from 'CGAL::Lazy_construction_object<LK, AC, EC>::result_type CGAL::Lazy_construction_object<LK, AC, EC>::operator()(const L1&, const L2&) const [with L1 = CGAL::Triangle_3<CGAL::Epeck>; L2 = CGAL::Triangle_3<CGAL::Epeck>; LK = CGAL::Epeck; AC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; EC = CGAL::CommonKernelFunctors::Intersect_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; CGAL::Lazy_construction_object<LK, AC, EC>::result_type = CGAL::Object]'
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:180:42:   Error: required from 'CGAL::Object CGAL::intersection(const CGAL::Triangle_3<R>&, const CGAL::Triangle_3<R>&) [with K = CGAL::Epeck]'
main.cpp:41:49:   Error: required from here
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:62:64: Error: error: call of overloaded 'intersection(CGAL::CartesianKernelFunctors::Construct_line_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >::Line_3, CGAL::CartesianKernelFunctors::Construct_line_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >::Line_3, const CGAL::Simple_cartesian<CGAL::Interval_nt<false> >&)' is ambiguous
/opt/local/include/CGAL/Triangle_3_Triangle_3_intersection.h:62:64: note: candidates are:
In file included from /opt/local/include/CGAL/intersection_3_1.h:427:0,
                 from /opt/local/include/CGAL/intersection_3.h:29,
                 from /opt/local/include/CGAL/Kernel/function_objects.h:34,
                 from /opt/local/include/CGAL/Cartesian/function_objects.h:28,
                 from /opt/local/include/CGAL/Cartesian/Cartesian_base.h:68,
                 from /opt/local/include/CGAL/Simple_cartesian.h:28,
                 from /opt/local/include/CGAL/Exact_predicates_exact_constructions_kernel.h:28,
                 from CGAL_includes.hpp:4:
/opt/local/include/CGAL/Intersections_3/intersection_3_1_impl.h:200:1: Error: note: CGAL::Object CGAL::internal::intersection(const typename K::Line_3&, const typename K::Line_3&, const K&) [with K = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >; typename K::Line_3 = CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >]
In file included from CGAL_includes.hpp:11:0:
/opt/local/include/CGAL/Boolean_set_operations_2.h:904:23: Error: note: OutputIterator CGAL::intersection(InputIterator, InputIterator, OutputIterator, unsigned int) [with InputIterator = CGAL::Line_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; OutputIterator = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >]
make: *** [obj/main.o] Error 1
I fixed this by making sure in the files where I include:
#include <CGAL/intersections.h>
I don't include:
#include <CGAL/Boolean_set_operations_2.h>