Merge branch 'AABB_tree-fix_graph_primitives-local'

This fixes the graph primitives that were only model of
AABBPrimitiveWithSharedData, and also remove the artificial compatibility
with deprecated primitives that are not needed since we want to make users
use the new method.

Successfully tested in CGAL-4.3-Ic-107
  One example on the platform i686_Linux-2.6_g++-4.1.2_CentOS-5.1-O3 indicates
  an error, but after checking it is a floating point computation threshold
  issue. The example expects an error to be below 1e-10 and it is 1.1e-10.
Approved by the interim release manager
This commit is contained in:
Sébastien Loriot 2013-07-31 17:32:15 +02:00
commit f5f6b034a6
12 changed files with 99 additions and 70 deletions

View File

@ -401,7 +401,7 @@ void Scene::build_facet_tree()
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
std::cout << "Construct Facet AABB tree..."; std::cout << "Construct Facet AABB tree...";
m_facet_tree.rebuild(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); m_facet_tree.rebuild(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
m_facet_tree.accelerate_distance_queries(); m_facet_tree.accelerate_distance_queries();
std::cout << "done (" << timer.time() << " s)" << std::endl; std::cout << "done (" << timer.time() << " s)" << std::endl;
} }
@ -421,7 +421,7 @@ void Scene::build_edge_tree()
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
std::cout << "Construct Edge AABB tree..."; std::cout << "Construct Edge AABB tree...";
m_edge_tree.rebuild(m_pPolyhedron->edges_begin(),m_pPolyhedron->edges_end()); m_edge_tree.rebuild(boost::edges(*m_pPolyhedron).first,boost::edges(*m_pPolyhedron).second,*m_pPolyhedron);
m_edge_tree.accelerate_distance_queries(); m_edge_tree.accelerate_distance_queries();
std::cout << "done (" << timer.time() << " s)" << std::endl; std::cout << "done (" << timer.time() << " s)" << std::endl;
} }

View File

@ -16,7 +16,7 @@ void Scene::benchmark_intersections(const double duration)
std::cout << "Construct AABB tree..."; std::cout << "Construct AABB tree...";
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
std::cout << "done (" << timer.time() << " s)" << std::endl; std::cout << "done (" << timer.time() << " s)" << std::endl;
// generates random queries // generates random queries
@ -76,7 +76,7 @@ void Scene::benchmark_distances(const double duration)
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
std::cout << "Construct AABB tree and internal KD tree..."; std::cout << "Construct AABB tree and internal KD tree...";
Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
std::cout << "done (" << timer.time() << " s)" << std::endl; std::cout << "done (" << timer.time() << " s)" << std::endl;
@ -122,7 +122,7 @@ void Scene::bench_memory()
// constructs tree and measure memory before then after // constructs tree and measure memory before then after
typedef CGAL::Memory_sizer::size_type size_type; typedef CGAL::Memory_sizer::size_type size_type;
size_type before = CGAL::Memory_sizer().virtual_size(); size_type before = CGAL::Memory_sizer().virtual_size();
Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
// tree.accelerate_distance_queries(); // 150 vs 61 bytes per primitive! // tree.accelerate_distance_queries(); // 150 vs 61 bytes per primitive!
size_type after = CGAL::Memory_sizer().virtual_size(); size_type after = CGAL::Memory_sizer().virtual_size();
@ -159,12 +159,12 @@ void Scene::bench_construction()
// constructs tree // constructs tree
CGAL::Timer time1; CGAL::Timer time1;
time1.start(); time1.start();
Facet_tree tree1(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree1(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
double duration_construction_alone = time1.time(); double duration_construction_alone = time1.time();
CGAL::Timer time2; CGAL::Timer time2;
time2.start(); time2.start();
Facet_tree tree2(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree2(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
tree2.accelerate_distance_queries(); tree2.accelerate_distance_queries();
double duration_construction_and_kdtree = time2.time(); double duration_construction_and_kdtree = time2.time();
@ -203,7 +203,7 @@ void Scene::bench_intersections_vs_nbt()
refiner.run_nb_splits(nb_splits); refiner.run_nb_splits(nb_splits);
// constructs tree (out of timing) // constructs tree (out of timing)
Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
// calls ray queries // calls ray queries
CGAL::Timer timer; CGAL::Timer timer;
@ -247,7 +247,7 @@ void Scene::bench_distances_vs_nbt()
refiner.run_nb_splits(nb_splits); refiner.run_nb_splits(nb_splits);
// constructs tree (out of timing) // constructs tree (out of timing)
Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end()); Facet_tree tree(m_pPolyhedron->facets_begin(),m_pPolyhedron->facets_end(),*m_pPolyhedron);
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
// calls queries // calls queries

View File

@ -12,7 +12,7 @@ typedef K::FT FT;
typedef K::Point_3 Point; typedef K::Point_3 Point;
typedef K::Segment_3 Segment; typedef K::Segment_3 Segment;
typedef CGAL::Polyhedron_3<K> Polyhedron; typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive; typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, CGAL::Default, CGAL::Tag_false> Primitive;
typedef CGAL::AABB_traits<K, Primitive> Traits; typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree; typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id; typedef Tree::Point_and_primitive_id Point_and_primitive_id;
@ -33,13 +33,13 @@ int main()
Point s2(10.0, 0.0, 0.0); Point s2(10.0, 0.0, 0.0);
Polyhedron polyhedron2; Polyhedron polyhedron2;
polyhedron2.make_tetrahedron(p2, q2, r2, s2); polyhedron2.make_tetrahedron(p2, q2, r2, s2);
// constructs AABB tree and computes internal KD-tree // constructs AABB tree and computes internal KD-tree
// data structure to accelerate distance queries // data structure to accelerate distance queries
Tree tree(polyhedron1.facets_begin(),polyhedron1.facets_end()); Tree tree(polyhedron1.facets_begin(),polyhedron1.facets_end(), polyhedron1);
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
tree.insert(polyhedron2.facets_begin(),polyhedron2.facets_end()); tree.insert(polyhedron2.facets_begin(),polyhedron2.facets_end(), polyhedron2);
// query point // query point
Point query(0.0, 0.0, 3.0); Point query(0.0, 0.0, 3.0);

View File

@ -7,7 +7,8 @@
#include <CGAL/AABB_traits.h> #include <CGAL/AABB_traits.h>
#include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h> #include <CGAL/AABB_halfedge_graph_segment_primitive.h>
#include <CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
typedef CGAL::Simple_cartesian<double> K; typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT; typedef K::FT FT;
@ -29,7 +30,9 @@ int main()
// constructs the AABB tree and the internal search tree for // constructs the AABB tree and the internal search tree for
// efficient distance queries. // efficient distance queries.
Tree tree(polyhedron.edges_begin(),polyhedron.edges_end()); Tree tree( CGAL::undirected_edges(polyhedron).first,
CGAL::undirected_edges(polyhedron).second,
polyhedron);
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
// counts #intersections with a triangle query // counts #intersections with a triangle query

View File

@ -30,7 +30,7 @@ int main()
// constructs AABB tree and computes internal KD-tree // constructs AABB tree and computes internal KD-tree
// data structure to accelerate distance queries // data structure to accelerate distance queries
Tree tree(polyhedron.facets_begin(),polyhedron.facets_end()); Tree tree(polyhedron.facets_begin(),polyhedron.facets_end(),polyhedron);
tree.accelerate_distance_queries(); tree.accelerate_distance_queries();
// query point // query point

View File

@ -31,7 +31,7 @@ int main()
polyhedron.make_tetrahedron(p, q, r, s); polyhedron.make_tetrahedron(p, q, r, s);
// constructs AABB tree // constructs AABB tree
Tree tree(polyhedron.facets_begin(),polyhedron.facets_end()); Tree tree(polyhedron.facets_begin(),polyhedron.facets_end(),polyhedron);
// constructs segment query // constructs segment query
Point a(-0.2, 0.2, -0.2); Point a(-0.2, 0.2, -0.2);

View File

@ -41,7 +41,11 @@ namespace CGAL {
*\tparam FaceGraph is a \cgal polyhedron. *\tparam FaceGraph is a \cgal polyhedron.
*\tparam VertexPointPMap must be set to `CGAL::Default` *\tparam VertexPointPMap must be set to `CGAL::Default`
* This parameter is useless for the moment and will be useful in an upcoming release of \cgal. * This parameter is useless for the moment and will be useful in an upcoming release of \cgal.
*\tparam OneFaceGraphPerTree must be set to `CGAL::Default` *\tparam OneFaceGraphPerTree is either `CGAL::Tag_true or `CGAL::Tag_false`.
* In the former case, we guarantee that all the primitives will be from a
* common polyhedron and some data will be factorized so that the size of
* the primitive is reduced. In the latter case, the primitives can be from
* different polyhedra and extra storage is required in the primitives. The default is `CGAL::Tag_true`.
* This parameter is useless for the moment and will be useful in an upcoming release of \cgal. * This parameter is useless for the moment and will be useful in an upcoming release of \cgal.
*\tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, the datum is stored *\tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, the datum is stored
* in the primitive, while in the latter it is constructed on the fly to reduce the memory footprint. * in the primitive, while in the latter it is constructed on the fly to reduce the memory footprint.
@ -52,7 +56,7 @@ namespace CGAL {
*/ */
template < class FaceGraph, template < class FaceGraph,
class VertexPointPMap = Default, class VertexPointPMap = Default,
class OneFaceGraphPerTree = Default, class OneFaceGraphPerTree = Tag_true,
class CacheDatum=Tag_false > class CacheDatum=Tag_false >
class AABB_face_graph_triangle_primitive class AABB_face_graph_triangle_primitive
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
@ -63,7 +67,7 @@ class AABB_face_graph_triangle_primitive
>::type, >::type,
Triangle_from_facet_handle_property_map<FaceGraph>, Triangle_from_facet_handle_property_map<FaceGraph>,
One_point_from_facet_handle_property_map<FaceGraph>, One_point_from_facet_handle_property_map<FaceGraph>,
Tag_true, OneFaceGraphPerTree,
CacheDatum > CacheDatum >
#endif #endif
{ {
@ -77,7 +81,7 @@ class AABB_face_graph_triangle_primitive
typedef AABB_primitive< Id_, typedef AABB_primitive< Id_,
Triangle_property_map, Triangle_property_map,
Point_property_map, Point_property_map,
Tag_true, OneFaceGraphPerTree,
CacheDatum > Base; CacheDatum > Base;
public: public:
@ -97,6 +101,11 @@ public:
*/ */
typedef boost::graph_traits<FaceGraph>::face_descriptor Id; typedef boost::graph_traits<FaceGraph>::face_descriptor Id;
/// @} /// @}
/*!
If `OneFaceGraphPerTree` is CGAL::Tag_true, constructs a `Shared_data` object from a reference to the polyhedon `graph`.
*/
static unspecified_type construct_shared_data( FaceGraph& graph );
#endif #endif
// constructors // constructors
@ -110,22 +119,14 @@ public:
Triangle_property_map(&graph), Triangle_property_map(&graph),
Point_property_map(&graph) ){} Point_property_map(&graph) ){}
/// For backward-compatibility with AABB_polyhedron_triangle_primitive only. /// \internal
/// `Id_` is `Facet_const_handle` if `FaceGraph` is const and `Facet_handle` otherwise. typedef internal::Cstr_shared_data<FaceGraph, Base, Triangle_property_map, Point_property_map, OneFaceGraphPerTree> Cstr_shared_data;
AABB_face_graph_triangle_primitive(Id_ id) /// \internal
: Base( id, static
Triangle_property_map(NULL), typename Cstr_shared_data::Shared_data
Point_property_map(NULL) ){} construct_shared_data(FaceGraph& graph)
static typename Base::Shared_data construct_shared_data( FaceGraph& graph )
{ {
return Base::construct_shared_data(Triangle_property_map(&graph), Point_property_map(&graph)); return Cstr_shared_data::construct_shared_data(graph);
}
/// For backward-compatibility with AABB_polyhedron_triangle_primitive only
static typename Base::Shared_data construct_shared_data()
{
return Base::construct_shared_data(Triangle_property_map(NULL), Point_property_map(NULL));
} }
}; };

View File

@ -31,7 +31,6 @@
#include <CGAL/is_iterator.h> #include <CGAL/is_iterator.h>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
namespace CGAL { namespace CGAL {
@ -84,7 +83,7 @@ class AABB_halfedge_graph_segment_primitive
typedef AABB_primitive< Id_, typedef AABB_primitive< Id_,
Segment_property_map, Segment_property_map,
Point_property_map, Point_property_map,
Tag_true, OneHalfedgeGraphPerTree,
CacheDatum > Base; CacheDatum > Base;
public: public:
@ -105,6 +104,11 @@ public:
*/ */
typedef boost::graph_traits<HalfedgeGraph>::edge_descriptor Id; typedef boost::graph_traits<HalfedgeGraph>::edge_descriptor Id;
/// @} /// @}
/*!
If `OneHalfedgeGraphPerTreeGraphPerTree` is CGAL::Tag_true, constructs a `Shared_data` object from a reference to the halfedge graph.
*/
static unspecified_type construct_shared_data( HalfedgeGraph& graph );
#endif #endif
/*! /*!
@ -130,21 +134,14 @@ public:
Point_property_map(&graph) ){} Point_property_map(&graph) ){}
#endif #endif
/// For backward-compatibility with AABB_polyhedron_segment_primitive only /// \internal
AABB_halfedge_graph_segment_primitive(Id_ id) typedef internal::Cstr_shared_data<HalfedgeGraph, Base, Segment_property_map, Point_property_map, OneHalfedgeGraphPerTree> Cstr_shared_data;
: Base( id, /// \internal
Segment_property_map(NULL), static
Point_property_map(NULL) ){} typename Cstr_shared_data::Shared_data
construct_shared_data(HalfedgeGraph& graph)
static typename Base::Shared_data construct_shared_data( HalfedgeGraph& graph )
{ {
return Base::construct_shared_data(Segment_property_map(&graph), Point_property_map(&graph)); return Cstr_shared_data::construct_shared_data(graph);
}
///For backward-compatibility with AABB_polyhedron_segment_primitive only
static typename Base::Shared_data construct_shared_data()
{
return Base::construct_shared_data(Segment_property_map(NULL), Point_property_map(NULL));
} }
}; };

View File

@ -22,6 +22,7 @@
#ifndef CGAL_AABB_PRIMITIVE_H #ifndef CGAL_AABB_PRIMITIVE_H
#define CGAL_AABB_PRIMITIVE_H #define CGAL_AABB_PRIMITIVE_H
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <CGAL/property_map.h> #include <CGAL/property_map.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>

View File

@ -12,8 +12,8 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL: svn+ssh://sloriot@scm.gforge.inria.fr/svn/cgal/branches/features/AABB_tree-one_primitive_per_object-sloriot/AABB_tree/include/CGAL/AABB_triangle_primitive.h $ // $URL$
// $Id: AABB_triangle_primitive.h 69127 2012-05-14 16:10:00Z sloriot $ // $Id$
// //
// //
// Author(s) : Sebastien Loriot // Author(s) : Sebastien Loriot
@ -33,7 +33,32 @@ namespace CGAL{
namespace internal{ namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Shared_data,Shared_data,false) BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Shared_data,Shared_data,false)
// Utility class used by AABB_face_graph_triangle_primitive and AABB_halfedge_graph_segment_primitive
// to implement the Consruct_shared_data static function.
template<class Graph, class Base, class ObjectPropertyMap, class PointPropertyMap, class HasSharedDataTag>
struct Cstr_shared_data;
template<class Graph, class Base, class ObjectPropertyMap, class PointPropertyMap>
struct Cstr_shared_data<Graph, Base, ObjectPropertyMap, PointPropertyMap, ::CGAL::Tag_true>
{
typedef typename Base::Shared_data Shared_data;
static Shared_data construct_shared_data(Graph& graph)
{
return Base::construct_shared_data(ObjectPropertyMap(&graph), PointPropertyMap(&graph));
}
};
template<class Graph, class Base, class ObjectPropertyMap, class PointPropertyMap>
struct Cstr_shared_data<Graph, Base, ObjectPropertyMap, PointPropertyMap, ::CGAL::Tag_false>
{
typedef void* Shared_data;
static Shared_data construct_shared_data(Graph&)
{
return NULL;
}
};
} } //namespace CGAL } } //namespace CGAL
#endif //CGAL_INTERNAL_AABB_TREE_HAS_NESTED_TYPE_SHARED_DATA_H #endif //CGAL_INTERNAL_AABB_TREE_HAS_NESTED_TYPE_SHARED_DATA_H

View File

@ -29,6 +29,7 @@
#include <CGAL/AABB_face_graph_triangle_primitive.h> #include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_halfedge_graph_segment_primitive.h> #include <CGAL/AABB_halfedge_graph_segment_primitive.h>
#include <CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h>
#include <CGAL/internal/AABB_tree/Primitive_helper.h> #include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <boost/mem_fn.hpp> #include <boost/mem_fn.hpp>
@ -216,9 +217,10 @@ struct Primitive_generator<SEGMENT, K, Polyhedron>
{ {
typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive; typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive;
typedef typename Polyhedron::Edge_iterator iterator; typedef typename CGAL::halfedge_graph_traits<Polyhedron>
iterator begin(Polyhedron& p) { return p.edges_begin(); } ::undirected_edge_iterator iterator;
iterator end(Polyhedron& p) { return p.edges_end(); } iterator begin(Polyhedron& p) { return CGAL::undirected_edges(p).first; }
iterator end(Polyhedron& p) { return CGAL::undirected_edges(p).second; }
}; };
template<class K, class Polyhedron> template<class K, class Polyhedron>
@ -259,7 +261,7 @@ void test(const char *filename,
// constructs AABB tree and internal search KD-tree with // constructs AABB tree and internal search KD-tree with
// the points of the polyhedron // the points of the polyhedron
Tree tree(Pr_generator().begin(polyhedron),Pr_generator().end(polyhedron)); Tree tree(Pr_generator().begin(polyhedron),Pr_generator().end(polyhedron), polyhedron);
//tree.accelerate_distance_queries(polyhedron.points_begin(),polyhedron.points_end()); //tree.accelerate_distance_queries(polyhedron.points_begin(),polyhedron.points_end());
// call all tests // call all tests
@ -341,7 +343,7 @@ public:
Polyhedron_primitive_iterator it = Pr_generator().begin(p); Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it ) for ( ; it != Pr_generator().end(p) ; ++it )
{ {
if ( m_traits.do_intersect_object()(query, Pr(it) ) ) if ( m_traits.do_intersect_object()(query, Pr(it,p) ) )
return true; return true;
} }
@ -357,7 +359,7 @@ public:
Polyhedron_primitive_iterator it = Pr_generator().begin(p); Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it ) for ( ; it != Pr_generator().end(p) ; ++it )
{ {
if ( m_traits.do_intersect_object()(query, Pr(it) ) ) if ( m_traits.do_intersect_object()(query, Pr(it,p) ) )
++result; ++result;
} }
@ -372,8 +374,8 @@ public:
Polyhedron_primitive_iterator it = Pr_generator().begin(p); Polyhedron_primitive_iterator it = Pr_generator().begin(p);
for ( ; it != Pr_generator().end(p) ; ++it ) for ( ; it != Pr_generator().end(p) ; ++it )
{ {
if ( m_traits.do_intersect_object()(query, Pr(it) ) ) if ( m_traits.do_intersect_object()(query, Pr(it,p) ) )
*out++ = Pr(it).id(); *out++ = Pr(it,p).id();
} }
return out; return out;
@ -389,10 +391,10 @@ public:
{ {
#if CGAL_INTERSECTION_VERSION < 2 #if CGAL_INTERSECTION_VERSION < 2
Intersection_result Intersection_result
intersection = Traits().intersection_object()(query, Pr(it)); intersection = Traits().intersection_object()(query, Pr(it,p));
#else #else
boost::optional< typename Traits::template Intersection_and_primitive_id<Query>::Type > boost::optional< typename Traits::template Intersection_and_primitive_id<Query>::Type >
intersection = m_traits.intersection_object()(query, Pr(it)); intersection = m_traits.intersection_object()(query, Pr(it,p));
#endif #endif
if ( intersection ) if ( intersection )
*out++ = *intersection; *out++ = *intersection;
@ -409,11 +411,11 @@ public:
assert ( it != Pr_generator().end(p) ); assert ( it != Pr_generator().end(p) );
// Get a point on the primitive // Get a point on the primitive
Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(Pr(it),m_traits); Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(Pr(it,p),m_traits);
for ( ; it != Pr_generator().end(p) ; ++it ) for ( ; it != Pr_generator().end(p) ; ++it )
{ {
closest_point = m_traits.closest_point_object()(query, Pr(it), closest_point); closest_point = m_traits.closest_point_object()(query, Pr(it,p), closest_point);
} }
return closest_point; return closest_point;
@ -427,12 +429,12 @@ public:
assert ( it != Pr_generator().end(p) ); assert ( it != Pr_generator().end(p) );
// Get a point on the primitive // Get a point on the primitive
Pr closest_primitive = Pr(it); Pr closest_primitive = Pr(it,p);
Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(closest_primitive,m_traits); Point closest_point = CGAL::internal::Primitive_helper<Traits>::get_reference_point(closest_primitive,m_traits);
for ( ; it != Pr_generator().end(p) ; ++it ) for ( ; it != Pr_generator().end(p) ; ++it )
{ {
Pr tmp_pr(it); Pr tmp_pr(it,p);
Point tmp_pt = m_traits.closest_point_object()(query, tmp_pr, closest_point); Point tmp_pt = m_traits.closest_point_object()(query, tmp_pr, closest_point);
if ( tmp_pt != closest_point ) if ( tmp_pt != closest_point )
{ {

View File

@ -59,7 +59,7 @@ int test()
typedef typename CGAL::AABB_traits<K,Primitive> Traits; typedef typename CGAL::AABB_traits<K,Primitive> Traits;
typedef typename CGAL::AABB_tree<Traits> Tree; typedef typename CGAL::AABB_tree<Traits> Tree;
typedef typename Tree::Object_and_primitive_id Object_and_primitive_id; typedef typename Tree::Object_and_primitive_id Object_and_primitive_id;
Tree tree(polyhedron.facets_begin(),polyhedron.facets_end()); Tree tree(polyhedron.facets_begin(),polyhedron.facets_end(), polyhedron);
// segment intersection query // segment intersection query
Point p((FT)-0.25, (FT)0.251, (FT)0.255); Point p((FT)-0.25, (FT)0.251, (FT)0.255);