mirror of https://github.com/CGAL/cgal
* remove a template parameter to primitive caching
* add a generic class that has two property map as template parameter to define a aabb_tree primitive
This commit is contained in:
parent
6e72bfd1a7
commit
6efd7f7954
|
|
@ -38,6 +38,7 @@ AABB_tree/examples/AABB_tree/cleanup.bat -text
|
|||
AABB_tree/include/CGAL/AABB_intersections.h -text
|
||||
AABB_tree/include/CGAL/AABB_polyhedron_segment_primitive.h -text
|
||||
AABB_tree/include/CGAL/AABB_polyhedron_triangle_primitive.h -text
|
||||
AABB_tree/include/CGAL/AABB_primitive.h -text
|
||||
AABB_tree/include/CGAL/AABB_traits.h -text
|
||||
AABB_tree/include/CGAL/internal/AABB_tree/Primitive_caching.h -text
|
||||
AABB_tree/test/AABB_tree/AABB_test_util.h -text
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// 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 $
|
||||
// $Id: AABB_triangle_primitive.h 68970 2012-05-04 14:59:14Z sloriot $
|
||||
//
|
||||
//
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
#define CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
|
||||
#include <CGAL/internal/AABB_tree/Primitive_caching.h>
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/Default.h>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class Iterator,
|
||||
class ObjectPropertyMap,
|
||||
class PointPropertyMap,
|
||||
bool cache_primitive=false >
|
||||
class AABB_primitive :
|
||||
public internal::Primitive_caching< Iterator, TrianglePropertyMap, cache_primitive >
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive> Primitive_base;
|
||||
public:
|
||||
|
||||
typedef typename boost::property_traits< ObjectPropertyMap >::value_type Datum; //datum type
|
||||
typedef typename boost::property_traits< PointPropertyMap >::value_type Point; //point type
|
||||
typedef Iterator Id; // Id type
|
||||
|
||||
private:
|
||||
Id m_it;
|
||||
PointPropertyMap m_ppmap
|
||||
public:
|
||||
// constructors
|
||||
AABB_primitive() {}
|
||||
AABB_primitive(Id it,ObjectPropertyMap t_pmap=ObjectPropertyMap(), PointPropertyMap p_pmap=PointPropertyMap())
|
||||
: m_ppmap(p_pmap), m_it(it)
|
||||
{
|
||||
this->set_primitive(it,t_pmap);
|
||||
}
|
||||
public:
|
||||
Id& id() { return m_it; }
|
||||
const Id& id() const { return m_it; }
|
||||
|
||||
typename Primitive_base::result_type datum() const {
|
||||
return this->get_primitive(m_it);
|
||||
}
|
||||
|
||||
/// Returns a point on the primitive
|
||||
typename boost::property_traits< PointPropertyMap >::reference
|
||||
reference_point() const {
|
||||
return get(m_ppmap,*m_it);
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ namespace internal{
|
|||
struct Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,::CGAL::Default,cache_primitive>{
|
||||
Segment_point_accessor( ::CGAL::Default ){}
|
||||
|
||||
typedef Primitive_caching<typename GeomTraits::Segment_3,Iterator,SegmentPropertyMap,cache_primitive> Prim_caching;
|
||||
typedef Primitive_caching<Iterator,SegmentPropertyMap,cache_primitive> Prim_caching;
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_const<typename Prim_caching::result_type>,
|
||||
typename boost::add_const<typename GeomTraits::Point_3>::type,
|
||||
|
|
@ -94,11 +94,11 @@ template <class GeomTraits,
|
|||
class PointPropertyMap=Default,
|
||||
bool cache_primitive=false>
|
||||
class AABB_segment_primitive :
|
||||
public internal::Primitive_caching<typename GeomTraits::Segment_3,Iterator,SegmentPropertyMap,cache_primitive>,
|
||||
public internal::Primitive_caching<Iterator,SegmentPropertyMap,cache_primitive>,
|
||||
public internal::Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,PointPropertyMap,cache_primitive>
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<typename GeomTraits::Segment_3,Iterator,SegmentPropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Primitive_caching<Iterator,SegmentPropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,PointPropertyMap,cache_primitive> Point_accessor_base;
|
||||
public:
|
||||
typedef typename GeomTraits::Point_3 Point; // point type
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace internal{
|
|||
struct Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,::CGAL::Default,cache_primitive>{
|
||||
Triangle_point_accessor( ::CGAL::Default ){}
|
||||
|
||||
typedef Primitive_caching<typename GeomTraits::Triangle_3,Iterator,TrianglePropertyMap,cache_primitive> Prim_caching;
|
||||
typedef Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive> Prim_caching;
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_const<typename Prim_caching::result_type>,
|
||||
typename boost::add_const<typename GeomTraits::Point_3>::type,
|
||||
|
|
@ -94,11 +94,11 @@ template <class GeomTraits,
|
|||
class PointPropertyMap=CGAL::Default,
|
||||
bool cache_primitive=false>
|
||||
class AABB_triangle_primitive :
|
||||
public internal::Primitive_caching<typename GeomTraits::Triangle_3,Iterator,TrianglePropertyMap,cache_primitive>,
|
||||
public internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive>,
|
||||
public internal::Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,PointPropertyMap,cache_primitive>
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<typename GeomTraits::Triangle_3,Iterator,TrianglePropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,PointPropertyMap,cache_primitive> Point_accessor_base;
|
||||
public:
|
||||
typedef typename GeomTraits::Point_3 Point; // point type
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright (c) 2011 GeometryFactory (France).
|
||||
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
//
|
||||
//******************************************************************************
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#ifndef CGAL_INTERNAL_AABB_TREE_PRIMITIVE_CACHING_H
|
||||
#define CGAL_INTERNAL_AABB_TREE_PRIMITIVE_CACHING_H
|
||||
|
|
@ -29,12 +31,14 @@
|
|||
namespace CGAL {
|
||||
namespace internal{
|
||||
|
||||
template <class Primitive,class Id,class PropertyMap,bool do_cache>
|
||||
template <class Id,class PropertyMap,bool do_cache>
|
||||
struct Primitive_caching;
|
||||
|
||||
template <class Primitive,class Id,class PropertyMap>
|
||||
struct Primitive_caching<Primitive,Id,PropertyMap,true>
|
||||
template <class Id,class PropertyMap>
|
||||
struct Primitive_caching<Id,PropertyMap,true>
|
||||
{
|
||||
|
||||
typedef typename boost::property_traits< PropertyMap >::value_type Primitive;
|
||||
typedef const Primitive& result_type;
|
||||
Primitive datum;
|
||||
|
||||
|
|
@ -44,10 +48,10 @@ namespace internal{
|
|||
}
|
||||
};
|
||||
|
||||
template <class Primitive,class Id,class PropertyMap>
|
||||
struct Primitive_caching<Primitive,Id,PropertyMap,false>
|
||||
template <class Id,class PropertyMap>
|
||||
struct Primitive_caching<Id,PropertyMap,false>
|
||||
{
|
||||
typedef typename PropertyMap::reference result_type;
|
||||
typedef typename boost::property_traits< PropertyMap >::reference result_type;
|
||||
PropertyMap pmap_;
|
||||
|
||||
void set_primitive(Id,PropertyMap pmap){pmap_=pmap;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue