mirror of https://github.com/CGAL/cgal
the segment and triangle primitive are now compatible with the former classes
even if they were not documented, they were used in examples
This commit is contained in:
parent
caf3bdfac8
commit
f395759b35
|
|
@ -17,7 +17,7 @@ typedef K::Segment_3 Segment;
|
||||||
typedef K::Triangle_3 Triangle;
|
typedef K::Triangle_3 Triangle;
|
||||||
|
|
||||||
typedef std::list<Segment>::iterator Iterator;
|
typedef std::list<Segment>::iterator Iterator;
|
||||||
typedef CGAL::AABB_segment_primitive<Iterator> Primitive;
|
typedef CGAL::AABB_segment_primitive<K, Iterator> 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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ typedef K::Point_3 Point;
|
||||||
typedef K::Triangle_3 Triangle;
|
typedef K::Triangle_3 Triangle;
|
||||||
|
|
||||||
typedef std::list<Triangle>::iterator Iterator;
|
typedef std::list<Triangle>::iterator Iterator;
|
||||||
typedef CGAL::AABB_triangle_primitive<Iterator> Primitive;
|
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
|
||||||
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
||||||
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,30 +24,29 @@
|
||||||
#define CGAL_AABB_SEGMENT_PRIMITIVE_H_
|
#define CGAL_AABB_SEGMENT_PRIMITIVE_H_
|
||||||
|
|
||||||
#include <CGAL/AABB_primitive.h>
|
#include <CGAL/AABB_primitive.h>
|
||||||
#include <CGAL/Kernel_traits.h>
|
#include <CGAL/result_of.h>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template <class Iterator>
|
template <class GeomTraits, class Iterator>
|
||||||
struct Source_of_segment_3_iterator_property_map{
|
struct Source_of_segment_3_iterator_property_map{
|
||||||
//classical typedefs
|
//classical typedefs
|
||||||
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<Iterator>::value_type >::Kernel GeomTraits;
|
|
||||||
typedef Iterator key_type;
|
typedef Iterator key_type;
|
||||||
typedef typename GeomTraits::Point_3 value_type;
|
typedef typename GeomTraits::Point_3 value_type;
|
||||||
typedef const typename GeomTraits::Point_3& reference;
|
typedef typename cpp11::result_of<
|
||||||
|
typename GeomTraits::Construct_source_3(typename GeomTraits::Segment_3)
|
||||||
|
>::type reference;
|
||||||
typedef boost::readable_property_map_tag category;
|
typedef boost::readable_property_map_tag category;
|
||||||
};
|
|
||||||
|
|
||||||
//get function for property map
|
inline friend
|
||||||
template <class Iterator>
|
typename Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>::reference
|
||||||
inline
|
get(Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
|
||||||
typename Source_of_segment_3_iterator_property_map<Iterator>::reference
|
|
||||||
get(Source_of_segment_3_iterator_property_map<Iterator>, Iterator it)
|
|
||||||
{
|
{
|
||||||
return it->source();
|
return typename GeomTraits::Construct_source_3()( *it );
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}//namespace internal
|
}//namespace internal
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,8 +58,11 @@ namespace internal {
|
||||||
*
|
*
|
||||||
* \cgalModels `AABBPrimitive`
|
* \cgalModels `AABBPrimitive`
|
||||||
*
|
*
|
||||||
* \tparam Iterator is a model of `ForwardIterator`, with `Segment_3<Kernel>`
|
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Segment_3`.
|
||||||
* as value type
|
* It also provides the functor `Construct_source_3` that has an operator taking a `Segment_3`
|
||||||
|
* and returning its source as a type convertible to `Point_3`.
|
||||||
|
* In addition `Construct_source_3` must support the result_of protocol.
|
||||||
|
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Segment_3`
|
||||||
* \tparam cache_datum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
|
* \tparam cache_datum 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
|
* the datum is stored in the primitive, while in the latter it is
|
||||||
* constructed on the fly to reduce the memory footprint.
|
* constructed on the fly to reduce the memory footprint.
|
||||||
|
|
@ -72,20 +74,21 @@ namespace internal {
|
||||||
* \sa `AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>`
|
* \sa `AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>`
|
||||||
* \sa `AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>`
|
* \sa `AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>`
|
||||||
*/
|
*/
|
||||||
template < class Iterator,
|
template < class GeomTraits,
|
||||||
|
class Iterator,
|
||||||
class cache_datum=Tag_false>
|
class cache_datum=Tag_false>
|
||||||
class AABB_segment_primitive
|
class AABB_segment_primitive
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
: public AABB_primitive< Iterator,
|
: public AABB_primitive< Iterator,
|
||||||
Input_iterator_property_map<Iterator>,
|
Input_iterator_property_map<Iterator>,
|
||||||
internal::Source_of_segment_3_iterator_property_map<Iterator>,
|
internal::Source_of_segment_3_iterator_property_map<GeomTraits, Iterator>,
|
||||||
Tag_false,
|
Tag_false,
|
||||||
cache_datum >
|
cache_datum >
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef AABB_primitive< Iterator,
|
typedef AABB_primitive< Iterator,
|
||||||
Input_iterator_property_map<Iterator>,
|
Input_iterator_property_map<Iterator>,
|
||||||
internal::Source_of_segment_3_iterator_property_map<Iterator>,
|
internal::Source_of_segment_3_iterator_property_map<GeomTraits, Iterator>,
|
||||||
Tag_false,
|
Tag_false,
|
||||||
cache_datum > Base;
|
cache_datum > Base;
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -24,29 +24,29 @@
|
||||||
#define CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
#define CGAL_AABB_TRIANGLE_PRIMITIVE_H_
|
||||||
|
|
||||||
#include <CGAL/AABB_primitive.h>
|
#include <CGAL/AABB_primitive.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/result_of.h>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template <class Iterator>
|
template <class GeomTraits, class Iterator>
|
||||||
struct Point_from_triangle_3_iterator_property_map{
|
struct Point_from_triangle_3_iterator_property_map{
|
||||||
//classical typedefs
|
//classical typedefs
|
||||||
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<Iterator>::value_type >::Kernel GeomTraits;
|
|
||||||
typedef Iterator key_type;
|
typedef Iterator key_type;
|
||||||
typedef typename GeomTraits::Point_3 value_type;
|
typedef typename GeomTraits::Point_3 value_type;
|
||||||
typedef const typename GeomTraits::Point_3& reference;
|
typedef typename cpp11::result_of<
|
||||||
|
typename GeomTraits::Construct_vertex_3(typename GeomTraits::Triangle_3,int)
|
||||||
|
>::type reference;
|
||||||
typedef boost::readable_property_map_tag category;
|
typedef boost::readable_property_map_tag category;
|
||||||
};
|
|
||||||
|
|
||||||
//get function for property map
|
inline friend
|
||||||
template <class Iterator>
|
typename Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>::reference
|
||||||
inline
|
get(Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
|
||||||
typename Point_from_triangle_3_iterator_property_map<Iterator>::reference
|
|
||||||
get(Point_from_triangle_3_iterator_property_map<Iterator>,Iterator it)
|
|
||||||
{
|
{
|
||||||
return it->vertex(0);
|
return typename GeomTraits::Construct_vertex_3()( *it, 0 );
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}//namespace internal
|
}//namespace internal
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -58,8 +58,11 @@ namespace internal {
|
||||||
*
|
*
|
||||||
* \cgalModels `AABBPrimitive`
|
* \cgalModels `AABBPrimitive`
|
||||||
*
|
*
|
||||||
* \tparam Iterator is a model of `ForwardIterator`, with `Triangle_3<Kernel>`
|
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Triangle_3`.
|
||||||
* as value type
|
* It also provides the functor `Construct_vertex_3` that has an operator taking a `Triangle_3`
|
||||||
|
* and an integer as parameters and returning a triangle point as a type convertible to `Point_3`.
|
||||||
|
* In addition `Construct_vertex_3` must support the result_of protocol.
|
||||||
|
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Triangle_3`
|
||||||
* \tparam cache_datum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
|
* \tparam cache_datum 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
|
* the datum is stored in the primitive, while in the latter it is
|
||||||
* constructed on the fly to reduce the memory footprint.
|
* constructed on the fly to reduce the memory footprint.
|
||||||
|
|
@ -71,24 +74,25 @@ namespace internal {
|
||||||
* \sa `AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>`
|
* \sa `AABB_HalfedgeGraph_segment_primitive<HalfedgeGraph,OneHalfedgeGraphPerTree,cache_datum>`
|
||||||
* \sa `AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>`
|
* \sa `AABB_FaceGraph_triangle_primitive<FaceGraph,OneFaceGraphPerTree,cache_datum>`
|
||||||
*/
|
*/
|
||||||
template < class Iterator,
|
template < class GeomTraits,
|
||||||
|
class Iterator,
|
||||||
class cache_datum=Tag_false>
|
class cache_datum=Tag_false>
|
||||||
class AABB_triangle_primitive
|
class AABB_triangle_primitive
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
: public AABB_primitive< Iterator,
|
: public AABB_primitive< Iterator,
|
||||||
Input_iterator_property_map<Iterator>,
|
Input_iterator_property_map<Iterator>,
|
||||||
internal::Point_from_triangle_3_iterator_property_map<Iterator>,
|
internal::Point_from_triangle_3_iterator_property_map<GeomTraits, Iterator>,
|
||||||
Tag_false,
|
Tag_false,
|
||||||
cache_datum >
|
cache_datum >
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef AABB_primitive< Iterator,
|
typedef AABB_primitive< Iterator,
|
||||||
Input_iterator_property_map<Iterator>,
|
Input_iterator_property_map<Iterator>,
|
||||||
internal::Point_from_triangle_3_iterator_property_map<Iterator>,
|
internal::Point_from_triangle_3_iterator_property_map<GeomTraits, Iterator>,
|
||||||
Tag_false,
|
Tag_false,
|
||||||
cache_datum > Base;
|
cache_datum > Base;
|
||||||
public:
|
public:
|
||||||
// constructors
|
///Constructor from an iterator
|
||||||
AABB_triangle_primitive(Iterator it) : Base(it){}
|
AABB_triangle_primitive(Iterator it) : Base(it){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue