mirror of https://github.com/CGAL/cgal
*add primitive types for HalfedgeGraph and FaceGraph (wip)
*clean up triangle and segment primitive
This commit is contained in:
parent
aa97a337c7
commit
31d6ebe9bf
|
|
@ -35,6 +35,8 @@ AABB_tree/doc_tex/AABB_tree_ref/introduction.tex -text
|
|||
AABB_tree/doc_tex/AABB_tree_ref/main.tex -text
|
||||
AABB_tree/dont_submit -text
|
||||
AABB_tree/examples/AABB_tree/cleanup.bat -text
|
||||
AABB_tree/include/CGAL/AABB_FaceGraph_triangle_primitive.h -text
|
||||
AABB_tree/include/CGAL/AABB_HalfedgeGraph_segment_primitive.h -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
|
||||
|
|
|
|||
|
|
@ -4,16 +4,15 @@
|
|||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/AABB_triangle_primitive.h>
|
||||
#include <CGAL/Polyhedron_simplex_property_map.h>
|
||||
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
|
||||
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef K::FT FT;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
typedef CGAL::Triangle_from_facet_property_map<Polyhedron> Triangle_property_map;
|
||||
typedef CGAL::AABB_triangle_primitive<K,Polyhedron::Facet_handle,Triangle_property_map> Primitive;
|
||||
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
|
||||
|
|
|
|||
|
|
@ -6,16 +6,15 @@
|
|||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/AABB_segment_primitive.h>
|
||||
#include <CGAL/Polyhedron_simplex_property_map.h>
|
||||
#include <CGAL/AABB_HalfedgeGraph_segment_primitive.h>
|
||||
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef K::FT FT;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Triangle_3 Triangle;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
typedef CGAL::Segment_from_halfedge_property_map<Polyhedron> Segment_property_map;
|
||||
typedef CGAL::AABB_segment_primitive<K,Polyhedron::Halfedge_handle,Segment_property_map> Primitive;
|
||||
typedef CGAL::AABB_HalfedgeGraph_segment_primitive<Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,16 +7,14 @@
|
|||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/AABB_triangle_primitive.h>
|
||||
#include <CGAL/Polyhedron_simplex_property_map.h>
|
||||
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef K::FT FT;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
typedef CGAL::Triangle_from_facet_property_map<Polyhedron> Triangle_property_map;
|
||||
typedef CGAL::AABB_triangle_primitive<K,Polyhedron::Facet_handle,Triangle_property_map> Primitive;
|
||||
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_triangle_primitive.h>
|
||||
#include <CGAL/Polyhedron_simplex_property_map.h>
|
||||
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
|
|
@ -15,8 +14,7 @@ typedef K::Plane_3 Plane;
|
|||
typedef K::Vector_3 Vector;
|
||||
typedef K::Segment_3 Segment;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
typedef CGAL::Triangle_from_facet_property_map<Polyhedron> Triangle_property_map;
|
||||
typedef CGAL::AABB_triangle_primitive<K,Polyhedron::Facet_handle,Triangle_property_map> Primitive;
|
||||
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
// 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 68959 2012-05-04 12:24:50Z sloriot $
|
||||
//
|
||||
//
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
#define CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
|
||||
#include <CGAL/AABB_primitive.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3_property_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template < class FaceGraph,
|
||||
class cache_primitive=Tag_false,
|
||||
class Id_=typename FaceGraph::Face_handle //this one should be autodetected using face_descriptor
|
||||
>
|
||||
|
||||
class AABB_FaceGraph_triangle_primitive : public AABB_primitive< Id_,
|
||||
Triangle_from_facet_property_map<FaceGraph>,
|
||||
One_point_from_facet_property_map<FaceGraph>,
|
||||
cache_primitive >
|
||||
{
|
||||
typedef Triangle_from_facet_property_map<FaceGraph> Triangle_property_map;
|
||||
typedef One_point_from_facet_property_map<FaceGraph> Point_property_map;
|
||||
|
||||
typedef AABB_primitive< Id_,
|
||||
Triangle_property_map,
|
||||
Point_property_map,
|
||||
cache_primitive > Base;
|
||||
|
||||
public:
|
||||
// constructors
|
||||
AABB_FaceGraph_triangle_primitive(Id_ it) : Base(it){}
|
||||
template <class Iterator>
|
||||
AABB_FaceGraph_triangle_primitive(Iterator it) : Base( it->second,
|
||||
Triangle_property_map((it->first)),
|
||||
Point_property_map((it->first)) ){}
|
||||
};
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_AABB_FACEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
// 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 68959 2012-05-04 12:24:50Z sloriot $
|
||||
//
|
||||
//
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
//
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
#define CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
|
||||
#include <CGAL/AABB_primitive.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3_property_map.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <CGAL/is_iterator.h>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template < class HalfedgeGraph,
|
||||
class cache_primitive=Tag_false,
|
||||
class Id_=typename HalfedgeGraph::Halfedge_handle //this one should be autodetected using edge_descriptor
|
||||
>
|
||||
class AABB_HalfedgeGraph_segment_primitive : public AABB_primitive< Id_,
|
||||
Segment_from_halfedge_property_map<HalfedgeGraph>,
|
||||
One_point_from_halfedge_property_map<HalfedgeGraph>,
|
||||
cache_primitive >
|
||||
{
|
||||
typedef Segment_from_halfedge_property_map<HalfedgeGraph> Triangle_property_map;
|
||||
typedef One_point_from_halfedge_property_map<HalfedgeGraph> Point_property_map;
|
||||
|
||||
typedef AABB_primitive< Id_,
|
||||
Triangle_property_map,
|
||||
Point_property_map,
|
||||
cache_primitive > Base;
|
||||
|
||||
public:
|
||||
// constructors
|
||||
AABB_HalfedgeGraph_segment_primitive(Id_ it) : Base(it){}
|
||||
template <class Iterator>
|
||||
AABB_HalfedgeGraph_segment_primitive(Iterator it,
|
||||
typename boost::enable_if<
|
||||
boost::mpl::and_<
|
||||
boost::integral_constant<bool, is_iterator<Iterator>::value >,
|
||||
boost::is_convertible<
|
||||
typename std::iterator_traits<Iterator>::value_type,
|
||||
std::pair<HalfedgeGraph*,Id_>
|
||||
>
|
||||
>
|
||||
>::type* = NULL )
|
||||
: Base( it->second,
|
||||
Triangle_property_map((it->first)),
|
||||
Point_property_map((it->first)) ){}
|
||||
};
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_AABB_HALFEDGEGRAPH_TRIANGLE_PRIMITIVE_H
|
||||
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#define CGAL_AABB_POLYHEDRON_SEGMENT_PRIMITIVE_H_
|
||||
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/AABB_polyhedron_segment_primitive.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_segment_primitive.h> and <CGAL/Polyhedron_simplex_property_map.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_HalfedgeGraph_segment_primitive.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#define CGAL_AABB_POLYHEDRON_TRIANGLE_PRIMITIVE_H_
|
||||
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/AABB_polyhedron_triangle_primitive.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_triangle_primitive.h> and <CGAL/Polyhedron_simplex_property_map.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/AABB_FaceGraph_triangle_primitive.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,38 +23,32 @@
|
|||
//
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
#define CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
#ifndef CGAL_AABB_PRIMITIVE_H
|
||||
#define CGAL_AABB_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,
|
||||
template < class Id_,
|
||||
class ObjectPropertyMap,
|
||||
class PointPropertyMap,
|
||||
bool cache_primitive=false >
|
||||
class cache_primitive=Tag_false >
|
||||
class AABB_primitive :
|
||||
public internal::Primitive_caching< Iterator, TrianglePropertyMap, cache_primitive >
|
||||
public internal::Primitive_caching< Id_, ObjectPropertyMap, cache_primitive >
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Primitive_caching<Id_, ObjectPropertyMap, 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
|
||||
typedef Id_ Id; // Id type
|
||||
|
||||
private:
|
||||
PointPropertyMap m_ppmap;
|
||||
Id m_it;
|
||||
PointPropertyMap m_ppmap
|
||||
|
||||
public:
|
||||
// constructors
|
||||
AABB_primitive() {}
|
||||
|
|
@ -81,5 +75,5 @@ public:
|
|||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||
#endif // CGAL_AABB_PRIMITIVE_H
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2009, 2011 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Pierre Alliez, Stephane Tayeb, Sebastien Loriot
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
|
|
@ -26,110 +26,51 @@
|
|||
#ifndef CGAL_AABB_SEGMENT_PRIMITIVE_H_
|
||||
#define CGAL_AABB_SEGMENT_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>
|
||||
#include <CGAL/AABB_primitive.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace internal{
|
||||
|
||||
//use the property_map to access the point
|
||||
template < class GeomTraits,
|
||||
class Iterator,
|
||||
class SegmentPropertyMap,
|
||||
class PointPropertyMap,
|
||||
bool cache_primitive >
|
||||
class Segment_point_accessor{
|
||||
Segment_point_accessor(PointPropertyMap pmap):m_Point_pmap(pmap){}
|
||||
|
||||
typedef typename PointPropertyMap::reference result_type;
|
||||
|
||||
template <class PrimitiveCaching>
|
||||
result_type get_point(Iterator m_it,const PrimitiveCaching&) const
|
||||
{
|
||||
return get(m_Point_pmap,m_it);
|
||||
}
|
||||
private:
|
||||
PointPropertyMap m_Point_pmap;
|
||||
namespace internal {
|
||||
template <class GeomTraits>
|
||||
struct First_point_of_segment_3_property_map{
|
||||
//classical typedefs
|
||||
typedef const typename GeomTraits::Segment_3& key_type;
|
||||
typedef typename GeomTraits::Point_3 value_type;
|
||||
typedef const typename GeomTraits::Point_3& reference;
|
||||
typedef boost::readable_property_map_tag category;
|
||||
};
|
||||
|
||||
//use Datum to access the point
|
||||
template < class GeomTraits,
|
||||
class Iterator,
|
||||
class SegmentPropertyMap,
|
||||
bool cache_primitive >
|
||||
struct Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,::CGAL::Default,cache_primitive>{
|
||||
Segment_point_accessor( ::CGAL::Default ){}
|
||||
|
||||
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,
|
||||
typename GeomTraits::Point_3
|
||||
>::type const_type;
|
||||
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_reference<typename Prim_caching::result_type>,
|
||||
typename boost::add_reference<const_type>::type,
|
||||
const_type
|
||||
>::type result_type;
|
||||
//get function for property map
|
||||
template <class GeomTraits>
|
||||
inline
|
||||
const typename GeomTraits::Point_3&
|
||||
get(First_point_of_segment_3_property_map<GeomTraits>,
|
||||
const typename GeomTraits::Segment_3& s)
|
||||
{
|
||||
return s.source();
|
||||
}
|
||||
}//namespace internal
|
||||
|
||||
|
||||
result_type get_point(Iterator m_it,
|
||||
const Prim_caching& pcaching) const
|
||||
{
|
||||
return pcaching.get_primitive(m_it).source();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class GeomTraits,
|
||||
class Iterator,
|
||||
class SegmentPropertyMap=boost::typed_identity_property_map<typename GeomTraits::Segment_3>,
|
||||
class PointPropertyMap=Default,
|
||||
bool cache_primitive=false>
|
||||
class AABB_segment_primitive :
|
||||
public internal::Primitive_caching<Iterator,SegmentPropertyMap,cache_primitive>,
|
||||
public internal::Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,PointPropertyMap,cache_primitive>
|
||||
class cache_primitive=Tag_false>
|
||||
class AABB_segment_primitive : public AABB_primitive< Iterator,
|
||||
boost::typed_identity_property_map<typename GeomTraits::Segment_3>,
|
||||
internal::First_point_of_segment_3_property_map<GeomTraits>,
|
||||
cache_primitive >
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<Iterator,SegmentPropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Segment_point_accessor<GeomTraits,Iterator,SegmentPropertyMap,PointPropertyMap,cache_primitive> Point_accessor_base;
|
||||
typedef AABB_primitive< Iterator,
|
||||
boost::typed_identity_property_map<typename GeomTraits::Segment_3>,
|
||||
internal::First_point_of_segment_3_property_map<GeomTraits>,
|
||||
cache_primitive > Base;
|
||||
public:
|
||||
typedef typename GeomTraits::Point_3 Point; // point type
|
||||
typedef typename GeomTraits::Segment_3 Datum; // datum type
|
||||
typedef Iterator Id; // Id type
|
||||
|
||||
// member data
|
||||
private:
|
||||
Id m_it;
|
||||
public:
|
||||
// constructors
|
||||
AABB_segment_primitive() {}
|
||||
AABB_segment_primitive(Id it,SegmentPropertyMap s_pmap=SegmentPropertyMap(),PointPropertyMap p_pmap=PointPropertyMap())
|
||||
: Point_accessor_base(p_pmap), m_it(it)
|
||||
{
|
||||
this->set_primitive(it,s_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 Point_accessor_base::result_type reference_point() const {
|
||||
return this->get_point(m_it,*this);
|
||||
}
|
||||
// constructors
|
||||
AABB_segment_primitive(Iterator it) : Base(it){}
|
||||
};
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_AABB_SEGMENT_PRIMITIVE_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2009, 2011 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 2012 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Pierre Alliez, Stephane Tayeb, Sebastien Loriot
|
||||
// Author(s) : Sebastien Loriot
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
|
|
@ -26,107 +26,47 @@
|
|||
#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>
|
||||
#include <CGAL/AABB_primitive.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace internal{
|
||||
|
||||
//use the property_map to access the point
|
||||
template < class GeomTraits,
|
||||
class Iterator,
|
||||
class TrianglePropertyMap,
|
||||
class PointPropertyMap,
|
||||
bool cache_primitive >
|
||||
class Triangle_point_accessor{
|
||||
Triangle_point_accessor(PointPropertyMap pmap):m_Point_pmap(pmap){}
|
||||
|
||||
typedef typename PointPropertyMap::reference result_type;
|
||||
|
||||
template <class PrimitiveCaching>
|
||||
result_type get_point(Iterator m_it,const PrimitiveCaching&) const
|
||||
{
|
||||
return get(m_Point_pmap,m_it);
|
||||
}
|
||||
private:
|
||||
PointPropertyMap m_Point_pmap;
|
||||
namespace internal {
|
||||
template <class GeomTraits>
|
||||
struct First_point_of_triangle_3_property_map{
|
||||
//classical typedefs
|
||||
typedef const typename GeomTraits::Triangle_3& key_type;
|
||||
typedef typename GeomTraits::Point_3 value_type;
|
||||
typedef const typename GeomTraits::Point_3& reference;
|
||||
typedef boost::readable_property_map_tag category;
|
||||
};
|
||||
|
||||
//use Datum to access the point
|
||||
template < class GeomTraits,
|
||||
class Iterator,
|
||||
class TrianglePropertyMap,
|
||||
bool cache_primitive >
|
||||
struct Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,::CGAL::Default,cache_primitive>{
|
||||
Triangle_point_accessor( ::CGAL::Default ){}
|
||||
|
||||
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,
|
||||
typename GeomTraits::Point_3
|
||||
>::type const_type;
|
||||
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_reference<typename Prim_caching::result_type>,
|
||||
typename boost::add_reference<const_type>::type,
|
||||
const_type
|
||||
>::type result_type;
|
||||
//get function for property map
|
||||
template <class GeomTraits>
|
||||
inline
|
||||
const typename GeomTraits::Point_3&
|
||||
get(First_point_of_triangle_3_property_map<GeomTraits>,
|
||||
const typename GeomTraits::Triangle_3& t)
|
||||
{
|
||||
return t.vertex(0);
|
||||
}
|
||||
}//namespace internal
|
||||
|
||||
result_type get_point(Iterator m_it,
|
||||
const Prim_caching& pcaching) const
|
||||
{
|
||||
return pcaching.get_primitive(m_it).vertex(0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class GeomTraits,
|
||||
class Iterator,
|
||||
class TrianglePropertyMap=boost::typed_identity_property_map<typename GeomTraits::Triangle_3>,
|
||||
class PointPropertyMap=CGAL::Default,
|
||||
bool cache_primitive=false>
|
||||
class AABB_triangle_primitive :
|
||||
public internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive>,
|
||||
public internal::Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,PointPropertyMap,cache_primitive>
|
||||
class cache_primitive=Tag_false>
|
||||
class AABB_triangle_primitive : public AABB_primitive< Iterator,
|
||||
boost::typed_identity_property_map<typename GeomTraits::Triangle_3>,
|
||||
internal::First_point_of_triangle_3_property_map<GeomTraits>,
|
||||
cache_primitive >
|
||||
{
|
||||
// types
|
||||
typedef internal::Primitive_caching<Iterator,TrianglePropertyMap,cache_primitive> Primitive_base;
|
||||
typedef internal::Triangle_point_accessor<GeomTraits,Iterator,TrianglePropertyMap,PointPropertyMap,cache_primitive> Point_accessor_base;
|
||||
typedef AABB_primitive< Iterator,
|
||||
boost::typed_identity_property_map<typename GeomTraits::Triangle_3>,
|
||||
internal::First_point_of_triangle_3_property_map<GeomTraits>,
|
||||
cache_primitive > Base;
|
||||
public:
|
||||
typedef typename GeomTraits::Point_3 Point; // point type
|
||||
typedef typename GeomTraits::Triangle_3 Datum; // datum type
|
||||
typedef Iterator Id; // Id type
|
||||
|
||||
// member data
|
||||
private:
|
||||
Id m_it;
|
||||
public:
|
||||
// constructors
|
||||
AABB_triangle_primitive() {}
|
||||
AABB_triangle_primitive(Id it,TrianglePropertyMap t_pmap=TrianglePropertyMap(), PointPropertyMap p_pmap=PointPropertyMap())
|
||||
: Point_accessor_base(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 Point_accessor_base::result_type reference_point() const {
|
||||
return this->get_point(m_it,*this);
|
||||
}
|
||||
// constructors
|
||||
AABB_triangle_primitive(Iterator it) : Base(it){}
|
||||
};
|
||||
|
||||
} // end namespace CGAL
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
//******************************************************************************
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/tags.h>
|
||||
|
||||
#ifndef CGAL_INTERNAL_AABB_TREE_PRIMITIVE_CACHING_H
|
||||
#define CGAL_INTERNAL_AABB_TREE_PRIMITIVE_CACHING_H
|
||||
|
|
@ -31,11 +32,11 @@
|
|||
namespace CGAL {
|
||||
namespace internal{
|
||||
|
||||
template <class Id,class PropertyMap,bool do_cache>
|
||||
template <class Id,class PropertyMap,class do_cache>
|
||||
struct Primitive_caching;
|
||||
|
||||
template <class Id,class PropertyMap>
|
||||
struct Primitive_caching<Id,PropertyMap,true>
|
||||
struct Primitive_caching<Id,PropertyMap,Tag_true>
|
||||
{
|
||||
|
||||
typedef typename boost::property_traits< PropertyMap >::value_type Primitive;
|
||||
|
|
@ -49,7 +50,7 @@ namespace internal{
|
|||
};
|
||||
|
||||
template <class Id,class PropertyMap>
|
||||
struct Primitive_caching<Id,PropertyMap,false>
|
||||
struct Primitive_caching<Id,PropertyMap,Tag_false>
|
||||
{
|
||||
typedef typename boost::property_traits< PropertyMap >::reference result_type;
|
||||
PropertyMap pmap_;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
#include <CGAL/AABB_polyhedron_segment_primitive.h>
|
||||
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
|
||||
#include <CGAL/AABB_HalfedgeGraph_segment_primitive.h>
|
||||
|
||||
|
||||
double random_in(const double a,
|
||||
|
|
@ -199,7 +199,7 @@ struct Primitive_generator {};
|
|||
template<class K, class Polyhedron>
|
||||
struct Primitive_generator<SEGMENT, K, Polyhedron>
|
||||
{
|
||||
typedef CGAL::AABB_polyhedron_segment_primitive<K,Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_HalfedgeGraph_segment_primitive<Polyhedron> Primitive;
|
||||
|
||||
typedef typename Polyhedron::Edge_iterator iterator;
|
||||
iterator begin(Polyhedron& p) { return p.edges_begin(); }
|
||||
|
|
@ -209,7 +209,7 @@ struct Primitive_generator<SEGMENT, K, Polyhedron>
|
|||
template<class K, class Polyhedron>
|
||||
struct Primitive_generator<TRIANGLE, K, Polyhedron>
|
||||
{
|
||||
typedef CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
|
||||
typedef CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
|
||||
|
||||
typedef typename Polyhedron::Facet_iterator iterator;
|
||||
iterator begin(Polyhedron& p) { return p.facets_begin(); }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
#include <CGAL/AABB_FaceGraph_triangle_primitive.h>
|
||||
|
||||
template <class K>
|
||||
int test()
|
||||
|
|
@ -55,7 +55,7 @@ int test()
|
|||
ifs >> polyhedron;
|
||||
|
||||
// construct tree from facets
|
||||
typedef typename CGAL::AABB_polyhedron_triangle_primitive<K,Polyhedron> Primitive;
|
||||
typedef typename CGAL::AABB_FaceGraph_triangle_primitive<Polyhedron> Primitive;
|
||||
typedef typename CGAL::AABB_traits<K,Primitive> Traits;
|
||||
typedef typename CGAL::AABB_tree<Traits> Tree;
|
||||
typedef typename Tree::Object_and_primitive_id Object_and_primitive_id;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/AABB_polyhedron_segment_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include <CGAL/spatial_sort.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_polyhedron_triangle_primitive.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue